Step 1. Check if you have Java installed
- First, make sure that you have setup TagUI-Pypthon on your Mac, as outlined in the article: Setup TagUI-Python on Mac.
- TagUI visual automation requires Java libraries. Let's do a check to see if you have Java installed on your machine. In the Terminal window, type the following command:
- If you see the screen below, then you have Java installed on your machine. Please proceed to Step 3. Setup TagUI - Visual Automation.
java -version
Step 2. Install JDK
- Install Homebrew on your Mac if you haven’t.
- Run the following command. This is to add more repositories to brew.
- Install the OpenJDK 8 with the following command:
- Now re-run java -version to see if you get the following:
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
3. Setup TagUI with Visual Automation
- Start python3 in a Terminal. Once you are in Python, type the following:
- If everything runs ok, you will see a True displayed as shown below.
- If this is the first time you run visual automation, most likely you will see the following warning message. This is ok, as long as you see True displayed. If not, press
Ctrl
+D
to exit the Python Interpreter and repeat Step 8. - When you start to run Visual Automation codes, you might also see the following warning message.
import tagui as t t.init(visual_automation = True, chrome_browser = False)
Click the Open System Preferences
button. You will see the following:
Click the Click the lock to make changes
icon at the bottom left. Once you have keyed in your password, the items on the right will be unlocked as follows. Make sure you check the one for Java.
You can click that lock again to prevent further changes.
4. Test TagUI with Visual Automation
- Copy the following 4 lines and paste them direct into the Python interpreter:
- If everything runs ok, the bot will press
Cmd
+Space
, launch Safari and enter the text google weather singapore. You should get the results similar to the web page below:
t.keyboard('[cmd][space]') t.keyboard('safari[enter]') t.keyboard('[cmd]t') t.keyboard('google weather singapore[enter]')
Note: Copy and paste ALL the 4 lines together, and not one by one. This is because right after the Cmd
+Space
is pressed, you want the bot to enter safari direct into the search field.
If you copy one by one, you will see safari entered in your Python window, which is not what you want. Your command prompt should look like this:
Congratulations! You have successfully setup Visual Automation in TagUI!
Add comment