问题
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:
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
来源:https://stackoverflow.com/questions/43553630/python-how-to-fill-out-form-all-at-once-with-splinter-browser