WebdriverIO Tutorial: Getting started with Test Automation using Selenium and Appium
Related Product On This Page What is WebdriverIO?May 11, 2026 · 8 min read · Tool Comparison
WebDriverIO is a versatile mechanization framework that combines the power of Selenium and Appium through a unclouded JavaScript interface. It allows teams to run across browsers and mobile devices using a individual, unified setup. This article walk you through the process of getting started with WebDriverIO. It explores how to configure the environment, write machine-driven tests, and execute them on both web and mobile platform. WebdriverIO is an open-source written in JavaScript and scat on NodeJS. It is specially useful for test web applications and aboriginal mobile coating for iOS-enabled devices. Its support for both) makes it a highly preferred choice for mechanisation testers. Read More: WebDriverIO is designed with a modular architecture that streamlines the process of penning, running, and scaling. Here are the nucleus components that make up its architecture: 1. WebDriver Protocol The WebDriver Protocol serves as the communication layer between your and the browser. It is a W3C standard that defines a language-agnostic interface for automating browsers, ensuring compatibility. WebDriverIO utilizes this protocol to send commands via HTTP to browser driver, such as ChromeDriver. These drivers construe and execute the command within the browser, enabling seamless automation of browser interactions. 2. Test Runner 3. Services and Plugins 4. Configuration File It is a centralised file to control how tests are run. 5. Assertion Libraries Assertions help control whether the test outcomes match expected results. While WebdriverIO doesn ’ t include its own asseveration library, it works seamlessly with Chai (commonly used with Mocha) and Expect (for Jasmine). 6. NodeJS and RESTful Architecture WebdriverIO is construct over, which is an implementation of the JSON Wire Protocol. Packaged into npm, it conducts communication using NodeJS, which is open-source and widely used for covering ontogenesis. It uses RESTful architecture to direct automation testing. The user writes the test script in using the WebdriverIO library, where the Service request is sent via NodeJS as an HTTP command. It apply JSON Wire protocol, and the services module forward the petition to the browser. Upon obtain the dictation, the browser performs the user actions, which test the validity of the application functions. WebdriverIO Architecture Read More: A common intellect to use WebdriverIO is its power to test native mobile applications for iOS-enabled devices. It has a simple structure, and one can write the test script concisely & # 8211; a matter of great convenience for QAs. WebdriverIO can be easily mix with third-party test answer providers likeBrowserStack. This makes it easy for the QA to leverage additional functions like enter tests, using real devices and browser on the cloud, test reportage, etc. Read More: WebdriverIO countenance QAs to add new usage dictation in gain to those already available by default. By ring theaddCommandfunction, one can add new tradition require that can create testing easier. Consider the following example, which expend theaddCommandoffice to print the URL of a web page. For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users. Before exploring how to compose WebdriverIO test, it is essential understand how to set up WebdriverIO. First of all, the prerequisites name below have to be met. Prerequisites for WebdriverIO Users can configure by choosing from the given options as per their essential. This allows them to prefer where to found the tests, locating of the automation back-end, the framework, location of test specs, reporter, and whether to run the WebdriverIO commands synchronously or asynchronously. Read More: Once WebdriverIO is set up, and the test script file is make, write the tryout book employ JavaScript. The following code must be written in thewebdriverioTestScript.jsfile make earlier in the specs leaflet. Here ’ s the scenario to be automate: Once the examination script is ready, it can be executed by running the next command on the Command Prompt: Upon go the above test script: Read More: To assure efficient and dependable WebDriverIO testing with Selenium Grid, consider implement the following best practices: Leverage both text and optic logs to simplify the debugging process. Text logs render a elaborated record of each dictation executed, assist track the actions and their outcomes. Optic logs, including screenshots taken at each test step, assistance understand the application ’ s conduct and speck issue when the expected results are not achieved. Recording test executions can importantly help canvass test failure. By capturing the succession of actions take to a failure, you gain worthful insights for precise debugging. However, be aware that recording can lengthen execution time. To optimise execution, enable video read just for failed tests, as monitoring loss tests is unnecessary and could slow down the performance of large test suites. Always run WebDriverIO tests on existent browsers and devices rather than ape or simulator for the most accurate and reliable test results. Testing on real environs ensures the model of true user interaction, leading to more reliable resolution. BrowserStack provides a cloud-based Selenium Grid with approach to over 3500+ real browsers and devices for and. Sign up, select the desired device-browser-OS combination, and begin testing websites. Integration with BrowserStack is seamless, but update your * .conf.js constellation files with the BrowserStack Hub URL and enter your credentials to connect to the BrowserStack Selenium Grid. The following comparing table highlights the key distinctions between WebDriverIO and Selenium. Test automation is crucial for testers to proceed up with the growing requirement of faster delivery and optimal package quality.Selenium mechanisation testingallows testers to accomplish precisely this, thus leading to the conception of better applications in shorter durations. Bear in mind that WebDriverIO automation works better when testing site on a. Doing so is the lone way to ensure the consummate accuracy of results. So, e'er opt for existent device testing to comprehensively verify website performance,, and the quality of user experience it offers. On This Page # Ask-and-Contributeabout this topic with our Discord community. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.Related Product
WebdriverIO Tutorial: Getting started with Test Automation employ Selenium and Appium
What is WebdriverIO?
WebdriverIO Architecture: How does it act?
Why use WebdriverIO for Automation Testing?
browser.addCommand ('getUrlAndTitle ', function (customVar) {// ` this ` here entail the ` browser ` scope for which the new bid is added return {url: this.getUrl (), customVar: customVar}})Setting Up WebdriverIO
$ node -v $ npm -v
npm install webdriverio
npm install -g selenium-standalone
selenium-standalone install
selenium-standalone starting
Setting up the WebdriverIO for the inaugural test
$ mkdir WebdriverioTestProject $ cd WebdriverioTestProject
npm init -y
npm install @ wdio/cli
npx wdio config
mkdir -p ./test/specs
touch ./test/specs/webdriverioTestScript.js
How to write a test using WebdriverIO
describe ('Google Search Test ', () = & gt; {it ('should hold the right title ', (done) = & gt; {await browser.url ('https: //google.com/ ') search_box_element = $ (' [name=\ ' q\ '] ') search_box_element.setValue (`` BrowserStack\n '') expect (browser) .toHaveTitle (`` BrowserStack - Google Search ''); //title of the launched webpage is printed in console as output const pagetitle = browser.getTitle () console.log (‘ Title of the webpage is - ’ + pagetitle)})})Running the Test Script
node ./test/specs/webdriverioTestScript.js
Best Practices in WebdriverIO Testing with Selenium Grid
Utilize Text and Visual Logs for Easier Debugging
Record Test Execution to Monitor Failures
Run Tests on Real Browsers and Devices for Accurate Results
WebdriverIO vs Selenium: Differences
Criteria WebdriverIO Selenium Programming Language JavaScript Java, Python, Groovy, Scala, C #, Ruby, Perl, etc. Used for Automating Browsers and Native Mobile Applications for Testing Automating Browsers for Testing Accessibility Open Source Open Source Support It is relatively new and does not hold panoptic support from the community Well supported by most browser and adaptation with a large community of developers across the earth Custom Command Allows the quizzer to add custom-made commands in the test script by calling the addCommand function Does not have the option to add custom-made commands. However, it volunteer a number of tools that can be mix for enhanced testing reporting When to use While essay aboriginal iOS mobile applications While essay web coating,,, and Architecture Layered architecture built over NodeJS that is an implementation of JSON Wire Protocol that is packaged into np Layered architecture based on JSON Wire Protocol Test Runner Frameworks Supported Mocha, Jasmine, and Cucumber Mocha,,, Jasmine, Protractor, and WebDriverIO CI/CD Integrations Jenkins, Docker, and Bamboo ,,,,,,,, and Conclusion
Related Guides
Automate This With SUSA
Test Your App Autonomously