본문 바로가기

Python_Intermediate/Automation

Python - GMAIL Auto Login(지메일 자동 로그인)

반응형

< 선수 작업 >

1. Python - selenium 설치

- cmd -> pip install selenium


2. Google Chromedriver 다운로드 

http://chromedriver.chromium.org/downloads


3. C:\chromedriver 생성 후 다운로드 풀기


< 자동 로그인 코드 >

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome('C:/chromedriver/chromedriver')
driver.implicitly_wait(3)

# gmail.com
driver.get('https://accounts.google.com/ServiceLogin/identifier?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1&flowName=GlifWebSignIn&flowEntry=AddSession')
driver.find_element_by_name('identifier').send_keys('구글계정')
driver.find_element_by_xpath('//*[@id="identifierNext"]/content/span').click()
driver.find_element_by_name('password').send_keys('구글패스워드')
driver.find_element_by_xpath('//*[@id="passwordNext"]').send_keys(Keys.ENTER)


< 실행 화면 >


반응형