Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
deasync.loopWhile(() => !isInitialized && !initError);
if (initError) {
throw _this.errHelper.getSeleniumInitError(initError);
}
_this.driver.setTimeout({ 'implicit': _this.waitForTimeout });
// initialize DevTools service. this is used to collect network requests
var devTools = new DevToolsService();
devTools.beforeSession(null, _this.driver.capabilities);
if (devTools.isSupported) {
// prevent devtools-service from generating logs
// this should be done in a different, more proper, way, but for now just init the logger used by devtools-service:CommandHandler
// so it cannot be inited by the service itself.
WDIOLogger('@wdio/devtools-service:CommandHandler');
global.browser = _this.driver;
devTools.before();
_this.driver.on('Network.responseReceived', (params) => {
if (_this.networkCollect) {
_this.networkRequests.push(params.response);
}
});
}
// reset browser logs if auto collect logs option is enabled
if (opts.collectBrowserLogs && _this.caps.browserName === 'chrome') {
try {
// simply call this to clear the previous logs and start the test with the clean logs
module.getBrowserLogs();
} catch (e) {
console.error('Cannot retrieve browser logs.', e);