Python Forum

Full Version: Autofill websforms
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi members,

Was wondering if one can advise how to go about automating filling in webforms that exist on different websites, with all different fields? Similar to how Chrome and Edge operates where it remembers the fields. How to do that in Python considering the XPath, Names, Classes to the site may all be different from the next?

Hope for some help.

Thanks.
selenium is good for this (also used for web scraping).
see tutorials on this forum for how to use. (selenium mainly in part 2)

web scraping part 1
web scraping part 2
(Oct-25-2020, 01:53 AM)Larz60+ Wrote: [ -> ]selenium is good for this (also used for web scraping).
see tutorials on this forum for how to use. (selenium mainly in part 2)

web scraping part 1
web scraping part 2

Thanks, Larz, this has really helped. I have had a quick look for now and know this is going to be very useful. Though, if you could kindly clear this up while it's all fresh on our minds.

How do you identify/detect the Elements for the fields/columns/buttons/login_Prompts/etc that are different on each site, considering they may be slighty named different - i.e lastname/surname, create_account/sign-up, login/sign-in
(Oct-25-2020, 03:40 AM)JudgeDredd Wrote: [ -> ]How do you identify/detect the Elements for the fields/columns/buttons/login_Prompts/etc that are different on each site, considering they may be slighty named different - i.e lastname/surname, create_account/sign-up, login/sign-in
Both in Chrome and FireFox can copy CSS selector or XPath.
Right click inspect,the choose a tag and right click copy, Selector or XPath.
Sometime do i use ChroPath.

Can also if send code(browser.page_source) to BS,then can parse using method that BS has.
Here a example of this.
So can now use a BS method.
use_bs4 = soup.find('div', class_="col col-7-12")