¾È³çÇϼ¼¿ä
ÆÄÀ̽ãÀ¸·Î ³×À̹ö ·Î±×ÀÎ ±â´É ±¸ÇöÁß¿¡
ÄíÅ° ÆÄÀÏÀ» ¸¸µé¾î¼ ÄíÅ° ÆÄÀÏÀÌ Á¸ÀçÇϸé, ·Î±×ÀÎ ¾øÀÌ ¹Ù·Î ·Î±×ÀÎ µÈ âÀ» ¶ç¿ìµµ·Ï ÀǵµÇÏ°í
±¸ÇöÀ» Çغ¸¾Ò´Âµ¥.. ¾Æ¹«¸® ÇغÁµµ °è¼Ó ·Î±×ÀÎ ÀÛ¾÷À» ÇÏÁö ·Î±×ÀΠâÀ¸·Î ¹Ù·Î °Ç³Ê¶Ù´Â°Ç ¾ÈµÇ¾î¼..
Áú¹®À» ¿Ã·Áº¾´Ï´Ù. (ÀÌÀü¿¡ ¿Ã¸° ±Û¿¡¼ °Ô½ÃÇÏ´Ï ÄÚµå °¡µ¶¼ºÀÌ ¾û¸ÁÁøâÀ¸·Î º¯Çعö·Á¼ »õ·Î ¿Ã¸³´Ï´Ù..;;)
# Å©·Òµå¶óÀ̹ö ºÒ·¯¿Í¼ ³×À̹ö ·Î±×ÀÎ URL »ðÀÔ
driver = webdriver.Chrome('C:\chromedriver.exe')
driver.get('https://nid.naver.com/nidlogin.login')
# ÆÄÀÏ Á¸ÀçÇÏ´ÂÁö üũ À§Çؼ try catch¹®, Á¸ÀçÇϸé ÄíÅ° »ðÀÔ
try:
f = open('Cookies\cookie1-2.dat', 'rb')
cookies = pickle.load(f)
f.close()
for c in cookies:
driver.add_cookie(c)
driver.get('https://nid.naver.com/nidlogin.login')
# ÆÄÀÏ Á¸Àç ¾ÈÇÏ¸é ±âÁ¸ ¹æ¹ý´ë·Î ·Î±×ÀÎÇÏ°í, °æ·Î¿¡ Æú´õ°¡ ¾øÀ¸¸é Æú´õ »ý¼ºÇØÁÖ°í ±× ¾È¿¡ ÄíÅ°ÆÄÀÏ »ý¼º
except:
driver.execute_script("document.getElementsByName('id')[0].value=\'" + naverid + "\'")
driver.execute_script("document.getElementsByName('pw')[0].value=\'" + naverpw + "\'")
driver.find_element_by_xpath('//*[@id="frmNIDLogin"]/fieldset/input').click()
try:
if not os.path.exists('Cookies'):
os.makedirs('Cookies')
c = driver.get_cookies()
with open("Cookies\cookie1-2.dat", 'wb') as f:
pickle.dump(c, f)
except:
c = driver.get_cookies()
with open("Cookies\cookie1-2.dat", 'wb') as f:
pickle.dump(c, f) |