in

ArtOfTest, Inc. Community Forums

Discuss and ask questions about ArtOfTest's products.

Download file problems

Last post 06-13-2007 9:35 PM by admin. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 06-06-2007 6:00 PM

    • sircody
    • Top 10 Contributor
    • Joined on 05-23-2007
    • Seattle, Wa
    • Posts 223

    Download file problems

    I am having difficulty getting my test to continue after downloading a file using IE (haven't tried FireFox yet). The framework seems to be stuck waiting for IE to be ready again and thinks it never is. It times out with the error "System.TimeoutException: WaitUntilReady timed out after '50000' seconds." even though the browser actually is ready. The code sequence is like this:

                // Download clip
                Element downloadlink = Find.ByAttributes("class=link-row");
                Assert.IsNotNull(downloadlink);
                downloadlink = downloadlink.Children[0];
                Actions.Click(downloadlink);
                // At this point the download succeeds, the browser moves to a new page but WebAii is stuck waiting until ready and times out after 50 seconds.
                Actions.Click(Find.ById("ctl00_MainContent_btnReturn"));

    I even tried using:

                Desktop.Mouse.Click(MouseClickType.LeftClick, downloadlink.GetRectangle());
                ActiveBrowser.WaitUntilReady();

    In place of Actions.Click(). Unfortunately the WaitUntilReady still times out using this approach.

    I am stuck at this point. It's very important that I get this to work in this particular test case (part of an end-to-end test suite).
     

    Cody

    ---- WebAii Expert User ----
    Filed under: , ,
  • 06-06-2007 6:20 PM In reply to

    Re: Download file problems

    Can you tell me what the link is downloading? Can you send me the HTML of the downloadlink element? I'm need that so I can try to replicate your scenario to debug this.

    Doesn't the download pop-up a dialog box?

     

     

    ArtOfTest, Inc.
    Filed under:
  • 06-07-2007 9:24 AM In reply to

    • sircody
    • Top 10 Contributor
    • Joined on 05-23-2007
    • Seattle, Wa
    • Posts 223

    Re: Download file problems

    The HTML element is this:

    <div class="link-row">

    <a class="copyBold" onmouseover="dlh(true, "Download clip");return true;" onmouseout="dlh();" href="BLOCKED SCRIPT__doPostBack('ctl00$ctl00$MainContent$PurchaseContent$assetList','304-34|34')" title="Download clip">Download clip</a>
    </div>
     
    And here is the JavaScript being called:
    <!--
    var theForm = document.forms['aspnetForm'];
    if (!theForm) {
      theForm = document.aspnetForm;
    }
    function __doPostBack(eventTarget, eventArgument) {
      if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
      theForm.__EVENTTARGET.value = eventTarget;
     theForm.__EVENTARGUMENT.value = eventArgument;
     theForm.submit();
     }
    }
    // -->
     
    In this instance I am downloading a .mov movie clip. I will also use it to download .jpg images as I continue to develop this test case.
     
    RE: pup-up dialog - Yes it does. I got rid of the IE gold bar (where it says something like "Downloading this file has been blocked....") by adding my test website to the list of trusted websites within IE's configuration. Also because this test case is still in development, at present I am manually clicking the buttons on the download dialog to finish the download. The download takes about 10 seconds to complete, well within the 50 second default timeout configured in WebAii. I plan on implementing a custom dialog handler using WebAii's framework to automatically handle this dialog box for me.

     

    Cody

    ---- WebAii Expert User ----
    Filed under: , ,
  • 06-07-2007 8:58 PM In reply to

    Re: Download file problems

    Great... We are going to try to replicate this scenarios and report back the results of the investigation...

    ArtOfTest, Inc.
  • 06-12-2007 3:09 PM In reply to

    • sircody
    • Top 10 Contributor
    • Joined on 05-23-2007
    • Seattle, Wa
    • Posts 223

    Re: Download file problems

    Any progress on this? Do I need to submit sample code? That may be somewhat difficult only because I'm testing against an internal only test website. 

    Cody

    ---- WebAii Expert User ----
  • 06-13-2007 6:21 AM In reply to

    Re: Download file problems

    We actually have been trying to reproduce this but no success. Can you share your test code that is causing the issue. Maybe there is something there...

    ArtOfTest, Inc.
  • 06-13-2007 9:35 PM In reply to

    Re: Download file problems

    Thanks for taking the time to setup the repro. I took a look at this issue. Here is what I found out:

    IE is stuck with ReadyState = READYSTATE_INTERACTIVE. Basically IE doesn’t believe the document is ready. Most probably this is because I never finished the download. In your testing did you let the full movie download? You might want to try that first. (Pick a smaller size movie).

    In any case, here is a work around that worked for me. In WebAii after each action, we wait for the page to be ready and then do a dom refresh . This is to make sure the DOM is always up to date after each action. You can disable that by setting the AutoDomRefresh & AutoWaitUntilReady to false. You need to disable both since AutoDomRefresh will invoke a WaitUntilReady even if AutoWaitUntilReady is turned off since you can’t get the DOM if the document is not ready. Here is some code that makes the test pass. I just tested it.

    // Download clip
    Element downloadlink = Find.ByAttributes("class=link-row");
    Assert.IsNotNull(downloadlink);
    downloadlink = downloadlink.Children[0];

     Disable auto wait for the browser           
    ActiveBrowser.AutoWaitUntilReady = false;
    ActiveBrowser.AutoDomRefresh = false;

     Click download.It will not wait for the readystate for IE
    Actions.Click(downloadlink);
               
     Re-enable the auto dom wait and refresh
    ActiveBrowser.AutoDomRefresh = true;
    ActiveBrowser.AutoWaitUntilReady = true;

     Given that we didn’t automatically wait for the DOM to be ready, make sure we wait for the
     element that we are going to click next.
    Actions.WaitForElement(new FindParam("id=ctl00_MainContent_btnReturn"), 20000);
                     
    // WebAii Framework is broken... stuck in ActiveBrowser.WaitUntilReady(). Waiting for fix from AoT.
    Actions.Click(Find.ById("ctl00_MainContent_btnReturn"));

    I’ll take an action item to  look into how we can make these scenario easier in future versions.

    ArtOfTest, Inc.
Page 1 of 1 (7 items)
Copyrights © 2008 ArtOfTest, Inc. All rights reserved.