how to detect and capture javascript error using selenium2 library in Robot

1,501 views
Skip to first unread message

Sujata Dwivedi

unread,
Apr 2, 2013, 4:27:18 PM4/2/13
to robotframe...@googlegroups.com

 Hi,

I have a question regarding java script error which is defect and it need to be handled,
how to detect  and capture java script error on firefox, ie, chrome browser using selenium2 library in Robot frmework.
Please help me out this.

Regards,
Sujata

David

unread,
May 28, 2013, 9:36:50 PM5/28/13
to robotframe...@googlegroups.com
See this blog post:


but that is in Java, does not cover Robot Framework and Selenium2Library, but the concepts can be adapted. Using that example, it is probably easier to adapt with the Java version of the Selenium2Library rather than Python.

This that I mention of course is for the unseen javascript errors or ones that pop up an error on IE (but usually only show up in javascript console for other browsers). This does not apply to special alert/confirmation popups indicating an error or question to proceed/cancel to the user, which are not "javascript" errors but javascript prompts/alerts.

On Tuesday, May 28, 2013 12:02:06 AM UTC-7, Prakash Rao wrote:
Hi ..even I m facing the same problem..but some times Im getting JS error and some times I m not getting..I dont know how to handle this..


If you are continuosly getting js error then use "Get Alert Message" or "Alert should be present" commands.

Regards:
Prakash.

Andrea Bisello

unread,
Jan 21, 2016, 9:56:29 AM1/21/16
to robotframework-users
Java or Javascript?

anyway, found any solution for javascript errors?

David

unread,
Jan 22, 2016, 2:49:04 AM1/22/16
to robotframework-users
Didn't you see my previous comment/post? That gives you a link to the details. You have to port it to RobotFramework, because I haven't heard of anyone ported it already.

Shouldn't be a lot of work to port. Just execute some javascript with Selenium2Library on every page you test, or for Firefox, load the special extension XPI file mentioned in that link, then later after testing a page, call some special javascript to retrieve errors if any, there are some snippet examples in that link page, although I don't think any are in RobotFramework/Python.
Reply all
Reply to author
Forward
0 new messages