WD Integration with Lambdatest Selenium Automation Grid..
- Install npm.
sudo apt install npm
- Install NodeJS.
sudo apt install nodejs
Step 1. Clone the WD Selenium Repository.
git clone https://github.com/LambdaTest/wd-selenium-sample.git
Step 2. Export the Lambda-test Credentials. You can get these from your automation dashboard.
For Linux/macOS:
export LT_USERNAME="YOUR_USERNAME"
export LT_ACCESS_KEY="YOUR ACCESS KEY"
For Windows:
set LT_USERNAME="YOUR_USERNAME"
set LT_ACCESS_KEY="YOUR ACCESS KEY"
Step 3. Inside wd-selenium-sample folder install necessary packages.
cd wd-selenium-sample
npm i
Step 4. To run your First Test.
npm run single
You can check your test results on the Automation Dashboard.
- Will use the same test script over different configration to demonstarte parallel testing. Parallel testing with WD will help you to run multiple test cases simultaneously.
npm run parallel
- single.conf.js
- This contains the configuration to run single test using WD on lambdatest selenium grid.
user= process.env.LT_USERNAME || "<your username>",
key= process.env.LT_ACCESS_KEY || "<your accessKey>",
exports.config = {
seleniumHost: 'hub.lambdatest.com',
seleniumPort: 80,
test: '../tests/single_test.js',
capabilities: [{
browserName: 'chrome',
platform: 'Windows 10',
version: 'latest',
name: "single-test",
build: "wd-lambdatest-sample",
geoLocation : "US"
}]
}
- parallel.conf.js
- This contains the configuration to run parallel test using WD on lambdatest selenium grid.
user= process.env.LT_USERNAME || "<your username>",
key= process.env.LT_ACCESS_KEY || "<your accessKey>",
exports.config = {
seleniumHost: 'hub.lambdatest.com',
seleniumPort: 80,
test: '../tests/single_test.js',
commonCapabilities: {
name: "parallel-test",
build: "wd-lambdatest-sample"
},
capabilities: [{
browserName: 'chrome',
platform: 'Windows 10',
version: 'latest',
geoLocation : "US"
},{
browserName: 'chrome',
platform: 'Windows 10',
version: 'latest-1',
geoLocation : "US"
},{
browserName: 'chrome',
platform: 'Windows 10',
version: 'latest-2',
geoLocation : "US"
}]
}
// Code to support common capabilities
exports.config.capabilities.forEach(function(caps){
for(var i in exports.config.commonCapabilities) caps[i] = caps[i] || exports.config.commonCapabilities[i];
});
- single_test.js
- Imports config from cofig files and run test to open google.com and search Lambdatest on it.
module.exports = {
name: 'Google\'s Search Functionality',
run : function (browser) {
return browser
.get("https://www.google.com/ncr")
.elementByName('q')
.sendKeys('Lambdatest\n')
.sleep(5000)
.title()
.should.become('lambdatest - Google Search');
}
};
LambdaTest is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your selenium automation testing to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel.