Python:如何使用python单击网页中的按钮? [英] Python: how to click a button in a web page using python?

查看:651
本文介绍了Python:如何使用python单击网页中的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以在下面看到控制组的屏幕截图。如何使用python单击此区域?

Below you can see a screen shot of the control group. How can I click this area using python?

推荐答案

要使用python单击此区域,您需要使用Selenium的Python绑定。使用下一个 url来安装它如何使用它的网址。在熟悉上面的urls提供的内容后,创建一个点击按钮的脚本应该不是问题。

To click this area using python you need to get work with Python bindings for Selenium. Use next url to install it and url of how to use it. After getting familiar with content provided by urls above, it shouldn't be a problem to create script which click on button.

安装完selenium之后,点击该按钮与以下代码非常相似:

After installation of selenium your code to click that button would be quite similar to the code below:

from selenium import webdriver

driver = webdriver.Firefox()
# Go to your page url
driver.get('your page url')
# Get button you are going to click by its id ( also you could us find_element_by_css_selector to get element by css selector)
button_element = driver.find_element_by_id('button id')
button_element.click()

这篇关于Python:如何使用python单击网页中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆