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_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?
-Tatu
[1]
http://code.google.com/p/selenium/issues/detail?id=2067
> --
> 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
>
robotframe...@googlegroups.com.
> To unsubscribe from this group, send email to
>
robotframework-u...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/robotframework-users?hl=en.