1

I am trying to login to this [website][1] using selenium and trying to scrape all the data available. However I am facing issues while logging in to the account. The error reads as:

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

By looking at the stacktrace, I came to know that there's a problem while sending the login email..here is the complete stacktrace.

browser.find_element_by_id('username').send_keys('[email protected]')
  File "F:\technophile\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 477, in send_keys
    self._execute(Command.SEND_KEYS_TO_ELEMENT,
  File "technophile\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "F:\technophile\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "F:\technophile\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=92.0.4515.159)

And here is my code for the same:

websites = ['https://www.spacresearch.com/symbol?s=live-deal&sector=&geography=']
    data = []
    for live_deals in websites:
        browser.get(live_deals)
        #time.sleep(1)

        browser.find_element_by_id('username').send_keys('[email protected]')
        browser.find_element_by_id('password').send_keys('abc@123%$')
        browser.find_element_by_xpath('/html/body/div[1]/div[1]/form/button').send_keys(Keys.ENTER)

        time.sleep(2)
        #rest of the code

I've faced this error a couple of times and I've solved it using webriverWait..however this time, it did not solve the issue so I tried introducing sleep time as well. but that did not work as well. I tried something like this:

        # wait =WebDriverWait(browser, 10)
        # wait.until(EC.visibility_of_element_located((By.ID, 'username')))
        # wait.until(EC.visibility_of_element_located((By.ID, 'password')))

What exactly is the cause of error? Please let me know! Thanks alot for your help in advance. [1]: https://www.spacresearch.com/symbol?s=live-deal&sector=&geography=

2 Answers 2

1

The reason why your code did not work is cause, username, password id's are not unique.

Code :-

websites = ['https://www.spacresearch.com/symbol?s=live-deal&sector=&geography=']
    data = []
    for live_deals in websites:
        browser.maximize_window()
        browser.implicitly_wait(30)
        browser.get(live_deals)
        #time.sleep(1)
        wait = WebDriverWait(browser, 10)

        wait.until(EC.element_to_be_clickable((By.XPATH, "(//input[@id='username'])[2]"))).send_keys("[email protected]")
        wait.until(EC.element_to_be_clickable((By.XPATH, "(//input[@id='password'])[2]"))).send_keys("abc@123%$")
        wait.until(EC.element_to_be_clickable((By.XPATH, "(//button[text()='Next'])[2]"))).click()

        time.sleep(2)
        #rest of the code

Imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
Sign up to request clarification or add additional context in comments.

Comments

0

Instead of * give tag_name driver.find_element(By.XPATH,"//*[@id='search-icon-legacy']").click() becomes driver.find_element(By.XPATH,"//button[@id='search-icon-legacy']").click()

2 Comments

Can you reformat this using code blocks? I can't read it.
Looks like you are suggesting to replace some part of code from question. However, I don't see that part in the question source. Please verify your answer and use this edit guide to format your post.

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.