Capturing JavaScript error in Selenium

前端 未结 12 735
盖世英雄少女心
盖世英雄少女心 2020-12-02 08:15

Is there a way to capture errors occurring in the DOM in Selenium and probably flag the same as an error in the page?

To give a brief exam

12条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 08:30

    JSErrorCollector does the job.

    Once configured, it's a matter of:

    List jsErrorList = JavaScriptError.readErrors(driver);
    

提交回复
热议问题