使用python自动进行网络浏览 [英] automate web browsing using python
本文介绍了使用python自动进行网络浏览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
from selenium import webdriver
chromedriver = 'C:\\chromedriver.exe'
browser = webdriver.Chrome(chromedriver)
browser.get('http://www.example.com')
然后,如何单击第三个下载按钮?
Then, how can I click on the third Download button?
推荐答案
您可以使用xpath表达式获取带有下载"值的所有输入,然后单击第三个:
You can use a xpath expresion to get all inputs with a "Download" value, and click the third:
browser.find_elements_by_xpath('//input[@value="Download"]')[2].click()
这篇关于使用python自动进行网络浏览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文