Python & Selenium - unknown error: Element is not clickable at point (663, 469). Other element would receive the click:

后端 未结 3 1768
天涯浪人
天涯浪人 2021-01-28 04:48

I have this Selenium Code that should click on a size selection button.

submit_button = driver.find_element_by_class_name(\'pro_sku\')

elementList = submit_but         


        
相关标签:
3条回答
  • 2021-01-28 05:23

    You can use action_chains to simulate mouse movment

    actions = ActionChains(driver)
    actions.move_to_element(elementList[3]).perform()
    elementList[3].click()
    

    Edit

    The <a> tags are not the actual sizes. Try

    sizes = driver.find_elements_by_class_name('size_defaut')
    sizes[3].click()
    
    0 讨论(0)
  • 2021-01-28 05:38

    Try below:-

    driver.execute_script("arguments[0].click();", elementList[3])
    

    Hope it will help you :)

    0 讨论(0)
  • 2021-01-28 05:42

    You can use Xpath for element selection and then use the following method

       # Click on Element 
       def element_click(self, xpath):
          xpath = re.sub('"', "'", xpath)
          browser.execute_script("""
                                     var elements = document.evaluate("%s",
                                     document,
                                     null,
                                     XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
                                     null);
                                     var im = elements.snapshotItem(0);
                                     im.click();
                                     """ %(xpath)
                                     )
    

    So if your x-path is correct and item is present on DOM then definitely it will get clicked.

    Happy Coding

    0 讨论(0)
提交回复
热议问题