Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Autofill websforms
#1
Video 
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.
Reply
#2
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
metulburr likes this post
Reply
#3
(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
Reply
#4
(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")
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020