Created
March 1, 2018 05:18
-
-
Save seleniumgists/5c8f352ae2b349afc11c003253615023 to your computer and use it in GitHub Desktop.
generated automatically from #selenium on seleniumhq slack
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
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