Taiko.Dev

Abdurrahman POLAT
Orion Innovation techClub
4 min readMay 21, 2022
Photo by AltumCode on Unsplash

Hello, This article was written to give a different perspective to friends who use taiko and want to use it.

Taiko is a free and open-source browser automation tool. Taiko is a Node.js library with a clear and concise API for automating Chromium-based browsers (Chrome, Microsoft Edge, Opera) and Firefox.

There are many open-source tools available today to automate browser-based testing. But the most important feature that distinguishes taiko from them is that it acts as a black box. It acts as if using the scanner in the eyes of the user. Taiko rarely uses selectors like CSS, XPath, and ID. It allows you to click as it appears on the page. Also, Taiko doesn’t need a driver. It is already a tool that works on the Chrome development tool.
• It supports javascript and javascript-based frameworks as a programming language.
• It has cross-browser support.
• Since it runs on the Chrome development tool, it only supports chromium-based browsers. (chrome, firefox, Microsoft edge, and opera).
• It only supports web platforms. There is no mobile support.
• The purpose of the taiko is to reduce the cost of testing. It prevents changes made to the code written in the backend from creating new costs for testing.
• Taiko can be used in the terminal.
• It supports visual studio code and IntelliJ aside.

Browser Automation Test with Taiko

For Taiko installation, node.js must be installed on your computer first.
Then you can download it from the terminal with the command

npm install -g taiko

If you want to make sure taiko is installed, run the following command

taiko -v

To run taiko, simply type taiko into the terminal.

Command Prompt Windows Terminal

The openBrowser() command written in the taiko’s documentation is used for this process, starting with the browser's opening.
After the browser is opened, you can use the goto() command to go to the page you want. As a second step, the desired page is opened with the goto(“URL”) command.

Command Prompt Windows Terminal

The id.atlassian.com site has been used for testing purposes. In the next step, the user name is typed in the text box to log in.
Then click continue with the click() command.

Command Prompt Windows Terminal

In the other step, a password was written into the textbox by using the write command. All you have to do is tell the taiko to do things as your eye sees.
Then, by clicking the Log in button with the click() command, the login process was successful.
To verify that the login process was successful, a check was performed with the assert.ok() command.

Command Prompt Windows Terminal

The home page screen of id.atlassian.com is shown as a printout below.

www.id.atlassian.com

With the .code command, you can get the output of terminal commands in js format or you can ask them to save it as a js file in your own locale. To close the taiko, it will be enough to use the .exit command.

Command Prompt Windows Terminal

The generated .js file is below

If you want to run the file you can type taiko “file extension” in vs code terminal and run it.

By the way, if you want to see the steps happening while the browser is open, you have to turn off the headless mode when starting the browser.

headless:false

As a result, Taiko’s difference from other automation frameworks is that it is very comfortable to use. Even people with little coding knowledge can write browser automation tests with taiko. I hope what I wrote was helpful. Thank you for taking the time to read.

--

--