1

I use Selenium in Python for scraping.

The following error is displayed when I try to click button tag.

ElementClickInterceptedException: Message: element click intercepted: Element <button id="pos-list" class="menu-btn-normal">...</button> is not clickable at point

HTML

<div id="order-bar"> <div id="order-bar-menu"> <button id="order-list" class="menu-btn-select">orderlist</button> <button id="pos-list" class="menu-btn-normal">positionlist</button> ... 

Python

pos = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="pos-list"]'))) print(pos.text) pos.click() 

print(pos.text) is printed as positionlist I expected.

How can I click this button element?

It would be appreciated if you could give me some hint.

    1 Answer 1

    2

    Try:

    pos = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, '//*[text()="positionlist"]'))) pos.click() 

    OR

    pos = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, '//*[@id="order-bar"]/div/button'))) pos[1].click() 

    OR js execute and click()

    pos = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="pos-list"]'))) driver.execute_script("arguments[0].click();", pos) 
    3
    • Same error message was displayed though I tried both suggestion. Thank you for your answer.CommentedMay 15, 2022 at 2:11
    • @ SamuraiBlue, I've updatedCommentedMay 15, 2022 at 2:17
    • 1
      I tried js execute and click() and it worked!! Thank you for your update!!CommentedMay 15, 2022 at 5:08

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.