I am trying to use Selenium through Python to populate a username and password field to allow Twitter authorization. This should be a very simple task, but it continues to give me an error. Here's the HTML username field I want to populate:
<div class="row user ">
<label for="username_or_email" tabindex="-1">Username or email</label>
<input aria-required="true" autocapitalize="off" autocorrect="off" autofocus="autofocus" class="text" id="username_or_email" name="session[username_or_email]" type="text" value="">
</div>
Here's the HTML code for the password field:
<div class="row password ">
<label for="password" tabindex="-1">Password</label>
<input aria-required="true" class="password text" id="password" name="session[password]" type="password" value="">
</div>
Here is my code:
username_field = browser.find_element_by_id("username_or_email")
password_field = browser.find_element_by_id("password")
username_field.send_keys("MyEmail@gmail.com")
password_field.send_keys("SuperSecretPassword")
password_field.send_keys(Keys.ENTER)
Pretty simple? But at the moment when I run the code, it gives an error message when it tries to send_keys at the end of the error:
selenium.common.exceptions.WebDriverException: Message: TypeError - undefined is not a function (evaluating '_getTagName(currWindow).toLowerCase()')
Can someone explain to me what is going on here? Why does he refuse to fill in the fields?
source
share