This Python script automates the process of filling a web form using Selenium. The script provides two options for the user: filling the form with existing data or generating fake data and then filling the form.
-
Python: Ensure you have Python installed. You can download it from python.org.
-
ChromeDriver: Download the ChromeDriver executable compatible with your Chrome browser version. You can find it here.
-
Dependencies: Install the required Python packages using the following command:
pip install selenium pandas faker
-
Run the Script:
Open a terminal and run the script by executing the following command:
python form_filler.py
-
Choose an Option:
The script will prompt you to choose an option:
- Option 1: Fill the form with existing data from a CSV file.
- Option 2: Generate fake data, fill the form, and save it to a CSV file.
-
Provide Input:
- If you chose Option 1, enter the path to the existing CSV file containing the data.
- If you chose Option 2, provide the number of fake data entries to generate and the column name for comments.
-
Enter Details:
Input the path to the ChromeDriver executable, the URL of the form, and the XPath of the Submit button.
-
Automated Form Filling:
The script will launch a Chrome browser, open the specified form, and fill it with the provided data.
-
Ensure that you have a stable internet connection and that the form elements are accessible using the provided XPath.
-
If the form has additional or different fields, adjust the script accordingly.
-
The script will print the columns of the data frame for your reference.
This project is licensed under the MIT License.