Forum Discussion

katowjo's avatar
katowjo
New Contributor
3 years ago

Inspecting devtools console

Hey there.

I'm doing automated tests using Javascript, Selenium and crossbrowsertesting.com

I'd like to 'inspect' the console logs of the browsers that i use in my tests.

How could i do that?

I tried what i found in the Selenium docs but it did not work:

 

const cdpConnection = await driver.createCDPConnection('page')
await driver.onLogEvent(cdpConnection, function(event) {
  assert.equal(event['args'][0]['value'], 'here')
})
await driver.executeScript('console.log("here")')

 

driver.createCDPConnection('page') <-- generates an exception.

Any pointers appreciated.

Thanks.

2 Replies

Replies have been turned off for this discussion
  • brumazz's avatar
    brumazz
    SmartBear Alumni (Retired)

    Have you tried just doing a Live Test with the same configuration and opening the devtools from there?

     
    • katowjo's avatar
      katowjo
      New Contributor

      Hi. 

      Thanks for answering.

      I'm afraid that approach will not do it since i need to do everything in a programatic way.