I have been using CucumberJS with Selenium-Webdriver to automate my test cases. Currently, I have multiple feature files along with their respective step-definition files. However, when I try to run the test cases, an error is thrown:
Error: The previously configured ChromeDriver service is still running and needs to be shut down before its configuration can be adjusted. at Object.setDefaultService (D:\code\egov-test-cases\node_modules\selenium-webdriver\chrome.js:305:11) at new World (D:\code\egov-test-cases\features\support\world.js:21:12) at Object. (D:\code\egov-test-cases\features\steps\create_approver_remittance_master.js:15:13) ...
Despite including code in the world.js file for automating Chrome, and importing the driver from it, I continue to encounter the same error.
class World {
constructor() {
const { setDefaultTimeout } = require('cucumber');
const webdriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const path = require('chromedriver').path;
const screen = {
width: 640,
height: 480
};
setDefaultTimeout(100 * 5000);
var service = new chrome.ServiceBuilder(path).build();
chrome.setDefaultService(service);
this.driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();
}
}