Skip to content

Instantly share code, notes, and snippets.

@sri85
Created October 11, 2016 13:54
Show Gist options
  • Select an option

  • Save sri85/e69bd55b6d981c23d1043431c2bab821 to your computer and use it in GitHub Desktop.

Select an option

Save sri85/e69bd55b6d981c23d1043431c2bab821 to your computer and use it in GitHub Desktop.
Minimal Tc for geckodriver
rom selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
# Tell the Python bindings to use Marionette.
# This will not be necessary in the future,
# when Selenium will auto-detect what remote end
# it is talking to.
driver = webdriver.Remote(
command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities={'browserName': 'firefox',
'marionette': True
})
# driver = webdriver.Firefox(capabilities=caps)
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("x")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment