【问题标题】:How to capture error logs from browser console while running test for webdriver io v7 (javascript)How to capture error logs from browser console while running test for webdriver io v7 (javascript)
【发布时间】:2022-12-02 04:47:26
【问题描述】:

So browser.getLogs() is deprecated which was in package JsonWireProtocol which is replaced by WebDriver protocol. I want to capture browser logs (Error and warnings) when the test shows the reports, I cant find something similar in the docs, but I found a command called addConsoleLogs(https://webdriver.io/docs/spec-reporter/#addconsolelogs),if someone has a running example to show would be great. Thank you (using webdriver io v7) I have already tried browser.getLogs() but no luck so looking forward to other approaches with an example.

【问题讨论】:

    标签: javascript selenium-webdriver e2e-testing webdriver-io wdio


    【解决方案1】:

    On your wdio.conf.js add the following configuration:

    reporters: [
      [
        'spec',
          {
            addConsoleLogs: true,
          },
      ], 
    ]
    

    Then on your test you can add a console.log add see logs on terminal.

    【讨论】:

      猜你喜欢
      • 2023-01-29
      • 2022-12-19
      • 2022-12-02
      • 2022-12-02
      • 2023-02-14
      • 2022-11-20
      • 2022-05-17
      • 2022-12-31
      • 2022-12-01
      相关资源
      最近更新 更多