0

I'm using Splinter to automate a basic order form in Python.

browser.fill_form({
    'formorder[billing_name]': 'Georges Perec',
    'order[email]': 'g.perec@oulip.fr',
    'order[tel]': '+ 33 (0)1 53 79 39 46',
    'order[billing_address]': 'La place Saint-Sulpice',
    'order[billing_city]': 'Paris',
    'order[billing_zip]': '75006',
    'order[billing_country]': 'FR'
    })

One poster in this thread recommended using browser.fill_form(dict) to fill out a form at once, but I'm still seeing the field values get filled in one-by-one. Am I doing something wrong, or does Splinter not support this function? If the latter, how could I achieve this functionality?

solo
  • 743
  • 2
  • 6
  • 17
  • I don't believe the underlying WebDriver supports this feature. "Splinter" is most likely still calling `SendKeys()` on each element under-the-hood. – Null511 Dec 11 '17 at 01:43
  • @Null511. Perhaps I could use Javascript to inject code instead? – solo Dec 11 '17 at 05:09
  • Yes, you could. This should be significantly faster, but will probably get very messy. I believe it is also possible to inject javascript methods into the page, which might allow you to use JSON to transfer/serialize your form data. – Null511 Dec 11 '17 at 19:07
  • @Null511 So would you recommend I use PhantomJS for my web driver, or would it be possible to achieve the same functionality without it? – solo Dec 11 '17 at 21:00
  • It won't really matter what WebDriver you use in this scenario. Selenium exposes a common interface for all WebDriver functionality, so you will simply be executing Javascript strings. – Null511 Dec 11 '17 at 23:39
  • 2
    PhantomJs is particularly useful when you are running headless (in Session #0, no visible UI). Chrome just released an update that supports this same behavior though, which [PhantomJs] has deemed the superior option. – Null511 Dec 11 '17 at 23:40
  • @Null511 Got it. Thanks for your help! – solo Dec 11 '17 at 23:44

0 Answers0