Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Selenium2Library Click Element from specific coordinates
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tatu aalto  
View profile  
 More options Oct 24 2012, 10:33 am
From: Tatu aalto <aalto.t...@gmail.com>
Date: Wed, 24 Oct 2012 07:33:23 -0700 (PDT)
Local: Wed, Oct 24 2012 10:33 am
Subject: Selenium2Library Click Element from specific coordinates

Ugh

I have element in my web page, which enables user to zoom in and out. One
can think it as a route on the map. Now in my application, when zoomed in,
user can influence the route with greater detail. Where the zooming goes,
is determined by the place where user clicks on the map/element.

But this causes a challenge in Selenium2Library. The only way click the
element is to use Click Element keyword and by default and it seems to
click on the middle of the element. Is it somehow possible to adjust where
in the element the Click element keyword clicks? If not, can/how should I
create a new keyword, which enabled me to click on the desired
place/coordinates.

-Tatu


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin O.  
View profile  
 More options Oct 25 2012, 11:59 am
From: "Kevin O." <kormb...@gmail.com>
Date: Thu, 25 Oct 2012 08:59:24 -0700 (PDT)
Local: Thurs, Oct 25 2012 11:59 am
Subject: Re: Selenium2Library Click Element from specific coordinates

I have no experience in doing what you are trying to do, but it looks like
you will have to go down to the WebDriver API to do what you want.
The action_chains API has some promising methods (e.g. using
move_to_element_with_offset and click(None)):
http://selenium.googlecode.com/svn/trunk/docs/api/py/webdriver/seleni...
I found an example of how to use action chains in Python here:
http://stackoverflow.com/questions/11092748/how-to-mouseover-in-pytho...
There are examples in this group how to get the instance of WebDriver in
user and library(Python) keywords.
From what I saw I would not expect it to work on all platforms or browsers,
though.

Good luck,
Kevin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatu Aalto  
View profile  
 More options Oct 26 2012, 5:33 am
From: Tatu Aalto <aalto.t...@gmail.com>
Date: Fri, 26 Oct 2012 12:33:24 +0300
Local: Fri, Oct 26 2012 5:33 am
Subject: Re: Selenium2Library Click Element from specific coordinates
Ugh

Thanks for help. When running only with selenium, this code seems to do
the trick:
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

#driver = webdriver.Chrome()
driver = webdriver.Firefox()

driver.get("URL-HERE")

element = driver.find_element_by_xpath("XPATH-HERE")

ActionChains(driver).move_to_element(element).move_by_offset(300,
100).click().perform()

By looking Selenium2Library code (first time for me), it would seem fair
easy to implement this. Because the code seems really clear also for a
tester eyes.

But it has an limitation. It runs fine with Chrome but in Firefox get
stack trace. I did not try IE, because our SUT lives in a linux world. I
see this trace when executing above line of code in Firefox:

Traceback (most recent call last):
   File "test.py", line 45, in <module>
ActionChains(driver).move_to_element(chartStabs).move_by_offset(-300,
-100).click().perform()
   File
"/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/action_ch ains.py",
line 44, in perform
     action()
   File
"/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/action_ch ains.py",
line 190, in <lambda>
     'yoffset': yoffset}))
   File
"/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver .py",
line 156, in execute
     self.error_handler.check_response(response)
   File
"/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhand ler.py",
line 147, in check_response
     raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'Element cannot
be scrolled into view:[object HTMLImageElement]'

Because it seems to be pure selenium issue and when looking selenium
user group, other people have had similar problems [1]. The workaround

I could write patch for Selenium2Library, but it would work only in
Chrome. Would it be acceptable?

-Tatu

[1] http://code.google.com/p/selenium/issues/detail?id=2067

On 25.10.2012 18:59, Kevin O. wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatu aalto  
View profile  
 More options Oct 26 2012, 11:19 am
From: Tatu aalto <aalto.t...@gmail.com>
Date: Fri, 26 Oct 2012 18:19:16 +0300
Local: Fri, Oct 26 2012 11:19 am
Subject: Re: Selenium2Library Click Element from specific coordinates

Ugh

Well the error was caused because I did click out of the element. Strange
that it does not complain in Chrome. But it does not work with Firefox.
With Firefox it always clicks on the middle of the element.

But I did made the patch and a acceptance test case for it. But when I run
the test the test passes but the report is marked as failing. Could
some-one provide some pointers how the acceptance test should be build for
Selenium2Library?

-Tatu
On Oct 26, 2012 12:33 PM, "Tatu Aalto" <aalto.t...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ed Manlove  
View profile  
 More options Oct 26 2012, 1:12 pm
From: Ed Manlove <devPyP...@verizon.net>
Date: Fri, 26 Oct 2012 13:12:20 -0400
Local: Fri, Oct 26 2012 1:12 pm
Subject: Re: Selenium2Library Click Element from specific coordinates

Tatu,

There is a little bit of information within the developer information
doc - BUILD.rst  [1] about the internal acceptance and unit tests. And
there are the tests themselves for which you can find some related
acceptance tests within

https://github.com/rtomac/robotframework-selenium2library/blob/master...

You could either add the patch and test to an issue or submit a pull
request from your clone repository.

Also Tatu, if I may ask, is the term "Ugh" a greeting?  I have seen it
used in this forum before but I am sorry to say I'm a little ignorant of
it's meaning.  Thank you for helping me learn more.

Ed

[1]
https://github.com/rtomac/robotframework-selenium2library/blob/master...

On 10/26/2012 11:19 AM, Tatu aalto wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jussi Mononen  
View profile  
 More options Oct 26 2012, 1:42 pm
From: Jussi Mononen <agilepoo...@gmail.com>
Date: Fri, 26 Oct 2012 20:42:56 +0300
Local: Fri, Oct 26 2012 1:42 pm
Subject: Re: Selenium2Library Click Element from specific coordinates
On 26 October 2012 20:12, Ed Manlove <devPyP...@verizon.net> wrote:

> Also Tatu, if I may ask, is the term "Ugh" a greeting?  I have seen it used
> in this forum before but I am sorry to say I'm a little ignorant of it's
> meaning.  Thank you for helping me learn more.

Hi,

at least in Finnish comics the term "Ugh" has been used as a greeting
of native American Indians. I'm pretty sure that it does not signify
"boredom" as defined in the Urban Dictionary [1] :-)

-jussi

[1] http://www.urbandictionary.com/define.php?term=Ugh

--
"Progress doesn't come from early risers — progress is made by lazy
men looking for easier ways to do things." - Robert A. Heinlein
[ http://www.agile.fi - http://www.agilefinland.com -
http://www.scan-agile.org ]
[ http://www.jussimononen.org - http://www.twitter.com/agilepoodle ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatu Aalto  
View profile  
 More options Oct 27 2012, 2:50 pm
From: Tatu Aalto <aalto.t...@gmail.com>
Date: Sat, 27 Oct 2012 21:50:49 +0300
Local: Sat, Oct 27 2012 2:50 pm
Subject: Re: Selenium2Library Click Element from specific coordinates

Ugh

The new keyword:
Thanks for the tips. I did found what was making the test fail. It was
the wrong documentation in the test. It seems that the test
documentation is used for compare the first keyword in the test. When I
fixed that, report.html did go green.

I did create a patch for the new keyword, but I do not understand how
this githup works. Where do I send it and how?

For the second question:

Jussi did got it right. The comic in question in my case was the Donald
Duck. When I was younger, I though it would cool to start letters (you
know the ones written in paper with hand) like that. Well, anyway when
the change to email did come, the same greeting did stuck.

It was years later, when I did learn that it means also boredom. But am
too stubborn to change the greeting of my emails. And do not worry, you
are not first one to ask from it and I am pretty sure that you are not
the last one :-)

-Tatu

On 26.10.2012 20:42, Jussi Mononen wrote:

  click_element_at_coordinates.patch
6K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pekka Klärck  
View profile  
 More options Oct 29 2012, 6:36 am
From: Pekka Klärck <p...@iki.fi>
Date: Mon, 29 Oct 2012 12:36:28 +0200
Local: Mon, Oct 29 2012 6:36 am
Subject: Re: Selenium2Library Click Element from specific coordinates
2012/10/27 Tatu Aalto <aalto.t...@gmail.com>:

> I did create a patch for the new keyword, but I do not understand how this
> githup works. Where do I send it and how?

GitHub uses "pull requests" for this purpose. That's a lot better
approach than sending patches and the main reason we plan to move
Robot itself either to GitHub or BitBucket some time in the nearish
future.

For more information about pull requests in general and how they are
used in GitHub see:
https://help.github.com/articles/using-pull-requests

Cheers,
     .peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatu Aalto  
View profile  
 More options Oct 30 2012, 4:15 am
From: Tatu Aalto <aalto.t...@gmail.com>
Date: Tue, 30 Oct 2012 10:15:33 +0200
Local: Tues, Oct 30 2012 4:15 am
Subject: Re: Selenium2Library Click Element from specific coordinates
Ugh

Thanks from the pointers, doing it by yourself gives good view how this
git works. I did send a pull request to the origin and it is waiting
comments.

-Tatu

On 29.10.2012 12:36, Pekka Kl rck wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »