SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dismissing javaScript Alerts while page loading?

    The application I am testing uses JavaScript extensively. To that end, in many of my functions I call a CheckForErrors() function which checks for any JavaScript alerts and other errors, records them, selects the default button, and testing continues.

    This has worked fine up until now, where I have a new case:

    The JavaScript alert appears before the page is loaded (this is in Netscape). The status bar shows it is still trying to load the page, but will not finish until the alert is cleared.

    Since the page isn't loaded, the CheckForErrors() function never gets ran. The function is called right after pressing the submit button which loads the page in question.

    Any advice on how to clear a JavaScript alert that occurs before Silk see's that the page is fully loaded?


    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dismissing javaScript Alerts while page loading?

    You might consider replacing the Browser.WaitForReady() method with one of your own. Inside your version, call your CheckForErrors() routine immediately followed by a call to the original WaitForReady().


  3. #3
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dismissing javaScript Alerts while page loading?

    Can you give me some clue on how to do this? I have actually never redefined a 4Test method, and it appears that WaitForReady() is in a DLL (I think). Couldn't actually find the method defined.

    I did try the following, but it never worked (and several variations):


    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

  4. #4
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dismissing javaScript Alerts while page loading?

    Some more details on the problem:

    The page loads with a left navigation frame and a right content page. After the page loads, a image on the left frame is clicked.

    So, what happens is the frames page loads, loads the left frame, [mark this spot], then loads the right frame.

    at the [mark this spot], the left page is loaded and the right page starts to load. this is where the JavaScript alert occurs, on the right page, before it is loaded. But, Silk is seeing that the left page is loaded, so is trying to select the image. Since the JavaScript alert is a modal dialog, the page doesn't have focus (the alert does), just Silk can not select the link.

    I have tried to check for the alert before selecting the link, but the alert is on a "diffrent page", so Silk isn't seeing it.

    Any advice on what I can try?


    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

  5. #5
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dismissing javaScript Alerts while page loading?

    Still didn't quite work, but atleast the method modification seems better.

    I added
    then did a global replace of all HtmlImage to IWFHtmlImage.

    Let me see if I can explain the problem a bit better.

    The page is loaded from a login page. The login page calls the frame page, which loads Page_A in the left frame and Page_B in the right frame.

    What I want to do is select an image on Page_A, which will in turn, load a new page (Page_C) into the frame that Page_B currently in.

    Now the problem is that Page_A loads fine. Page_B has a JavaScript Alert message at the top of the page, so it is called before the rest of the HTML page is loaded. In Netscape, Page_B does not finish loading until the alert is cleared (click on OK).

    Now, Silk see's that Page_A is loaded, so it tries to click on the image. It can't since it can't make the page active, since the Alert has focus and is locking out access to the entire framed page until it is cleared.

    With the modified Click() method, it is still looking for an error on Page_A, which doesn't have an error - it is Page_B that has an error.

    I don't know if this is any clearer, or just more confusing.


    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

  6. #6
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dismissing javaScript Alerts while page loading?

    I think that we're getting closer.

    Expand the CheckForError() routine to test each ChildWin return value from a GetChildren() call.

    I'd start with visually scanning a ListPrint() of GetChildren() at the point of failure to see what's listed.

    Then narrow the search in your code to just the class(es) of children that represent the various navigate/data panels. Check each of these for the existence of an alert dialog.

    John

  7. #7
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dismissing javaScript Alerts while page loading?

    Those are really confusing details, David! <G>

    My interpretation of it is that the left page "menu" image is clicked two things happen: 1) The left menu image is updated (to reflect the selection), and 2) the Right page is loaded with the associated content. The error occurs at a point between the left page update and the completion of the right page.

    If you are trying to select the next item from the left page you might consider modifying the Click() logic to include the CheckForError() call both before and after the derived::Click().

    MyJavaButton : JavaJFCPushButton
    {
    Click()
    {
    CheckForError() ;
    derived::Click();
    CheckForError() ;
    }
    }

    The above requires that you change your button (image, or whatever) definition to be MyJavaButton.

    Hopefully we're getting closer...

    John

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:03 PM.

Copyright BetaSoft Inc.