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.
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.
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
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?
> 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 received this message because you are subscribed to the Google > Groups "robotframework-users" group.
> To view this discussion on the web visit > https://groups.google.com/d/msg/robotframework-users/-/6NWwK5SCX4IJ.
> To post to this group, send email to > robotframework-users@googlegroups.com.
> To unsubscribe from this group, send email to > robotframework-users+unsubscribe@googlegroups.com.
> For more options, visit this group at > http://groups.google.com/group/robotframework-users?hl=en.
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:
> 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
> 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_**chains.py", line 44, in perform
> action()
> File "/usr/local/lib/python2.7/**dist-packages/selenium/**
> webdriver/common/action_**chains.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/errorhandler.**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?
>> Good luck,
>> Kevin
>> --
>> You received this message because you are subscribed to the Google Groups
>> "robotframework-users" group.
>> To view this discussion on the web visit https://groups.google.com/d/** >> msg/robotframework-users/-/**6NWwK5SCX4IJ<https://groups.google.com/d/msg/robotframework-users/-/6NWwK5SCX4IJ>
>> .
>> To post to this group, send email to robotframework-users@**
>> googlegroups.com <robotframework-users@googlegroups.com>.
>> To unsubscribe from this group, send email to robotframework-users+**
>> unsubscribe@googlegroups.com<robotframework-users%2Bunsubscribe@googlegroup s.com>
>> .
>> For more options, visit this group at http://groups.google.com/** >> group/robotframework-users?hl=**en<http://groups.google.com/group/robotframework-users?hl=en>
>> .
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
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.
> 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 > <mailto:aalto.t...@gmail.com>> wrote:
> 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
> 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?
> 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 received this message because you are subscribed to the
> Google Groups "robotframework-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/robotframework-users/-/6NWwK5SCX4IJ.
> To post to this group, send email to
> robotframework-users@googlegroups.com
> <mailto:robotframework-users@googlegroups.com>.
> To unsubscribe from this group, send email to
> robotframework-users+unsubscribe@googlegroups.com
> <mailto:robotframework-users%2Bunsubscribe@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/robotframework-users?hl=en.
> -- > You received this message because you are subscribed to the Google > Groups "robotframework-users" group.
> To post to this group, send email to > robotframework-users@googlegroups.com.
> To unsubscribe from this group, send email to > robotframework-users+unsubscribe@googlegroups.com.
> For more options, visit this group at > http://groups.google.com/group/robotframework-users?hl=en.
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] :-)
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 :-)
> 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] :-)
> 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.
> 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.