python3 selenium3 如何点击页面中的按钮,像百度文库中的继续浏览按钮。

 我来答
从空去听8
2017-09-11 · TA获得超过7438个赞
知道大有可为答主
回答量:6907
采纳率:93%
帮助的人:5458万
展开全部
先在命令行中下载一个selenium库:

1

python -m pip install selenium

然后使用selenium中的webdriver来进行模拟网页点击:

1
2
3
4
5
6
7
8
9

from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait

sel=webdriver.Chrome() #也可换成Ie(),Firefox()等
element=sel.find_element() #在网页源码中查找元素
element.click() #模拟对元素进行点击

如果你是Chrome用户,需要手动下载一个chromedriver.exe,这里附上,把它放入系统Path路径任意一个文件夹中即可
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式