简体   繁体   English

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

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

Pls help... I can not click on the element. 请帮助...我无法单击元素。

HTML 的HTML

图片HTML

After expanding 扩大后

图片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)")

the item is searched without errors(did a few ways), but if you add ".click()" on endin in any case, getting an error 搜索该项目没有错误(有几种方法),但是如果在任何情况下在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;">

As per the error message, the above element is getting the click. 根据错误消息,上述元素正在获得点击。 It means the above html layer is above the radio button you are trying to click. 这意味着上面的html层在您要单击的单选按钮上方。

If you have closed it before clicking the radio, may be you need to wait for the invisible. 如果您在单击收音机之前已将其关闭,则可能需要等待看不见的声音。 You are trying to click before the alerts popup disappears. 您试图在警报弹出窗口消失之前单击。

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

Then click your radio button, 然后点击您的单选按钮,

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

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

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