Skip to content

Instantly share code, notes, and snippets.

@hjwp
Last active December 26, 2015 21:29
Show Gist options
  • Select an option

  • Save hjwp/7216676 to your computer and use it in GitHub Desktop.

Select an option

Save hjwp/7216676 to your computer and use it in GitHub Desktop.
selenium phantomjs current_url bug minimal repro
from selenium import webdriver
import sys
if 'phantom' in sys.argv:
browser = webdriver.PhantomJS()
else:
browser = webdriver.Firefox()
browser.implicitly_wait(3)
try:
browser.get('http://www.google.com')
start_url = browser.current_url
browser.find_element_by_name('q').send_keys('foo\n')
end_url = browser.current_url
assert end_url != start_url
print 'OK'
finally:
browser.quit()
@hjwp
Copy link
Author

hjwp commented Oct 29, 2013

expected behaviour is that, after the send_keys call which includes a back-n (enter), we trigger a page load, which should complete before we're able to check current_url again...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment