开发者

How to find if there are javascript errors in the page using selenium rc

开发者 https://www.devze.com 2022-12-14 04:19 出处:网络
I am using Selenium RC and I would like to know if there were any JavaScript开发者_开发百科 errors in the page.

I am using Selenium RC and I would like to know if there were any JavaScript开发者_开发百科 errors in the page.

Is there any Selenium API to check if there are any JavaScript errors?


I'm not sure there's anything in the Selenium API that can do this. How about putting something like this after all your other JavaScript:

document.write('<!--JSOK-->');

then asserting that it exists from your test script? If the JavaScript has already thrown an error then <!--JSOK--> won't be rendered to the DOM.


I know it's not Selenium, but I've found that for javascript FireBug is the best hands down imho. I know you are going for the "all in one" tool, but I'd consider making an exception in this case.

0

精彩评论

暂无评论...
验证码 换一张
取 消