{"id":13393358,"url":"https://github.com/getgauge/taiko","last_synced_at":"2025-05-15T00:05:32.313Z","repository":{"id":26358394,"uuid":"108502821","full_name":"getgauge/taiko","owner":"getgauge","description":"A node.js library for testing modern web applications","archived":false,"fork":false,"pushed_at":"2025-03-20T08:59:22.000Z","size":27512,"stargazers_count":3618,"open_issues_count":58,"forks_count":442,"subscribers_count":69,"default_branch":"master","last_synced_at":"2025-05-07T23:37:02.500Z","etag":null,"topics":["automation","headless","headless-browsers","headless-chrome","headless-chromium","headless-testing","testing-tools"],"latest_commit_sha":null,"homepage":"https://taiko.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getgauge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-10-27T05:25:27.000Z","updated_at":"2025-05-07T22:41:19.000Z","dependencies_parsed_at":"2023-01-14T13:45:21.579Z","dependency_job_id":"2eeec17f-fe8a-4710-93bc-566132828b43","html_url":"https://github.com/getgauge/taiko","commit_stats":{"total_commits":2299,"total_committers":117,"mean_commits":19.64957264957265,"dds":0.7390169638973467,"last_synced_commit":"052d9caba70cb5c8d9e25cb7a747ae7b4041400d"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getgauge%2Ftaiko","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getgauge%2Ftaiko/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getgauge%2Ftaiko/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getgauge%2Ftaiko/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getgauge","download_url":"https://codeload.github.com/getgauge/taiko/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253239420,"owners_count":21876458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","headless","headless-browsers","headless-chrome","headless-chromium","headless-testing","testing-tools"],"created_at":"2024-07-30T17:00:51.070Z","updated_at":"2025-05-15T00:05:32.221Z","avatar_url":"https://github.com/getgauge.png","language":"JavaScript","funding_links":[],"categories":["Opensource projects","JavaScript","automation","Testing Frameworks","*.js","Testing Frameworks [🔝](#readme)","测试框架","Eight e2e testing tools for Node.js, JavaScript and TypeScript"],"sub_categories":["Runner","Node","运行器","运行器e2e测试"],"readme":"# Taiko\n##### [Docs](https://docs.taiko.dev) | [API reference](https://docs.taiko.dev/api/reference)\n\nA Node.js library for testing modern web applications\n\n[![Actions Status](https://github.com/getgauge/taiko/workflows/taiko/badge.svg)](https://github.com/getgauge/taiko/actions)\n[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/getgauge/taiko/blob/master/LICENSE)\n[![npm version](https://badge.fury.io/js/taiko.svg?style=flat-square)](https://badge.fury.io/js/taiko)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/getgauge/taiko/issues)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)\n\n\n![Taiko REPL](https://user-images.githubusercontent.com/44019225/60337143-da31a280-99bf-11e9-80a4-57917d81e0b6.gif)\n\n# What’s Taiko?\n\nTaiko is a free and open source browser automation tool built by the team behind [Gauge](https://gauge.org/) from [ThoughtWorks](https://www.thoughtworks.com/). Taiko is a Node.js library with a clear and concise API to automate **Chromium based browsers**(Chrome, Microsoft Edge, Opera) and Firefox. Tests written in Taiko are highly readable and maintainable.\n\nWith Taiko it’s easy to\n\n* Get Started\n* Record/Write/Run tests\n\nTaiko’s smart selectors make tests reliable by adapting to changes in the structure of your web application. With Taiko there’s no need for id/css/xpath selectors or adding explicit waits (for XHR requests) in test scripts.\n\n## Features\n\nTaiko is built ground up to test modern web applications. Here’s a list of a few unique features that sets it apart from other browser automation tools.\n\n* Easy Installation\n* Interactive Recorder\n* Smart Selectors\n* Handle XHR and dynamic content\n* Request/Response stubbing and mocking\n\n# Getting Started\n\n## Easy Installation\n\nTaiko works on Windows, MacOS and Linux. You only need [Node.js](https://nodejs.org/en/) installed in your system to start writing Taiko scripts in JavaScript. After you’ve installed Node.js open a terminal application (or powershell in the case of Windows) and install Taiko using [npm](https://www.npmjs.com/) with the command\n\n    $ npm install -g taiko\n\nThis installs Taiko and the latest version of Chromium browser. We are all set to do some testing!\n\n## Interactive Recorder\n\nTaiko comes with a Recorder that’s a REPL for writing test scripts. You can use Taiko’s JavaScript API to control the browser from the REPL. To launch the REPL type taiko in your favorite terminal application\n\n    $ taiko\n    Version: 1.4.0 (Chromium: 126.0.6468.0)\n    Type .api for help and .exit to quit\n    \u003e\n\nThis launches the Taiko prompt. You can now use Taiko’s API as commands in this prompt. For example, launch a Chromium browser instance using\n\n    \u003e openBrowser()\n\nYou can now automate this Chromium browser instance with commands, for example, make the browser search google for something.\n\n    \u003e goto(\"google.com/?hl=en\")\n    \u003e write(\"taiko test automation\")\n    \u003e click(\"Google Search\")\n\nThese commands make the browser go to google’s home page, type the text \"taiko test automation\" and click on the \"Google Search\" button. You can see the browser performing these actions as you type and press enter for each command.\n\nTaiko’s REPL keeps a history of all successful commands. Once you finish a flow of execution, you can generate a test script using the special command .code\n\n    \u003e .code\n    const { openBrowser, goto, write, click, closeBrowser } = require('taiko');\n\n    (async () =\u003e {\n        try {\n            await openBrowser();\n            await goto(\"google.com\");\n            await write(\"taiko test automation\");\n            await click(\"Google Search\");\n        } catch (error) {\n                console.error(error);\n        } finally {\n                closeBrowser();\n        }\n    })();\n\nTaiko generates readable and maintainable JavaScript code. Copy and modify this code or\nsave it directly to a file using\n\n    \u003e .code googlesearch.js\n\nYou can choose to continue automating or finish the recording using\n\n    \u003e .exit\n\nTo run a Taiko script pass the file as an argument to taiko\n\n    $ taiko googlesearch.js\n    ✔ Browser opened\n    ✔ Navigated to url \"http://google.com\"\n    ✔ Wrote taiko test automation into the focused element.\n    ✔ Clicked element containing text \"Google Search\"\n    ✔ Browser closed\n\nBy default Taiko runs the script in headless mode, that means it does not launch a browser window. This makes it easy to run Taiko in containers (ex. Docker). To view the browser when the script executes use\n\n    $ taiko googlesearch.js --observe\n\nTaiko’s REPL also documents all the API’s. To view all available API’s use the special command `.api`\n\n    $ taiko\n    Version: 1.4.0 (Chromium: 126.0.6468.0)\n    Type .api for help and .exit to quit\n    \u003e .api\n    Browser actions\n        openBrowser, closeBrowser, client, switchTo, setViewPort, openTab, closeTab\n    ...\n\nTo see more details of an API along with examples use\n\n    \u003e.api openBrowser\n\n    Launches a browser with a tab. The browser will be closed when the parent node.js process is closed.\n\n    Example:\n        openBrowser()\n        openBrowser({ headless: false })\n        openBrowser({args:['--window-size=1440,900']})\n\n\n## Smart Selectors\n\nTaiko’s API treats the browser as a black box. With Taiko we can write scripts by looking at a web page and without inspecting it’s source code For example on `google.com` the command\n\n    \u003e click(\"Google Search\")\n\nclicks on any element with the text `Google Search` (a button on the page at https://google.com). Taiko’s API mimics user interactions with the browser. For example if you want to write into an element that’s currently in focus use\n\n    \u003e write(\"something\")\n\nOr if you want to write into a specific text field\n\n    \u003e write(\"something\", into(textBox({placeholder: \"Username\"})))\n\nWith Taiko’s API we can avoid using ids/css/xpath selectors to create reliable tests that don’t break with changes in the web page’s structure.\n\nYou can also use Taiko’s proximity selectors to visually locate elements. For example\n\n    \u003e click(checkBox(near(\"Username\")))\n\nWill click the checkbox that is nearest to any element with the text `Username`.\n\nTaiko also supports XPath and CSS selectors\n\n    \u003e click($(\"#button_id\")) // Using CSS selector\n    \u003e click($(\"//input[@name='button_name']\")) // XPath selector\n\n## Handle XHR and dynamic content\n\nTaiko’s API listens to actions that trigger XHR request or fetch dynamic content and automatically waits for them to complete before moving on to the next action. Taiko implicitly waits for elements to load on the page before performing executing the command. Scripts written in Taiko are free of explicit local or global waits and the flakiness.\n\n## Request/Response stubbing and mocking\n\nSetting up test infrastructure and test data is hard. Taiko makes this easy with the intercept API. For example, block requests on a page  (like Google Analytics or any other resource)\n\n    \u003e intercept(\"https://www.google-analytics.com/analytics.js\");\n\nOr redirect an XHR request on the page to a test instance\n\n    \u003e intercept(\"https://fetchdata.com\", \"http://fetchtestdata.com\")\n\nOr stub an XHR request to return custom data\n\n    \u003e intercept(\"https://fetchdata.com\", {\"test\": data})\n\nOr even modify data sent by XHR requests\n\n    \u003e intercept(\"https://fetchdata.com\", (request) =\u003e {request.continue({\"custom\": \"data\"})})\n\nThis simplifies our test setups as we don’t have to set up mock servers, or replace url’s in tests to point to test instances.\n\n## Integrating with Gauge\n\nWe recommend using Taiko with [Gauge](https://gauge.org/). Gauge is a framework for writing readable and reusable acceptance tests. With features like markdown specifications, data driven execution, parallel execution and reporting Gauge makes test maintenance easy. Gauge is easy to install and well integrated with Taiko. With Gauge and Taiko we can write reliable acceptance tests.\n\nInstall Gauge using npm and initialize an initialize and sample Taiko project using\n\n    $ npm install @getgauge/cli\n    $ gauge init js\n\nLearn more about [Gauge](https://docs.gauge.org)!\n\n### Experimental Firefox Support\n\n#### To launch taiko with firefox:\n- Download and install [firefox nightly](https://www.mozilla.org/en-US/firefox/all/#product-desktop-nightly)\n- Set `TAIKO_BROWSER_PATH` to firefox nightly's executable.\n\nExample: `TAIKO_BROWSER_PATH=\"/Applications/Firefoxnightly.app/Contents/MacOS/firefox\" taiko`\n\n#### Known Issues for now:\n- Highlighting element on action is set to false as overlay domain is not supported\n- openTab/closeTab does not work as expected since `New` is not available in firefox yet\n- Autofocus on first input field does not happen\n- file:// protocol does not emit events\n- waitFoNavigation does not wait for network calls and frame loads\n\n### Experimental TypeScript Support\n\nWhen using Gauge together with Taiko with [gauge-ts](https://github.com/BugDiver/gauge-ts/) using\n\n    $ npm install @getgauge/cli\n    $ gauge init ts\n\n## Documentation\n\n* [API](https://docs.taiko.dev)\n\n## Branding\n\n* [Brand Style Guide](https://brand.taiko.dev) which includes assets like logos and images.\n\n## Inspired by\n\n* [Helium](https://heliumhq.com/)\n* [Puppeteer](https://github.com/GoogleChrome/puppeteer)\n\n## Talk to us\n\n* [Discussions](https://github.com/getgauge/taiko/discussions) for questions and help\n* [Github Issues](https://github.com/getgauge/taiko/issues) to report issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetgauge%2Ftaiko","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetgauge%2Ftaiko","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetgauge%2Ftaiko/lists"}