相关文章推荐
深情的脆皮肠  ·  c fwrite fread-掘金·  11 月前    · 
幸福的墨镜  ·  Linux下解决./configure ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Getting Selenium Error - selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

Ask Question

I'm getting this error in Selenium when trying to automate registration on a page and I can't figure out how to interact with this button. I can inspect it, find it's XPATH, click it, but I can't get Selenium to do it. I'm able to interact with everything else in the page so far except for this.

button = driver.find_element(by=By.XPATH, value='//*[@id="mobile-title-bar"]/div/button').click()  # click save button

This is the code I'm using and I've also tried using ActionChains but run into the same problem. I'm assuming because the button is in an overlay (see screenshot) but can't get it for some reason. What am I missing here? Edit: I can't share the website URL, it's a service behind a paywall.

Picture of Page with HTML Elements:

Full Error Text:

 Traceback (most recent call last):
  File "C:\Users\Ryan\PycharmProjects\Albert_new_user\main.py", line 45, in <module>
    button = driver.find_element(by=By.XPATH, value='//*[@id="mobile-title-bar"]/div/button').click()  # click save button
  File "C:\Users\Ryan\PycharmProjects\Albert_new_user\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 89, in click
    self._execute(Command.CLICK_ELEMENT)
  File "C:\Users\Ryan\PycharmProjects\Albert_new_user\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 773, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\Ryan\PycharmProjects\Albert_new_user\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 430, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Ryan\PycharmProjects\Albert_new_user\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=102.0.5005.63)
Stacktrace:
Backtrace:
    Ordinal0 [0x008CD953+2414931]
    Ordinal0 [0x0085F5E1+1963489]
    Ordinal0 [0x0074C580+836992]
    Ordinal0 [0x0077A4F3+1025267]
    Ordinal0 [0x00770293+983699]
    Ordinal0 [0x0079449C+1131676]
    Ordinal0 [0x0076FC74+982132]
    Ordinal0 [0x007946B4+1132212]
    Ordinal0 [0x007A4812+1198098]
    Ordinal0 [0x007942B6+1131190]
    Ordinal0 [0x0076E860+976992]
    Ordinal0 [0x0076F756+980822]
    GetHandleVerifier [0x00B3CC62+2510274]
    GetHandleVerifier [0x00B2F760+2455744]
    GetHandleVerifier [0x0095EABA+551962]
    GetHandleVerifier [0x0095D916+547446]
    Ordinal0 [0x00865F3B+1990459]
    Ordinal0 [0x0086A898+2009240]
    Ordinal0 [0x0086A985+2009477]
    Ordinal0 [0x00873AD1+2046673]
    BaseThreadInitThunk [0x76B2FA29+25]
    RtlGetAppContainerNamedObjectPath [0x76F57A7E+286]
    RtlGetAppCo

ntainerNamedObjectPath [0x76F57A4E+238]

i dont see any frame in DOM but still try doing switch to driver.switch_to.frame(0) i am one of these should work – Sonali Das Jun 9, 2022 at 23:19 always put full error message (starting at word "Traceback") in question (not in comments) as text (not screenshot, not link to external portal). There are other useful information. – furas Jun 9, 2022 at 23:54 @furas, added the error in the body of the question, thanks for the tip. I can't link to the page because it's a paid service with a login. That's why I posted a ss of the HTML to see if I was missing anything obvious. Thanks for the help! – TheGoatLord Jun 10, 2022 at 2:34

Answer that worked from @furas in the comments

I'm not sure but button is without which normally define where to send request after pressing button - and it can make it unclicable. OR maybe it use some JavaScript code to block access when it detect Selenium. You may try to use JavaScript to click it. Soemthing like

driver.execute_script("arguments[0].click()", button)

-furas

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.