【发布时间】:2021-06-19 06:37:24
【问题描述】:
我已经开始使用 Selenium 在 Python 中创建一个脚本,以在 Fidelity.com 上抓取我的帐户 我可以登录并点击网页上的一些按钮,但是下面的按钮代码有问题。
下载 = driver.find_element_by_xpath("//button[@id='posweb-share-button']") 下载.click()
这里是html:
<button id="posweb-share-button" class="posweb-share-button pvd-btn btn-anchor posweb-metrics" type="button" aria-label="Download and Print Positions data" data-metrics="shareIcon" aria-describedby="posweb-share-popover"><pvd-icon icon="share" label="Download and Print" aria-hidden="true"></pvd-icon></button>
登录代码工作找到,我要使用代码点击网页上的其他按钮,但上面的代码没有任何反应,我得到“进程完成,退出代码0”。
【问题讨论】:
-
你为什么把“下载”放在定位器之后,点击之前?
-
下载只是我使用的一个变量。
标签: python selenium web-scraping