Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use selenium to auto login gmail account
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver= webdriver.Firefox()
#driver= webdriver.Chrome("E:\QA\Resource\WEBDRIVER\chromedriverserver\chromedriver.exe")
driver.get("http://mail.google.com")
emailid=driver.find_element_by_id("Email")
emailid.send_keys("username")
passw=driver.find_element_by_id("Passwd")
passw.send_keys("password")
signin=driver.find_element_by_id("signIn")
signin.click()
time.sleep(10)
driver.switch_to_frame('canvas_frame')
sentmail= driver.find_element_by_link_text('Sent Mail')
sentmail.click()
time.sleep(10)
sentmail= driver.find_element_by_link_text('Your Name')
sentmail.click()
lout= driver.find_element_by_link_text('Sign out')
lout.click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.