Run using the excellent WebPageTest API wrapper for NodeJS by Marcel Duran, and $WPT_API_KEY as an environment variable.
webpagetest test example.com -k $WPT_API_KEY -l "Dulles_MotoG" -y "custom" -D 100 -U 100 -Y 200 -r "5" -vpt
-k key
-l location and device (Dulles being thinly place with a selection of mobile devices, at the time of writing)
-y network
-D download bandwidth.
-U upload bandwidth
-Y latency
-r runs
-v capture video
-p private (don't include in WPT log)
-t sensitive (discard headers and the script in the result)
Download bandwith is set to 100 and latency to 200 to mimic very harsh consistent but slow connectivity on 2G.
A less harsh version for a 3G connection:
webpagetest test wpt-script.txt -k $WPT_API_KEY -y "3G" -r "5" -vpt
Ditch the location because scripting only works for Chrome (at the time of writing).
setValue fills in the form data, targetted with attribute=value
submitForm submits the form, targetted with attribute=value