Pyautogui

Using pyautogui to automate your daily work or play a video game for you.

Copy the code below into a text file and run it in your Python IDE. You may need to install the three libraries first

pip install webbrowser

pip install time

pip install pyautogui

import webbrowser
import time
import pyautogui

webbrowser.open(‘www.youtube.com’)
print(‘waiting for 6 seconds for youtube to open’)
time.sleep(6)

print(‘clicked search bar’)
step1 = pyautogui.locateOnScreen(“search bar.png”)
pyautogui.click(step1)

print(‘typing’)
pyautogui.typewrite(‘afterowl python’)
time.sleep(3)

print(‘clicking on search button’)
step2 = pyautogui.locateCenterOnScreen(“search button.png”)
pyautogui.click(step2)
time.sleep(3)

print(‘clicking on Python Graph image’)
step3 = pyautogui.locateCenterOnScreen(“python graph.png”)
pyautogui.click(step3)

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s