[问题] selenium 如何告诉PTT我已满18

楼主: yshihyu (yshihyu)   2017-10-14 04:10:41
如何告诉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
谢谢
作者: s860134 (s860134)   2017-10-14 04:36:00
1. 用已有 cookie 的 profile2. 点一次 你已经满 18
作者: sean50301 ( (づ′・ω・)づ)   2017-10-14 04:48:00
find_element_by_xpath() or css()ActionChains(driver).click(element).perform()其实我觉得用post就好
作者: aznchat100 (aznchat100)   2017-10-14 05:29:00
rs.post(url,cookies={'over18': '1'})看错问题 拍谢
作者: f496328mm (为什么会流泪)   2017-10-14 06:49:00
selenium都可以用click了..........另外用 post 也不难
楼主: yshihyu (yshihyu)   2017-10-14 13:28:00
用 find_element_by_css_selector + click 可以了~感谢

Links booklink

Contact Us: admin [ a t ] ucptt.com