I did notice that I did forget to post the stack trace form the Wait* keywords. I agree that error is real and element in that moment is sale, but which I do not agree that why the Wait* keywords on Selenium2Library fails. In my mind, if there is an error, the Wait keywords should perform a retry. So is this a bug or is this expected behavior? In my mind this is a bug, because only way to cope on the error is extend the S2L with my own keywords, which will handle the situation or use Wait Until Keyword Succeeds. And both of them are quite a ugly hacks, which I do not like doing.
Selenium2Library.Wait Until Element Is Visible xpath=//span/span[text()="${menu_item}"], timeout=5s, error=Menu item ${menu_item} not found on page!
Documentation:
Waits until element specified with `locator` is visible.
Start / End / Elapsed: 20150730 14:24:49.623 / 20150730 14:24:50.240 / 00:00:00.617
00:00:00.376KEYWORD: common_library_imports.Selenium2library Common Failure
14:24:49.624 TRACE Arguments: [ u'xpath=//span/span[text()="XXXXXX"]' | timeout=u'5s' | error=u'Menu item XXXXXX not found on page!' ]
14:24:49.829 DEBUG Finished Request
14:24:49.855 DEBUG Finished Request
14:24:50.239 FAIL StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
(Session info: chrome=44.0.2403.125)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64)
14:24:50.239 DEBUG Traceback (most recent call last):
File "<string>", line 2, in wait_until_element_is_visible
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 15, in _run_on_failure_decorator
return method(*args, **kwargs)
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_waiting.py", line 128, in wait_until_element_is_visible
self._wait_until_no_error(timeout, check_visibility)
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_waiting.py", line 237, in _wait_until_no_error
timeout_error = wait_func(*args)
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_waiting.py", line 121, in check_visibility
visible = self._is_visible(locator)
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_element.py", line 723, in _is_visible
return element.is_displayed()
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 323, in is_displayed
return self._execute(Command.IS_ELEMENT_DISPLAYED)['value']
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 402, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\Selenium2Library\webdrivermonkeypatches.py", line 11, in execute
result = self._base_execute(driver_command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 175, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 166, in check_response
raise exception_class(message, screen, stacktrace)
14:24:49.621 TRACE Arguments: [ ${menu_item}=u'XXXXXX' | ${timeout}=u'10' ]