Overview
In this blog, we will see what is the use of TagUI tool and how to use it.
Nowadays web automation is possible through many tools. Some examples are here, Ketalon studio, Selenium, SoapUI etc. Similarly, TagUI is a tool for web automation.
Benefits of automation using TagUI
- Easy to install
- Various automation ( OCR optical character recognition, visual automation, keyboard automation, mouse automation, web automation )
- Cross-platform – available in windows, macOS, Linux
- Open Source
- Works in background ( if visual automation is off )
- Does not require more coding knowledge
Installation
Let’s get started with the installation steps:
You need to have the following things installed in your system:
Use following command to install TagUI (install-tagui) :
pip3/pip install tagui
Now let’s see how to use this thing :
Open your text editor and start writing some code by importing the TagUI library. Here is the sample code.
This code will open the Chrome browser and search for google.com, it will search “yudiz blog” text. Then it will take a screenshot of the search result.
import tagui as r r.init() r.url('https://www.google.com') r.type('//*[@name="q"]', 'yudiz blog[enter]') print(r.read('result-stats')) r.snap('page', 'results.png') r.close()
- Just copy these few lines of code.
- Paste into your text editor and save it my-code.py
- Now run it by saved name like this: python/python3 my-code.py
Note: if you are running this task for the first time, it will take around 10 minutes to unzip the package and collect some details from the internet.
Once everything is fine. It will open a new Google Chrome tab ( separate from your installed chrome ).
It will search for whatever you wrote in the script and it will take a screenshot of that.
You need to learn some common functions of TagUI.
Where less coding is required.
Here is the link where you can learn the new functions of TagUI.
Whatsapp web automation
Using this tool I wrote a script that can track a particular person on WhatsApp
online/offline/last seen ( every five seconds lap ) and store logs.
Cheers! ?
Wait and run this code into your system. _phone_number_Log.txt file will appear on the same path where your script file is saved.
The code I wrote is here! Do not forget to change the phone number.
Note: scan your device to web WhatsApp ( Required ) and Phone number must be saved in your phonebook.
Do not change the tab where the chrome browser is doing automation just minimise that window.
from os import read import tagui as t from datetime import datetime #main code will start from here t.init() t.url('https://web.whatsapp.com/') while not t.present("//*[@class='_1lPgH']"): t.wait() t.wait() phone_num = "82XXXXXXXX" t.click("//*[@class='_1Jn3C']") t.wait(3) t.type("//*[@role='textbox']",phone_num) t.wait(3) t.click("(//span[@data-icon='default-user'])[2]") t.wait(3) file_name = "_" + phone_num + "_last_seen.txt" Counter = 0 while Counter < 1 : t.wait(2) time_now = datetime.now() user_status = "offline" if t.exist("//*[@class='zzgSd _3e6xi']"): user_status = t.read("//*[@class='zzgSd _3e6xi']") #t.snap('page', str(Counter)+file_name ) #Counter = Counter + 1 // enable this and it will save screenshots of whatsapp profile with open( file_name, 'a' ) as f: if f.tell() == 0: f.write("Logs of whatsapp number: " + phone_num + "\n") else: f.write( str( time_now ) + "->"+ str( user_status ) + "\n") f.close() t.close()
A log file will look like this
Where to use it?
- Track a product price online and grab the deal before it goes out of stock. (online bot)
- Game bot if the task is repetitive. Reach an unlimited score! (game hack)
- Feel a form of from excel file ( data entry )
Warning: do not use this tool illegally.
It is a tool for exploration, to learn something new and earning money.
Conclusion
I think it is a great tool to explore. I had an idea to spy on someone’s Whatsapp profile because we do not have that much time to check someone’s profile every five seconds. Wherever I searched for this kind of tools or mobile phone applications some websites gave me a trial version, if you want to continue further you have to pay for it. Once I found this tool and did some R&D. By exploring a little more, I came to know that we can make such a thing for free. It depends on you how you can use this tool and what is your idea.
Happy Coding! ?