繁体   English   中英

Python Selenium WebDriver Chrome click()无法正常工作

[英]Python Selenium WebDriver Chrome click() is not working

请帮助...我无法单击元素。

的HTML

图片HTML

扩大后

图片HTML2

My code
    clcik_on_privkey = driver.find_element_by_class_name("radio")
    Clcik_on_privkey = driver.find_element_by_name("331")
    clcik_on_privkey = driver.find_element_by_xpath("//input[@name='331']")
    clcik_on_privkey = driver.find_element_by_xpath("//label[10]")
    clcik_on_privkey = driver.find_element_by_css_selector(".radio:nth-child(11)")

搜索该项目没有错误(有几种方法),但是如果在任何情况下在endin上添加“ .click()”,都会出现错误

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <label aria-flowto="aria8" class="radio">...</label> is not clickable at point (286, 562). Other element would receive the click: <div class="alert popup alert-info animated-show-hide" style="bottom: 0px; z-index: 999;">...</div>
  (Session info: chrome=70.0.3538.77)
  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 6.1.7600 x86_64)
  <div class="alert popup alert-info animated-show-hide" style="bottom: 0px; z-index: 999;">

根据错误消息,上述元素正在获得点击。 这意味着上面的html层在您要单击的单选按钮上方。

如果您在单击收音机之前已将其关闭,则可能需要等待看不见的声音。 您试图在警报弹出窗口消失之前单击。

WebDriverWait(driver, 60).until(
        EC.invisibility_of_element_located((By.CSS_SELECTOR, 'div.alert.alert-info'))

然后点击您的单选按钮,

driver.find_element_by_xpath("//input[@name='331']")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM