lib/devtools.js
/**
     * Find Chrome DevTools Interface port by checking Chrome switches from the chrome://version
     * page. In case a newer version is used (+v65) we check the DevToolsActivePort file
     */
Find Chrome DevTools Interface port by checking Chrome switches from the chrome://version
page. In case a newer version is used (+v65) we check the DevToolsActivePort file
Find Chrome DevTools Interface port by checking Chrome switches from the chrome : // version page . In case a newer version is used ( + v65 ) we check the DevToolsActivePort file
async _findChromePort () {
        try {
            await browser.url('chrome://version')
            const cmdLineText = await browser.getText('#command_line')
            let port = parseInt(cmdLineText.match(RE_DEVTOOLS_DEBUGGING_PORT_SWITCH)[1])
            if (port === 0) {
                const userDataDir = cmdLineText.match(RE_USER_DATA_DIR_SWITCH)[1].trim()
                const devToolsActivePortFile = fs.readFileSync(path.join(userDataDir, 'DevToolsActivePort'), 'utf8')
                port = parseInt(devToolsActivePortFile.split('\n').shift(), 10)
            }
            return port
        } catch (err) {
            console.log(`Could not connect to chrome`)
        }
    }
async _findChromePort ( ) { try { await browser . url ( 'chrome://version' ) const cmdLineText = await browser . getText ( '#command_line' ) let port = parseInt ( cmdLineText . match ( RE_DEVTOOLS_DEBUGGING_PORT_SWITCH ) [ 1 ] ) if ( port === 0 ) { const userDataDir = cmdLineText . match ( RE_USER_DATA_DIR_SWITCH ) [ 1 ] . trim ( ) const devToolsActivePortFile = fs . readFileSync ( path . join ( userDataDir , 'DevToolsActivePort' ) , 'utf8' ) port = parseInt ( devToolsActivePortFile . split ( '\n' ) . shift ( ) , 10 ) } return port } catch ( err ) { console . log ( ` ` ) } }
Find Chrome DevTools Interface port by checking Chrome switches from the chrome://version
 page.
Find Chrome DevTools Interface port by checking Chrome switches from the chrome : // version page .