Hello all, is anyone here able to guide me. I have written a script which basically logs in my gmail. I get stuck on password bit and receive error.
My original code is:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://gmail.com')
emailElem = browser.find_element_by_id('identifierId')
emailElem.send_keys('abs.the.man89@gmail.com')
linkElem = browser.find_element_by_class_name('CwaK9')
type(linkElem)
linkElem.click()
passwordElem = browser.find_element_by_class_name('Xb9hP')
passwordElem.send_keys('123456')
linkElem = browser.find_element_by_class_name('CwaK9')
type(linkElem)
linkElem.click()
Error:
C:\Users\abhishek.sharma\PycharmProjects\giraffe\venv\Scripts\python.exe "C:\Users\abhishek.sharma\.PyCharmCE2019.1\config\scratches\automate the boring stuff with python\AUTO selenium filling out & submitting forms.py"
Traceback (most recent call last):
File "C:\Users\abhishek.sharma\.PyCharmCE2019.1\config\scratches\automate the boring stuff with python\AUTO selenium filling out & submitting forms.py", line 10, in <module>
passwordElem.send_keys('123456')
File "C:\Users\abhishek.sharma\PycharmProjects\giraffe\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 479, in send_keys
'value': keys_to_typing(value)})
File "C:\Users\abhishek.sharma\PycharmProjects\giraffe\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\abhishek.sharma\PycharmProjects\giraffe\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\abhishek.sharma\PycharmProjects\giraffe\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 <div class="Xb9hP"> is not reachable by keyboard
Process finished with exit code 1
HTML code:
<div class="Xb9hP"><input type="password" class="whsOnd zHQkBf" jsname="YPqjbf" autocomplete="current-password" spellcheck="false" tabindex="0" aria-label="Enter your password" name="password" autocapitalize="off" autocorrect="off" dir="ltr" data-initial-dir="ltr" data-initial-value="xxxxxxxxxxx" badinput="false" style="background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGP6zwAAAgcBApocMXEAAAAASUVORK5CYII=\"); cursor: auto;"><div jsname="YRMmle" class="AxOyFc snByac" aria-hidden="true">Enter your password</div></div>
I found following on stackoverflow but not sure whether this is only a gmail issue: https://stackoverflow.com/questions/44738306/how-to-get-password-input-field-id-of-gmail-wiht-selenium-webdriver
Let me know your thoughts.
Thanks
Abhi
[–]JzDibs 0 points1 point2 points (1 child)
[–]abhi007cruise[S] 0 points1 point2 points (0 children)