Menu

JAVASCRIPT: I should check the alert's text

Help
2005-05-25
2013-04-26
  • istvan benedek

    istvan benedek - 2005-05-25

    Hi,

    First I have to tell I'm beginner in httpunit testing. May be the solution is very simple.

    I have a very simple site :

    <html><head><title>Alert sample</title></head>
    <body onload='alert("foo");'>
    </body></html>

    It is only for testing and I want to obtain alert's text.

    My code looks like this:

    WebConversation wc = new WebConversation();
    WebRequest req = new GetMethodWebRequest("http://delfin.klte.hu/~benedeki");
    WebResponse   resp = wc.getResponse( req );

    An if call this at this point :

    wc.getNextAlert());

    I get null.

    Anyone of You can help me in this problem ?
    ASAP:)
    I made something wrong?

    Thanks in advance!

    Best Regards,
    Istvan Benedek

     
    • James Tikalsky

      James Tikalsky - 2005-06-06

      Istvan,

      I've tried your code, and it works fine for me. I do notice that when I point my browser to http://delfin.klte.hu/~benedeki, there is no alert box. Are you sure you're using the correct address?

      James Tikalsky

       

Log in to post a comment.

MongoDB Logo MongoDB