1

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:

enter image description here

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]

7
  • try doing driver.switch_to.default_content() before clicking Save button Commented Jun 9, 2022 at 23:17
  • 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 Commented 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. Commented Jun 9, 2022 at 23:54
  • you could add url for this page so we could test it. Commented Jun 9, 2022 at 23:55
  • @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! Commented Jun 10, 2022 at 2:34

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

Use this Xpath to click SAVE button

//button[contains(text(),'SAVE')]

2 Comments

Unfortunately, that didn't work either. Same error message
pls share web site url here to check more

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.