python - Splinter 在 PayPal 中不起作用

标签 python paypal fill splinter

我想在 Python 中使用 Splinter 直接输入电子邮件和密码。问题是它出现了这条消息:

AttributeError: 'ElementList' object has no attribute 'fill'

我做的代码如下:

browser.find_by_id('email').first.find_by_tag('input').fill('test@gmail.com')
browser.find_by_id('password').first.find_by_tag('input').fill('mypassword')

'login_email' 是文本框的名称,它是电子邮件类型。与密码相同。 ¿为什么这不起作用的任何帮助?

更新:我尝试了 narzero 的代码,但现在它说它没有找到元素:splinter.exceptions.ElementDoesNotExist:找不到 ID 为“email”的元素。

最佳答案

经过一些研究,似乎有人遇到了与您相同的问题。 find_by_name 返回一个 ElementList,因此您必须选择这些 Element 之一。为此,您可以使用 ElementList 的第一种方法。

这是从 this post 中提取的一些工作代码

# Find the username form and fill it with the defined username
browser2.find_by_id('gebruikersnaam').first.find_by_tag('input').fill(username2)

# Find the password form and fill it with the defined password
browser2.find_by_id('wachtwoord').first.find_by_tag('input').fill(password2)

# Find the submit button and click
browser2.find_by_css('.submit').first.click()

感谢 narzero 提供此代码。

找到适合您需求的方式

关于python - Splinter 在 PayPal 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33870214/

相关文章:

python - 一种在特定索引的空列表中插入值的方法

php - Paypal 开发者账号

encryption - HTTP 发布 : getting encrypted Paypal multiple-item cart upload button

c++ - 使用引用指针中的信息填充 vector

ios - 如何填充静态 UITableView

python - Flask 应用程序不会从 'ImportError: cannot import name ' ' 启动 'werkzeug' cached_property'

python - 如何覆盖 django rest 框架 ModelViewSet 中的更新操作?

c# - 在 C# ASP.net 中生成 PayPal 按钮的 POST 请求

javascript - 从 lodash fill 与常规数组填充数组时出现不良结果

python - 在类中存储集合信息