Avoid the Timeout Exception if iframe element not found

2 posts, 0 answers
  1. Satya
    Satya avatar
    1 posts
    Member since:
    Jan 2012

    Posted 17 Sep 2012 Link to this post


    The default behavior of Test Studio and the Telerik Testing Framework is to time out after a certain interval if the element is not found. 

    I would like to avoid the Timeout Exception and perform a different set of steps depending on whether the element is found. My application does not use silverlight.
    I have checked the Telerik help document , Change Silverlight Find Strategy, but i think  it is applicable for only Silverlight applications.

    Below is the code snippet which i want to perform if the 'MS2007AboveRadio' check box on the iframe is found. To avoid Timedout Exception if the element is not found, i have placed it in the try catch block. Tried the if else condition aswelll, but it gets timedout.

        Pages.application.FrameFrame1.MS2007AboveRadio.Check(true, true);

    Please suggest me better way to do it. Do we have something like Find Strategy for a c#.net application.

  2. Plamen
    Plamen avatar
    8 posts

    Posted 19 Sep 2012 Link to this post

    Hi Satyajeet,

    I am sorry, but this is our current implementation. When referencing an element from the Repository via the Pages class, if the element is found it will return the element, if it's not it will throw an exception.
    There is an existing feature request to implement a functionality similar to the Silverlight Find Strategy for Html. You can vote for the PITS Issue here: Public URL.

    In the meantime, please read this article on how to overcome the problem. 

    There is also a way to do this in code. You can search for the element first and then check whether the element is found. Here's a sample code:
    HtmlButton button = ActiveBrowser.Find.ByContent<HtmlButton>("Search");
    if (button != null)
        Log.WriteLine("'Search' button exists!");
        Log.WriteLine("'Search' button doesn't exist!");

    Please give it a try and let me know if you need further assistance on this.
    All the best,
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top