Skip to content

Instantly share code, notes, and snippets.

@alaydeliwala
Created March 9, 2021 21:03
Show Gist options
  • Save alaydeliwala/25fec4fd775a9c9798437caa3ce2b0ae to your computer and use it in GitHub Desktop.
Save alaydeliwala/25fec4fd775a9c9798437caa3ce2b0ae to your computer and use it in GitHub Desktop.
An example selenium test that uses a remote webdriver
from selenium import webdriver
desired_cap = {
'browserName': 'chrome',
'name': '[Python] Sample Test',
}
remote_driver_addr = "'http://127.0.0.1:4444/wd/hub'"
driver = webdriver.Remote(
command_executor=remote_driver_addr,
desired_capabilities=desired_cap)
driver.get("https://www.google.com")
if not "Google" in driver.title:
raise Exception("Unable to load google page!")
elem = driver.find_element_by_name("q")
elem.send_keys("Salesforce")
elem.submit()
print(driver.title)
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment