Issue using XPath
I'm having an issue. I'm using Selenium and PyCharm.
I'm trying to click() on the "Search" button. I used these:
driver.find_element(By.ID, "search-button-hp-package").click() driver.find_element_by_xpath("//*[@id='search-button-hp-package']").click() driver.find_element_by_xpath("//button[@id='search-button-hp-package']").click()
I'm getting the following error:
selenium.common.exceptions.ElementNotInteractableException: Message: element not intractable
Can someone explain me why the element with the
id='search-button-hp-package'isn't intractable? What I'm doing wrong? Thank you.
Sometimes websites don't do what you might expect with the elements.
In this case you would expect the
buttonelement to be the thing you actually click. But instead it looks to me like the
label, which is the parent element, is the element you want to click.
In short, the
buttonis in fact not intractable. So try the some of the surrounding elements instead, parent in this case:
css selector alternative:
When this happens, you can narrow down what you need to click by looking at what portion of the element you're trying to click is highlighted in dev tools when you look at the surrounding elements.