Taiko: Node.js Library for Chrome/Chromium Automation
source link: https://www.tuicool.com/articles/hit/3Mfy6zV
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Taiko
A node.js library to automate chrome/chromium browser
Getting started
$ npm install -g taiko
On Windows, make sure that the location %AppData%\npm
(or wherever npm
ends up installing the module on your Windows flavor) is present in PATH
environment variable.
On Linux, install taiko
to a NODE_PATH
with executable permission.
Usage
Command line
Use the Read–eval–print Loop to record a script.
$ taiko > openBrowser() ✔ Browser and page initialized > goto("http://todomvc.com/examples/react/#/"); ✔ Navigated to url "http://todomvc.com/examples/react/#/" > write("automate with taiko"); ✔ Wrote automate with taiko into the focused element. > press("Enter"); ✔ Pressed the Enter key > click(checkBox(near("automate with taiko"))); ✔ Clicked checkbox Near automate with taiko > .code const { openBrowser, goto, write, press, near, checkBox, click } = require('taiko'); (async () => { await openBrowser({headless:false}); await goto("http://todomvc.com/examples/react/#/"); await write("automate with taiko"); await press("Enter"); await click(checkBox(near("automate with taiko"))); closeBrowser(); })(); > .code code.js
Running a taiko script
$ taiko code.js
As a Module
$ npm install <path_to_taiko_repo> --save $ node code.js
Install from source
$ git clone https://github.com/getgauge/taiko.git $ npm install -g <path_to_taiko_repo>
Run tests
Test are written using gauge . Install and setup gauge following instructions here
git clone https://github.com/getgauge-examples/js-taiko.git cd js-taiko npm install
gauge run specs
or gauge run specs --tags=\!knownIssue
(to ignore specs for knownissue)
Documentation
Inspired by
Talk to us
For queries and contributions talk to the Gauge team.
Copyright
Copyright 2018 ThoughtWorks, Inc
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK