Created
July 21, 2022 06:16
-
-
Save SarahElson/44dc6fe4b879a233d865fd2656cfd5b2 to your computer and use it in GitHub Desktop.
How To Handle Errors and Exceptions In Selenium Python
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
def test_ecommerceplayground_staleelement(): | |
# LambdaTest Profile username | |
user_name = "<username>" | |
# LambdaTest Profile access_key | |
app_key = "<accesskey>" | |
# Remote Url to connect to our instance of LambdaTest | |
remote_url = "https://" + user_name + ":" + \ | |
app_key + "@hub.lambdatest.com/wd/hub" | |
# creating an instance of Chrome based on the remote url and the desired capabilities | |
ch_driver = webdriver.Remote( | |
command_executor=remote_url, desired_capabilities=ch_capabilities) | |
ch_driver.get( | |
'https://ecommerce-playground.lambdatest.io/index.php?route=account/login') | |
emailElement = ch_driver.find_element(By.ID, "input-email") | |
passwordElement = ch_driver.find_element(By.ID, "input-password") | |
emailElement.send_keys("[email protected]") | |
ch_driver.find_element(By.XPATH, "//input[@type='submit']").click() | |
passwordElement.send_keys("password") | |
ch_driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment