使用硒时无法单击下拉菜单

时间:2021-01-19 22:04:32

标签: python selenium selenium-webdriver

我使用 selenium 来帮助下载文件。我遇到了无法单击此下拉菜单的问题。我试过搜索 ID 和 xpath,但 python 吐出“没有这样的元素”错误。

XPATH 如下:

//*[@id="ReportViewerCtl_ctl05_ctl04_ctl00_ButtonImg"]

HTML:

<img id="ReportViewerCtl_ctl05_ctl04_ctl00_ButtonImg" src="/Reserved.ReportViewerWebControl.axd?OpType=Resource&amp;Version=11.0.3452.0&amp;Name=Microsoft.Reporting.WebForms.Icons.Export.gif" alt="Export drop down

尝试过:

driver.find_element_by_id("ReportViewerCtl_ctl05_ctl04_ctl00_ButtonImg").click() 
driver.find_element_by_xpath('//*[@id="ReportViewerCtl_ctl05_ctl04_ctl00_ButtonImg"]').click()

在此先感谢大家的帮助!刚开始接触python。

0 个答案:

没有答案
相关问题