Capturing JavaScript error in Selenium

前端 未结 12 734
盖世英雄少女心
盖世英雄少女心 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:19

    Solution with "window.onerror" didn't work for me.

    So I'd like to point out another solution with altering user-extensions.js which helped me:
    Can Selenium detect if the page has JavaScript errors?

    Main advantage: You don't have to change the page source to do the check.

    And here is how to use user-extensions.js:
    Using User-Extensions With Selenium-IDE

    Note: This solution works only with Firefox

提交回复
热议问题