Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyautogui
- import time
- import csv
- # Read in the data from the csv file.
- with open('C:\\Users\\Al\\Desktop\\colors.csv') as colorsFile:
- csvReader = csv.reader(colorsFile)
- colorsList = list(csvReader)
- # Give the user a few seconds to set up the browser.
- print('The program starts in 5 seconds. Make sure the form is loaded and the browser window is maximized.')
- time.sleep(5)
- for row in colorsList:
- name = row[0]
- color = row[1]
- # Click on the "Name" field.
- pyautogui.click(888, 658) # NOTE: These XY coordinates will be different on your computer.
- # Type the "Name" info.
- pyautogui.write(name)
- # Click on "Color" field.
- pyautogui.click(886, 841)
- # Type the "Color" info.
- pyautogui.write(color)
- break # Comment this line out when you've finished the dry run.
- # Click the submit button.
- pyautogui.click(907, 992)
- # Wait for the form to submit.
- time.sleep(3)
- # Click on "submit another response"
- pyautogui.click(887, 612)
- # Wait for the page to load.
- time.sleep(3)
- print('Info entered: ' + name + ' ' + color)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement