Python:如何使用splinter/Browser一次填写所有表单? [英] Python: How to fill out form all at once with splinter/Browser?

查看:112
本文介绍了Python:如何使用splinter/Browser一次填写所有表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在网站上填写以下内容:

Currently, I’m filling out the form on a site with the following:

browser.fill(‘form[firstname]’, ‘Mabel’)
browser.fill(‘form[email]’, ‘hi@hi.com’)
browser.select(‘form[color]’, ‘yellow’)

但是表格是一个接一个地依次填写的.有没有办法一次填写所有表格?

But the form gets filled out the form sequentially, one after the other. Is there a way to fill out the form all at once?

谢谢您,一定会投票支持并接受答案!

Thank you and will be sure to vote up and accept the answer!

推荐答案

浏览器具有一种称为:fill_form(field_values)

Browser has a method called: fill_form(field_values)

它需要一个dict参数,其中包含字段名称和值,并立即填写表单.

It takes a dict parameter, with the field names, and the values, and it fills the form at once.

因此,您将使用browser.fill_form(dict)而不是browser.fill(field, value)

So you'll use browser.fill_form(dict) instead of browser.fill(field, value)

有关浏览器的API及其方法的更多信息,请点击此处:

More info about Browser's API and its methods here :

https://splinter.readthedocs.io/en/latest/api/driver-and-element-api.html

这篇关于Python:如何使用splinter/Browser一次填写所有表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆