{"action":"created","issue":{"url":"https://api.github.com/repos/robotframework/SeleniumLibrary/issues/475","repository_url":"https://api.github.com/repos/robotframework/SeleniumLibrary","labels_url":"https://api.github.com/repos/robotframework/SeleniumLibrary/issues/475/labels{/name}","comments_url":"https://api.github.com/repos/robotframework/SeleniumLibrary/issues/475/comments","events_url":"https://api.github.com/repos/robotframework/SeleniumLibrary/issues/475/events","html_url":"https://github.com/robotframework/SeleniumLibrary/issues/475","id":98163343,"number":475,"title":"StaleElementReferenceException with Wait* keywords","user":{"login":"aaltat","id":2665023,"avatar_url":"https://avatars0.githubusercontent.com/u/2665023?v=4","gravatar_id":"","url":"https://api.github.com/users/aaltat","html_url":"https://github.com/aaltat","followers_url":"https://api.github.com/users/aaltat/followers","following_url":"https://api.github.com/users/aaltat/following{/other_user}","gists_url":"https://api.github.com/users/aaltat/gists{/gist_id}","starred_url":"https://api.github.com/users/aaltat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaltat/subscriptions","organizations_url":"https://api.github.com/users/aaltat/orgs","repos_url":"https://api.github.com/users/aaltat/repos","events_url":"https://api.github.com/users/aaltat/events{/privacy}","received_events_url":"https://api.github.com/users/aaltat/received_events","type":"User","site_admin":false},"labels":[{"id":205419975,"url":"https://api.github.com/repos/robotframework/SeleniumLibrary/labels/bug","name":"bug","color":"ee0701","default":true},{"id":679743424,"url":"https://api.github.com/repos/robotframework/SeleniumLibrary/labels/prio-high","name":"prio-high","color":"006d2c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":43,"created_at":"2015-07-30T12:58:18Z","updated_at":"2018-02-01T11:26:10Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"With Chrome 44.0.2403, Chrome driver 2.16 Selenium2Library 1.7.2 and selenium 2.46.1 when I use Wait\\* keywords, the StaleElementReferenceException might occur. Documentation says that keyword should only fail if condition is not met before the timeout, example for Wait Until Page Contains Element keyword, documentation says: Fails if timeout expires before the element appears.\n\nBut if StaleElementReferenceException happens, then I see this: \n\n```\nSelenium2Library.Wait Until Element Is Visible xpath=//span/span[text()=\"${menu_item}\"], timeout=5s, error=Menu item ${menu_item} not found on page!\nDocumentation:  \nWaits until element specified with `locator` is visible.\nStart / End / Elapsed:  20150730 14:24:49.623 / 20150730 14:24:50.240 / 00:00:00.617\n00:00:00.376KEYWORD: common_library_imports.Selenium2library Common Failure\n14:24:49.624    TRACE   Arguments: [ u'xpath=//span/span[text()=\"XXXXXX\"]' | timeout=u'5s' | error=u'Menu item XXXXXX not found on page!' ]   \n14:24:49.624    DEBUG   POST http://127.0.0.1:55614/session/7f76eac90d05725647286d5bdf089b4a/elements {\"using\": \"xpath\", \"sessionId\": \"7f76eac90d05725647286d5bdf089b4a\", \"value\": \"//span/span[text()=\\\"XXXXXX\\\"]\"}   \n14:24:49.829    DEBUG   Finished Request    \n14:24:49.831    DEBUG   GET http://127.0.0.1:55614/session/7f76eac90d05725647286d5bdf089b4a/element/0.4323001531884074-3/displayed {\"sessionId\": \"7f76eac90d05725647286d5bdf089b4a\", \"id\": \"0.4323001531884074-3\"}  \n14:24:49.855    DEBUG   Finished Request    \n14:24:50.239    FAIL    StaleElementReferenceException: Message: stale element reference: element is not attached to the page document\n  (Session info: chrome=44.0.2403.125)\n  (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64)\n14:24:50.239    DEBUG   Traceback (most recent call last):\n  File \"<string>\", line 2, in wait_until_element_is_visible\n  File \"C:\\Python27\\lib\\site-packages\\Selenium2Library\\keywords\\keywordgroup.py\", line 15, in _run_on_failure_decorator\n    return method(*args, **kwargs)\n  File \"C:\\Python27\\lib\\site-packages\\Selenium2Library\\keywords\\_waiting.py\", line 128, in wait_until_element_is_visible\n    self._wait_until_no_error(timeout, check_visibility)\n  File \"C:\\Python27\\lib\\site-packages\\Selenium2Library\\keywords\\_waiting.py\", line 237, in _wait_until_no_error\n    timeout_error = wait_func(*args)\n  File \"C:\\Python27\\lib\\site-packages\\Selenium2Library\\keywords\\_waiting.py\", line 121, in check_visibility\n    visible = self._is_visible(locator)\n  File \"C:\\Python27\\lib\\site-packages\\Selenium2Library\\keywords\\_element.py\", line 723, in _is_visible\n    return element.is_displayed()\n  File \"C:\\Python27\\lib\\site-packages\\selenium\\webdriver\\remote\\webelement.py\", line 323, in is_displayed\n    return self._execute(Command.IS_ELEMENT_DISPLAYED)['value']\n  File \"C:\\Python27\\lib\\site-packages\\selenium\\webdriver\\remote\\webelement.py\", line 402, in _execute\n    return self._parent.execute(command, params)\n  File \"C:\\Python27\\lib\\site-packages\\Selenium2Library\\webdrivermonkeypatches.py\", line 11, in execute\n    result = self._base_execute(driver_command, params)\n  File \"C:\\Python27\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\", line 175, in execute\n    self.error_handler.check_response(response)\n  File \"C:\\Python27\\lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py\", line 166, in check_response\n    raise exception_class(message, screen, stacktrace)  \n14:24:49.621    TRACE   Arguments: [ ${menu_item}=u'XXXXXX' | ${timeout}=u'10' ]\n```\n\nand keyword did fail immediately. But I did expect that keyword would simply re-try search for the element if the StaleElementReferenceException or any other selenium related error happens before the timeout. \n"},"comment":{"url":"https://api.github.com/repos/robotframework/SeleniumLibrary/issues/comments/362237757","html_url":"https://github.com/robotframework/SeleniumLibrary/issues/475#issuecomment-362237757","issue_url":"https://api.github.com/repos/robotframework/SeleniumLibrary/issues/475","id":362237757,"user":{"login":"pekkaklarck","id":114985,"avatar_url":"https://avatars2.githubusercontent.com/u/114985?v=4","gravatar_id":"","url":"https://api.github.com/users/pekkaklarck","html_url":"https://github.com/pekkaklarck","followers_url":"https://api.github.com/users/pekkaklarck/followers","following_url":"https://api.github.com/users/pekkaklarck/following{/other_user}","gists_url":"https://api.github.com/users/pekkaklarck/gists{/gist_id}","starred_url":"https://api.github.com/users/pekkaklarck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pekkaklarck/subscriptions","organizations_url":"https://api.github.com/users/pekkaklarck/orgs","repos_url":"https://api.github.com/users/pekkaklarck/repos","events_url":"https://api.github.com/users/pekkaklarck/events{/privacy}","received_events_url":"https://api.github.com/users/pekkaklarck/received_events","type":"User","site_admin":false},"created_at":"2018-02-01T11:26:10Z","updated_at":"2018-02-01T11:26:10Z","author_association":"OWNER","body":"An obvious benefit of wait keywords handling state element errors like proposed above is that they could be used to workaround stale element problems. As @aaltat commented, handling them \"correctly\" with legacy applications can be really hard."}}
{"actor":{"display_login":"pekkaklarck"}}