프로필사진

hoim

티스토리 뷰

import selenium
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
import time

# url 및 로그인 정보 
url= '<https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin>'
googl_id = ${아이디}
password = ${패스워드}

service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)

driver.get(url)
driver.implicitly_wait(3)

driver.find_element_by_id('identifierId').send_keys(googl_id);
driver.find_element_by_xpath("//*[@id='identifierNext']/div/button/span").click();
time.sleep(20)

 

WARNING

DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
driver.find_element_by_id("identifierId").send_keys(googl_id);

find_element_by_* 가 아닌 find_element()를 사용해라. 아래와 수정했다.

from selenium.webdriver.common.by import By

#driver.find_element_by_id('identifierId').send_keys(googl_id);
driver.find_element(By.ID, "identifierId").send_keys(googl_id);

#driver.find_element_by_xpath("//*[@id='identifierNext']/div/button/span").click();
driver.find_element(By.XPATH, "//*[@id='identifierNext']/div/button/span").click();

 

 

ISSUE

로그인이 되지 않는다..

 

검색해보면 개발자 분들이 다양한 방법으로 문제를 해결하여 공유하고 있다. 탐지 봇이 디벨롭되고 있으므로, 현재는 통하지 않는 방법도 있어보인다.

이 문제를 해결할 때 참고했던 블로그들..👇

https://velog.io/@binsu/selenium-활용-간-구글-로그인-블록-우회하기

https://dev-guardy.tistory.com/76

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함