jessezach / RobotEyes

Image comparison for Robot Framework
MIT License
75 stars 24 forks source link

"Capture Element" keyword on IE11 returns "JavascriptException: Message: Error executing JavaScript" #35

Closed JoaoEnesGoncalves closed 5 years ago

JoaoEnesGoncalves commented 5 years ago

On Internet Explorerer 11 after call keyword "RobotEyes.Capture Element" was verified error message just with "JavascriptException: Message: Error executing JavaScript"

note: Internet Explorerer 11 webdriver was configured to enable JavaScripting

logs

KEYWORD RobotEyes . Capture Element id=${button_locator}
TRACE   Arguments: [ 'id=default' ]
DEBUG   GET http://127.0.0.1:63787/session/d09d66d5-19a6-49c9-9e91-6df2108259ca/screenshot {}
DEBUG   Starting new HTTP connection (1): 127.0.0.1:63787
DEBUG   http://127.0.0.1:63787 "GET /session/d09d66d5-19a6-49c9-9e91-6df2108259ca/screenshot HTTP/1.1" 200 42393
DEBUG   Finished Request
DEBUG   POST http://127.0.0.1:63787/session/d09d66d5-19a6-49c9-9e91-6df2108259ca/element {"using": "css selector", "value": "[id=\"default\"]"}
DEBUG   Starting new HTTP connection (1): 127.0.0.1:63787
DEBUG   http://127.0.0.1:63787 "POST /session/d09d66d5-19a6-49c9-9e91-6df2108259ca/element HTTP/1.1" 200 102
DEBUG   Finished Request
DEBUG   POST http://127.0.0.1:63787/session/d09d66d5-19a6-49c9-9e91-6df2108259ca/execute/sync {"script": "var e = document.getElementById(\"default\");return e.getBoundingClientRect();", "args": []}
DEBUG   Starting new HTTP connection (1): 127.0.0.1:63787
DEBUG   http://127.0.0.1:63787 "POST /session/d09d66d5-19a6-49c9-9e91-6df2108259ca/execute/sync HTTP/1.1" 500 134
DEBUG   Finished Request
FAIL    JavascriptException: Message: Error executing JavaScript
DEBUG   Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\RobotEyes\__init__.py", line 60, in capture_element
    count = self.browser.capture_element(self.path, selector, blur, radius)
  File "c:\program files\python37\lib\site-packages\RobotEyes\selenium_hooks.py", line 28, in capture_element
    coord = self._get_coordinates(prefix, locator)
  File "c:\program files\python37\lib\site-packages\RobotEyes\selenium_hooks.py", line 111, in _get_coordinates
    coord = self.driver.execute_script(cmd)
  File "c:\program files\python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 636, in execute_script
    'args': converted_args})['value']
  File "c:\program files\python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "c:\program files\python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
TRACE   Arguments: [ ${button_locator}='default' | ${theme}='default' ]
jessezach commented 5 years ago

@JoaoEnesGoncalves Could you confirm that you're not facing this issue when calling the execute javascript directly from a selenium test in robot framework?

jessezach commented 5 years ago

Tried fixing this issue in https://github.com/jz-jess/RobotEyes/pull/37 If Javascript error is thrown by selenium, then coordinates will be fetched from the selenium's element object.

jessezach commented 5 years ago

Released fix in version 1.1.3