{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/geckodriver/issues/911","repository_url":"https://api.github.com/repos/mozilla/geckodriver","labels_url":"https://api.github.com/repos/mozilla/geckodriver/issues/911/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/geckodriver/issues/911/comments","events_url":"https://api.github.com/repos/mozilla/geckodriver/issues/911/events","html_url":"https://github.com/mozilla/geckodriver/issues/911","id":254084876,"number":911,"title":"Click is not waiting for subsequent page load","user":{"login":"davehunt","id":122800,"avatar_url":"https://avatars1.githubusercontent.com/u/122800?v=4","gravatar_id":"","url":"https://api.github.com/users/davehunt","html_url":"https://github.com/davehunt","followers_url":"https://api.github.com/users/davehunt/followers","following_url":"https://api.github.com/users/davehunt/following{/other_user}","gists_url":"https://api.github.com/users/davehunt/gists{/gist_id}","starred_url":"https://api.github.com/users/davehunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davehunt/subscriptions","organizations_url":"https://api.github.com/users/davehunt/orgs","repos_url":"https://api.github.com/users/davehunt/repos","events_url":"https://api.github.com/users/davehunt/events{/privacy}","received_events_url":"https://api.github.com/users/davehunt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-08-30T17:56:19Z","updated_at":"2017-09-18T19:10:52Z","closed_at":null,"author_association":"MEMBER","body":"## System\r\n* Version: 0.18.0\r\n* Platform: macOS Sierra 10.12.6\r\n* Firefox: 57.0a1 (2017-08-30) (64-bit)\r\n* Selenium: Python 3.6.2 with selenium 3.5.0\r\n\r\n\r\n## Testcase\r\n\r\n```python\r\nfrom selenium.webdriver import Firefox\r\nfrom selenium.webdriver.firefox.options import Options\r\nfrom selenium.webdriver.support.wait import WebDriverWait\r\n\r\n\r\ndef wait_for_page_to_load():\r\n    WebDriverWait(f, timeout=10).until(\r\n        lambda s: len(f.find_elements_by_css_selector('.job-btn.filter-shown')) >= 1)\r\n\r\n\r\ndef active_repo():\r\n    el = f.find_element_by_css_selector('#watched-repo-navbar button.active')\r\n    print(el.text)\r\n\r\n\r\ndef switch_repo():\r\n    f.find_element_by_id('repoLabel').click()\r\n    f.find_element_by_css_selector('#repo-dropdown a[href*=\"mozilla-central\"]').click()\r\n    wait_for_page_to_load()\r\n    active_repo()\r\n\r\n\r\no = Options()\r\no.log.level = 'trace'\r\no.binary = '/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin'\r\n\r\nf = Firefox(firefox_options=o)\r\nf.get('https://treeherder.allizom.org/')\r\nwait_for_page_to_load()\r\n\r\nactive_repo()\r\nswitch_repo()\r\nf.quit()\r\n```\r\n\r\n## Stacktrace\r\n\r\nSometimes the script will return the unmodified active repository because the page load has not yet happened, and sometimes the page load is in progress and we fail to locate the active repository, as shown in the following trace:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"treeherder-switch-repo.py\", line 32, in <module>\r\n    switch_repo()\r\n  File \"treeherder-switch-repo.py\", line 20, in switch_repo\r\n    active_repo()\r\n  File \"treeherder-switch-repo.py\", line 12, in active_repo\r\n    el = f.find_element_by_css_selector('#watched-repo-navbar button.active')\r\n  File \"/Users/dhunt/.pyenv/versions/geckodriver-tmp/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py\", line 498, in find_element_by_css_selector\r\n    return self.find_element(by=By.CSS_SELECTOR, value=css_selector)\r\n  File \"/Users/dhunt/.pyenv/versions/geckodriver-tmp/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py\", line 832, in find_element\r\n    'value': value})['value']\r\n  File \"/Users/dhunt/.pyenv/versions/geckodriver-tmp/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py\", line 297, in execute\r\n    self.error_handler.check_response(response)\r\n  File \"/Users/dhunt/.pyenv/versions/geckodriver-tmp/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py\", line 194, in check_response\r\n    raise exception_class(message, screen, stacktrace)\r\nselenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: #watched-repo-navbar button.active\r\n```\r\n\r\n\r\n## Trace-level log\r\n\r\n[geckodriver.log.zip](https://github.com/mozilla/geckodriver/files/1264569/geckodriver.log.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/mozilla/geckodriver/issues/comments/330326071","html_url":"https://github.com/mozilla/geckodriver/issues/911#issuecomment-330326071","issue_url":"https://api.github.com/repos/mozilla/geckodriver/issues/911","id":330326071,"user":{"login":"davehunt","id":122800,"avatar_url":"https://avatars1.githubusercontent.com/u/122800?v=4","gravatar_id":"","url":"https://api.github.com/users/davehunt","html_url":"https://github.com/davehunt","followers_url":"https://api.github.com/users/davehunt/followers","following_url":"https://api.github.com/users/davehunt/following{/other_user}","gists_url":"https://api.github.com/users/davehunt/gists{/gist_id}","starred_url":"https://api.github.com/users/davehunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davehunt/subscriptions","organizations_url":"https://api.github.com/users/davehunt/orgs","repos_url":"https://api.github.com/users/davehunt/repos","events_url":"https://api.github.com/users/davehunt/events{/privacy}","received_events_url":"https://api.github.com/users/davehunt/received_events","type":"User","site_admin":false},"created_at":"2017-09-18T19:10:52Z","updated_at":"2017-09-18T19:10:52Z","author_association":"MEMBER","body":"Note that I can still replicate this with geckodriver 0.19.0 and Firefox 57.0a1 (2017-09-18) (64-bit)"}}
{"actor":{"display_login":"davehunt"}}