Python: How to fill out form all at once with spli

2020-07-11 08:08发布

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!

1条回答
疯言疯语
2楼-- · 2020-07-11 08:24

Browser has a method called: fill_form(field_values)

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

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

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

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

查看更多
登录 后发表回答