我一直试图通过Python使用Selenium填写用户名和密码字段,以允许Twitter授权。这应该是一个非常基本的任务,但它总是给我一个错误。下面是我要填写的HTML用户名字段:
<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>
以下是密码字段的HTML:
^{pr2}$我的代码是:
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)
相当简单,对吧?但是,当我运行代码时,当它试图发送错误末尾的\u键时,它会抛出一个错误:
selenium.common.exceptions.WebDriverException: Message: TypeError - undefined is not a function (evaluating '_getTagName(currWindow).toLowerCase()')
有人能给我解释一下这是怎么回事吗?为什么它拒绝填充田地?在
我试图在这里重现这个错误,但是脚本运行得很好
前几天我遇到了一些很奇怪的错误,解决方法是降低webdriver的等级
我在用chromedriver 2.25
html格式:
^{pr2}$相关问题 更多 >
编程相关推荐