Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async onModuleInitialized(module) {
// skip any module that does not implement .getDriver() method (e.g. not webdriver based)
if (!module || !module.getDriver || typeof module.getDriver !== 'function' || !module.getCapabilities || typeof module.getCapabilities !== 'function') {
return;
}
const submodule = this._subModules[module.name];
if (!submodule) {
return;
}
// initialize DevToolsService and hook it to the current webdriver object
const devToolsSvc = new WDIODevToolsService();
devToolsSvc.beforeSession(null, module.getCapabilities());
if (devToolsSvc.isSupported) {
// change global.browser to the current module's webdriver instance
const orgGlobalBrowser = global.browser;
global.browser = module.getDriver();
await devToolsSvc.before();
submodule.init(devToolsSvc);
global.browser = orgGlobalBrowser;
}
}
onModuleWillDispose(module) {