Test tool does not wait for page to be fully loaded

4 posts, 0 answers
  1. Arnout
    Arnout avatar
    4 posts
    Member since:
    Mar 2013

    Posted 14 Aug 2013 Link to this post

    Hello,

    I've been automating tests for a specific website for some time now. Today I've added and updated some of my previous tests in order for them to work in a future release of the website. When doing this I stumbled across a rather peculiar problem: my newly added test steps do not seem to always wait for the browser to be ready.

    This is quite unpleasant, as the website is designed to return warnings / alert boxes every single time the user tries to initiate an action while the website is still loading / working on the previous "user request" so to speak. This means I have to add in a lot of extra alert dialog handlers.

    I've never had similar problems before in my ~11 months of experience developing tests for this particular website. To add to the mystery:

    - The tests that I've been modifying are spread out through multiple visual studio solutions. The odd behaviour is only being displayed in 1 out of 8 solutions, the others are still fine.
    - There's nothing special about the added steps. Ajax is set to 0, WaitOnElements for each step is true, SimulateRealClick is set to false.
    - It seems to be consistent behaviour, meaning that it always goes wrong at the same steps.
    - All the steps that were recorded prior to today still work fine.
    - Removing / re-recording the steps doesn't fix the issue.
    - I did specifically raise the 'Wait on elements timeout' at the 'Quick execution options' from 10000 to 30000. Changing it back didn't have an effect on the behaviour, so this likely isn't the cause of the problem.
    - I tried going back to IE9 (worked with IE10 before). This didn't fix it either.

    Installed version: 2012.2.1204.0

    I'm about to just revert my test back to the way it was and start all over. I'm hoping there's something I might have missed. Hope you can help me out!

    Kind regards,

    Arnout
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1043 posts

    Posted 19 Aug 2013 Link to this post

    Hello Arnoult,

    I am sorry to hear you are running into this problem.

    Let's try several options:

    1. Please add additional WaitForExists step for the element you are verifying or for some of the slowest element on the page.

    2. Set Ajax to something different than 0 (e.g. 2000).

    3. As a really last option you can add Execution Delay to pause the test for a set amount of time.

    If the issue persists please:

    1. Send us the execution log.

    2. Please record a Jing video demonstrating the entire process, so we can better understand what is happening. 

    3. Please provide us with a copy of your test and if it is possible grant us access to your application so we can reproduce the issue on our end and give you a solution. If it is not possible to grant us access to your application, please take a Fiddler trace and attach it to a support ticket in a zip file. You can capture a Fiddler trace using FiddlerCap.

    Hope to hear from you soon. 

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Arnout
    Arnout avatar
    4 posts
    Member since:
    Mar 2013

    Posted 23 Aug 2013 Link to this post

    Hello Boyan,

    First of all, thanks for the help. I found the answer to the problem: it wasn't anything you recommended I'd try, but frankly I didn't provide you with the information necessary to figure it out. The problem was this little piece of code I've been using a lot to click on HTML elements without using XPath or ID, but using textcontent:

    HtmlSpan a = Find.ByExpression<HtmlSpan>("innertext =abcdef");
    a.Click(true);

    I found out that if you provide HtmlControl.Click with true, apparently the steps following that coded step no longer wait for the browser to be ready. Because this coded step is about 5 steps earlier than the step that actually caused the dreaded alert box to appear, it simply didn't occur to me to suspect it at first.

    Consequently the problem disappeared when changing all these back to 'false'. On second consideration, it is not even necessary to provide it with a boolean value, it works fine on its own, so now I'm using the 'clicks' with just empty brackets.

    Kind regards,

    Arnout

    EDIT: One could wonder why I'd always use false, and suddenly started using 'true', or why I'd use a boolean value at all. As I have very little knowledge of C# and coded steps like these were made for me by others, I simply re-type these from memory, and apparently accidentally thought it needed a 'true' instead of a 'false'. I'm not quite sure what the difference is tbh.
  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1043 posts

    Posted 28 Aug 2013 Link to this post

    Hello Arnout,

    I am really happy to hear that you have resolved the problem.

    The bool between the brackets is for invoking a click on the HtmlControl that will cause its browser to close (this is common for html pop-ups). If it is set to true, Test Studio won't wait for the browser to be ready. If not set it acts the same as HtmlControl.Click().

    That's was the reason of your issue.

    If you need further help, please do not hesitate to contact us.

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top