Issue
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
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)
Answered By - F.Hoque
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.