I'm using Selenium with Python, and I'm trying to complete a login form, I've succeed to complete the username field, but could not complete the password. This is the html:
<div class="loginNotVodafone" style="">
<form id="loginNotVodafone" name="loginNotVodafone" action="https://urlblabla" method="post">
<!-- // GDPR select -->
<fieldset>
<input type="text" id="userFake2" name="userFake2" value="" autocomplete="off" placeholder="Username">
<input type="hidden" id="user" name="UserName" class="hiddenTwo" value="">
</fieldset>
<fieldset>
<input id="password" name="Password" value="" type="password" autocomplete="off" placeholder="Password">
</fieldset>
</form>
</div>
and this is my code:
inputuser = driver.find_element_by_id("userFake2")
inputuser.send_keys('[email protected]')
sleep(1);
password = driver.find_element_by_xpath(".//fieldset[.//input[@id='password']]")
password.click()
sleep(1);
password.send_keys('password')
I always receive the error:
selenium.common.exceptions.ElementNotVisibleException: Message: element not
visible
Traceback:
Traceback (most recent call last):
File "C:\Users\stefa\eclipse-workspace\main.py", line 36, in <module>
password.send_keys('password')
File "C:\Users\stefa\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webelement.py", line 479, in send_keys
'value': keys_to_typing(value)})
File "C:\Users\stefa\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "C:\Users\stefa\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "C:\Users\stefa\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
(Session info: chrome=67.0.3396.99)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)
EDIT: with this commands i can let the cursor blink in the password field:
password = driver.find_element_by_xpath("//*@id='loginNotVodafone']/fieldset[2]").click()
password.send_keys('password')
but got the error message:
password.send_keys('password')
AttributeError: 'NoneType' object has no attribute 'send_keys'