作者yshihyu (yshihyu)
看板Python
標題[問題] selenium 如何告訴PTT我已滿18
時間Sat Oct 14 04:10:41 2017
如何告訴PTT我已滿18並順利抓取八卦版的文章 ?
PttName=""
load={
'from':'/bbs/'+PttName+'/index.html',
'yes':'yes'
}
rs=requests.session()
res=rs.post('
https://www.ptt.cc/ask/over18',verify=False,data=load)
https://www.youtube.com/watch?v=G5MDpnGsE-k
那如果用 selenium 登入八卦版怎麼告知ptt滿18歲?
下面網址是我程式碼跟跑出來結果
https://gist.github.com/anonymous/e1c4f9184af9d6121d86233d86a4cac8
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.182.108.87
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1507925446.A.338.html
→ s860134: 1. 用已有 cookie 的 profile 10/14 04:36
→ s860134: 2. 點一次 你已經滿 18 10/14 04:37
推 sean50301: find_element_by_xpath() or css() 10/14 04:48
→ sean50301: ActionChains(driver).click(element).perform() 10/14 04:49
→ sean50301: 其實我覺得用post就好 10/14 04:50
推 aznchat100: rs.post(url,cookies={'over18': '1'}) 10/14 05:29
推 aznchat100: 看錯問題 拍謝 10/14 05:31
→ f496328mm: selenium都可以用click了.......... 10/14 06:49
→ f496328mm: 另外用 post 也不難 10/14 06:49
→ yshihyu: 用 find_element_by_css_selector + click 可以了~感謝 10/14 13:28