Taiko – A Free and Open Source Browser Automation Tool

Back to Blog
Taiko the automation tool

Taiko – A Free and Open Source Browser Automation Tool

Taiko is an automation tool that is freely available and it is an open-source browser automation tool. It is built by the ThoughtWorks team. It uses the Node.js library to automate the chrome browser. Taiko is very useful to create maintainable and highly readable JavaScript tests. 

Taiko has a simple API, smart selectors, and implicit waits. All these work together towards a single goal – No more flaky tests.

Taiko Features

Taiko is built ground up to test modern web applications. Below is a list of some of Taiko’s features that differ from other browser automation tools.

  1. Easy Installation
  2. Interactive Recorder
  3. Smart Selectors
  4. Handle XHR and dynamic content
  5. Request/Response stubbing and mocking

Easy Installation

We can use Taiko on three platforms:

1. Windows
2. macOS
3. Linux

Before starting work on Taiko scripts in JavaScript, Node.js should be installed in your system. After that open a command prompt (For Windows) and install Taiko using the below command:

$ npm install -g taiko

This will install Taiko and the Chromium browser with the latest version.

Taiko tool comes with a REPL Recorder which is used for writing test scripts. To launch the REPL, just type in CMD : 

$ taiko

Here is the output:

Version: 0.8.0 (Chromium:76.0.3803.0)

Type .api for help and .exit to quit
>

This will open the Taiko prompt in your cmd application. Now you can use Taiko’s API.

Let’s perform some tasks: 

Taiko’s REPL keeps a history of all ran commands. Once execution finish, you can generate a test script using the below command : 

> .code

You can copy and modify the javascript code or save it to a file in your system using the below command: 

Read Also – Most Popular Automation Testing Tools

> .code taiko_demo.js

As you can see the file save in the system.

file is saved in the system

You can finish the recording using the command shown below :

> .exit

If you want to run a Taiko script, for that you need to pass the file as an argument to Taiko

Run a Taiko script

By default Taiko runs the script in headless mode, this makes it easy to run Taiko.
To view the browser while executing the script, run the command : 

$ taiko googlesearch.js –observe

There are some other methods of taiko that we can use to perform other tasks of taiko. To check all available APIs, run the command :> .api

For more details of an API with examples use:

>.api openBrowser

Example:

openBrowser()

    openBrowser({ headless: false })

    openBrowser({args:['--window-size=1440,900']})

 

If you are interested in even more software testing-related articles and information from us here at Devstringx, then we have a lot to choose from for you.

Share this post

Back to Blog