Created
March 9, 2021 21:03
-
-
Save alaydeliwala/25fec4fd775a9c9798437caa3ce2b0ae to your computer and use it in GitHub Desktop.
An example selenium test that uses a remote webdriver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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