'Python & Selenium: ElementClickInterceptedException: Message: element click intercepted error
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.
Solution 1:[1]
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)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
