简体   繁体   中英

Python Selenium WebDriver Chrome click() is not working

Pls help... I can not click on the element.

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

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.

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']")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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