DEV Community

Discussion on: need help with python automation

Collapse
 
franga2000 profile image
Miha Frangež • Edited

For most web forms, full browser automation isn't really needed. Usually, one just needs to figure out how the data is formatted and where it's being sent and just do that. I've seen literally 100x speedups over Selenium this way.

Try opening the browser's network inspector (devTools > Network for Firefox, but Chrome probably has the same), filtering it to only show HTML and XHR and checking "preserve log". Submit the form and look for a POST request. You can then simply re-create it in Python (I recommend the Requests library), fill in your data and send it.

EDIT: If there's a CSRF token, just do a GET on the page and pull it out with a RegEx before each POST.