Python: how to fill out a form right away with a shard / browser?

I am currently filling out a form on the site as follows:

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

But the form fills out the form sequentially, one after another. Is there a way to fill out the form right away?

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

+5
source share
1 answer

The browser has a method: fill_form(field_values)

It takes a dict parameter with field names and values, and it fills out the form right away.

This way you will use browser.fill_form(dict) instead of browser.fill(field, value)

More information about the API browser and its methods here:

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

+3
source

Source: https://habr.com/ru/post/1267041/


All Articles