728x90
๋ฐ์ํ
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pyperclip
import time
uid = '{์์ด๋}'
upw = '{๋น๋ฐ๋ฒํธ}'
driver = webdriver.Chrome('chromedriver.exe')
driver.implicitly_wait(15)
driver.get('https://nid.naver.com/nidlogin.login?mode=form&url=https%3A%2F%2Fwww.naver.com')
pyperclip.copy(uid)
time.sleep(1)
driver.find_element_by_xpath('/html/body/div[1]/div[2]/div/div[1]/form/ul/li/div/div[1]/div[1]/input').send_keys(Keys.CONTROL + 'v')
pyperclip.copy(upw)
time.sleep(1)
driver.find_element_by_xpath('/html/body/div[1]/div[2]/div/div[1]/form/ul/li/div/div[1]/div[2]/input').send_keys(Keys.CONTROL + 'v')
driver.find_element_by_xpath('//*[@id="log.login"]').click()
๋ฐ๋ก ์์ด๋/๋น๋ฐ๋ฒํธ๋ฅผ send_key()๋ก ๋ณด๋ด์ฃผ๋ ๊ฒ์ด ์๋, ํด๋ฆฝ๋ณด๋๋ฅผ ์ด์ฉํด ๋ณต์ฌ ๋ถ์ฌ๋ฃ๊ธฐ๋ก ๊ฐ์ ๋ฃ๊ณ ์ ์ถํด์ฃผ๋ฉด ๋ด์ ๊ฐ์ง ๋ชปํ๋ค.
์ฐธ์กฐ:
์ ๋ ๋์ ์น ํฌ๋กค๋ง ๋ด ํ์ง ์ฐํ 2ํ ๋ค์ด๋ฒ ๋ก๊ทธ์ธ ์บก์ฐจ ํผํ๊ธฐ - ๋ปฅ๋ซ๋ฆฌ๋ ํ์ด์ฌ ์ฝ๋ ๋ชจ์
๋ค์ด๋ฒ์์ ๋ก๊ทธ์ธ์ ์๋ํ๋ฉด ๋ก๋ด์์ ํ์งํ๋ ์บก์ฐจ(captcha) ๊ฐ ๋ฌ๋ค. ๊ฒฐ๋ก ๋ถํฐ ๋งํ์๋ฉด ์ด๋ฅผ ๋จ์ง ์๊ฒํ๊ณ ๋ค์ด๋ฒ์ ์จ์ ํ ๋ก๊ทธ์ธํ๋ ๋ฐฉ๋ฒ์ ์๊ฐํ๋ค.
pythondocs.net
728x90
๋ฐ์ํ
'๐จ๐ผโ๐ป๊ฐ๋ฐ > ์ ๋ ๋์' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์ ๋ ๋์ - ํฌ๋กฌ ๋ชจ๋ฐ์ผ ๋ฏธ๋ฌ๋ง(chrome://inspect) (0) | 2022.04.09 |
---|---|
์ ๋ ๋์ - ์๋๋ก์ด๋ ๋ชจ๋ฐ์ผ ํฌ๋กฌ ์กฐ์ (0) | 2022.04.09 |
์ ๋ ๋์ - C#์์ Selenium ํ๊ฒฝ ์ค์ (0) | 2022.01.25 |
์ ๋ ๋์ - ํ์ผ ์ฌ๋ฌ๊ฐ ํ ๋ฒ์ ์ฌ๋ฆฌ๊ธฐ (0) | 2022.01.17 |
์ ๋ ๋์ - ๋ธ๋ผ์ฐ์ ํ์ฌ url ๊ฐ์ ธ์ค๊ธฐ (0) | 2022.01.15 |