我对Selenium比较陌生,我正在从事Web浏览器自动化项目,其中一项措施是从下拉菜单中选择一个元素,请在html代码下方找到。
<span id="export_menu" class="ui-button drop-down export-menu" tabindex="0" role="application">
<span class="menu_text">Export</span>
<span class="drop-down-menu ui-icon ui-icon-triangle-1-s"></span>
<ul class="export-actions"><li><header>Export Report</header>
<ul><li class="menu-action"><input type="button" value="CSV" class="button ui-button ui-widget ui-state-default ui-corner-all" id="export_csv" data-format="csv" role="button" aria-disabled="false"></li></ul>
<ul><li class="menu-action"><input type="button" value="PDF" class="button ui-button ui-widget ui-state-default ui-corner-all" id="export_pdf" data-format="pdf" role="button" aria-disabled="false"></li></ul>
<ul><li class="menu-action"><input type="button" value="Schedule Export" class="button ui-button ui-widget ui-state-default ui-corner-all" id="schedule" role="button" aria-disabled="false"></li></ul></li></ul>
</ul>
</span>
我尝试在Python上执行以下操作,该错误如下所示
driver.find_element_by_id("export_menu").click()
driver.find_element_by_id("export_csv").click()
selenium.common.exceptions.ElementNotInteractableException:消息:元素无法滚动到视图中
经过一些研究,我也尝试遵循,只是超时
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="export_csv"]'))).click()
请求帮助!