我无法从网站的下拉菜单中选择复选框。下拉列表位于iframe中,当我尝试切换到iframe时,我会不断收到TimeoutException
消息:
下面是我正在尝试的代码和HTML。我是Python新手,因此在此方面的任何帮助都将不胜感激
Python:
wait = WebDriverWait(driver, 20)
frm1= wait.until(EC.presence_of_element_located((By.ID, "ReportViewerControl_ctl04_ctl03_ctl01")))
driver.switch_to.frame(frm1)
HTML:
<iframe id="ReportViewerControl_ctl04_ctl03_ctl01" onclick="event.cancelBubble=true;" onactivate="event.cancelBubble=true;" style="display: block; position: absolute; z-index: 10; left: 208px; top: 35px; width: 198px; height: 166px;" src="javascript:'';" frameborder="0" title="Area place holder" longdesc="Area place holder" name="ReportViewerControl_ctl04_ctl03_ctl01"></iframe>
要在
<iframe>
而不是presence_of_element_located()
内切换Selenium的焦点,您必须:使用
CSS_SELECTOR
:使用
XPATH
:注意:您必须添加以下导入:
参考文献
您可以在以下内容中找到一些相关讨论:
相关问题 更多 >
编程相关推荐