作者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://webptt.com/cn.aspx?n=/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://webptt.com/cn.aspx?n=bbs/Python/M.1507925446.A.338.html
1F:→ s860134: 1. 用已有 cookie 的 profile 10/14 04:36
2F:→ s860134: 2. 点一次 你已经满 18 10/14 04:37
3F:推 sean50301: find_element_by_xpath() or css() 10/14 04:48
4F:→ sean50301: ActionChains(driver).click(element).perform() 10/14 04:49
5F:→ sean50301: 其实我觉得用post就好 10/14 04:50
6F:推 aznchat100: rs.post(url,cookies={'over18': '1'}) 10/14 05:29
7F:推 aznchat100: 看错问题 拍谢 10/14 05:31
8F:→ f496328mm: selenium都可以用click了.......... 10/14 06:49
9F:→ f496328mm: 另外用 post 也不难 10/14 06:49
10F:→ yshihyu: 用 find_element_by_css_selector + click 可以了~感谢 10/14 13:28