Selenium generating error "Element is not interactable"

In the HTML, I see the btn-primary is present in a bootstrap modal popup. So there may another btn-primary behind the modal pop. The XPath will be finding the element which is behind the modal which is not interactable.

btn-primary class is a generic class in bootstrap that will be used in all primary buttons. Try with unique locator with reference to modal element as a parent in your locator

download_button_path = "//[@class='lmn-edititem-modal']/../[@class=''btn-primary']"
wait = WebDriverWait(driver, 10)
download_button = wait.until(EC.visibility_of_element_located((By.XPATH, download_button_path)))
download_button .click()

We can also try this with CSS selector

driver.find_elements_by_css_selector(".lmn-edititem-modal .btn-primary") 

Have you tried hovering over the button and then clicking?

try the following:

button_to_click = driver.find_element_by_xpath('button_to_click's xpath')
hover = ActionChains(driver).move_to_element(button_to_click)
hover.perform()
button_to_click.click()

Hope this helps.


For me, extending relative Xpath just with its parent helped.

button = driver.find_element_by_xpath("//button[@data-value='0']")
button.click()
#this did not work

button = driver.find_element_by_xpath("//section[2]/button[@data-value='0']")
button.click()
#this worked well