Detecting load of an HTML page inside a Silverlight Content control

3 posts, 0 answers
  1. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 23 Oct 2011 Link to this post


    I am hoping you can help with me a couple of issues related to verification of HTML documents. 

    I am using TestStudio 2011.1.829.0 in a TFS-based test environment.  The application being tested is a Silverlight web application. 

    I am writing a test for an application feature that does the following:  User specifies parameters and invokes a command which results in an HTML document being generated dynamically and displayed in a window inside the application.  The window is a custom class derived from System.Windows.Controls.ContentControl.  It shows up in the DOM of the Silverlight application and I am able to detect that it is displayed.

    Here are the issues that I am trying to resolve:
    a) HTML document generation takes a while and so there is a delay between the window displaying and the document displaying inside it.  So the test needs to wait until the page is loaded in the window and then verify that the correct document was loaded by verifying some of its content.  I am trying to find a reliable way to detect that the document has been fully loaded and being displayed in the window - I am trying to do this by trying to detect the existence of specific text strings in the document.

    b) The test needs to run against multiple test environments on which the application is deployed - each of these environments has a different URL which don't have anything in common between them.  Here are a few examples:  http://server1:10/, https://server2/, https://server:89/ .  So the wait and verification statements cannot be dependent on the environment on which it was recorded.

    I have tried the following:

    a) Directly recording a wait statement based on a field inside the HTML document.  This works if the test runs against the environment in which it was recorded - but does not work on other environments (test fails on the wait statement).  This is unlike statements recorded with Silverlight controls - which can be recorded on one environment but work on all environments.

    b) Coded steps using the HtmlWait class.  The following code shows what I have tried - the Find for "form1" returns a valid value but the other two Find statements return null resulting in an unhandled exception on the next statement.



    CodedStep(@"Wait for Exists 'PatientTableCell'")]

    public void LoginAsAdministratorAndPreviewReport_CodedStep()


    HtmlForm ReportViewerForm = Find.ById<HtmlForm>("form1");

    HtmlDiv div = Find.ByName<HtmlDiv>("MainReportViewer_ReportViewer?");

    HtmlWait waitObj = div.Wait;


    HtmlTable ReportViewerOuterTable = Find.ByTagIndex<HtmlTable>("table", 0);  


    //HtmlTableCell patientTableCell = ReportViewerForm.Find.ByContent<HtmlTableCell>("Patient Demographic");

    //// Wait for Exists 'PatientTableCell'



    Any suggestions on how I can accomplish what I need?  Let me know if you need further information.


  2. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 25 Oct 2011 Link to this post

    Any thoughts on this?

  3. Anthony
    Anthony avatar
    19 posts

    Posted 26 Oct 2011 Link to this post

    Hello Shashi,

    I apologize in the delay getting back to you.

    What you describe in point A sounds like a Frame issue. Is the HTML portion nested within a frame? The behavior matches because Test Studio must locate the frame (in part based on Src) before it can locate an element within it. That sounds like why the original recording environment works, yet subsequent ones do not.

    If it is a frame, use our BaseURL feature to switch between environments and ensure the frame's UsesBaseUrlHost property is set to True. This could also explain your difficulty in point B. You'll need to access the frame in code first as well.

    Of course, this is merely speculation based on the information provided and the symptoms described. Admittedly your application setup is unique and not something we typically see. We'll need to access the app directly to definitively say what the issue is, either via remote access or a Fiddler Trace. You can submit that information via a support ticket which is confidential, unlike this forum.

    All the best,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top