Skip to content

Instantly share code, notes, and snippets.

@seleniumgists
Created March 1, 2018 05:18
Show Gist options
  • Save seleniumgists/5c8f352ae2b349afc11c003253615023 to your computer and use it in GitHub Desktop.
Save seleniumgists/5c8f352ae2b349afc11c003253615023 to your computer and use it in GitHub Desktop.
generated automatically from #selenium on seleniumhq slack
import time
from selenium import webdriver
user = "<mailto:[email protected]|[email protected]>"
pwd = "abc"
driverpath="C:/cromedriver/chromedriver.exe"
driver = webdriver.Chrome(driverpath)
driver.get("<https://www.domain.com>")
print("URL Found")
variable = "<https://www.domain.com/user>"
driver.find_element_by_xpath('//a[@href="'+variable+'"]').click()
print("Login Page Found")
elem = driver.find_element_by_id("loginEmail")
elem.send_keys(user)
elem = driver.find_element_by_id("loginPassword")
elem.send_keys(pwd)
driver.find_element_by_id("user_login").click()
print("Login Successfull")
time.sleep(3)
driver.find_element_by_class_name("logout").click()
print("Logout SuccessFull")
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment