Unable to consistently retrieve frame by ID

6 posts, 0 answers
  1. tsjax
    tsjax avatar
    8 posts
    Member since:
    Sep 2016

    Posted 26 Apr 2017 Link to this post

    Hello,

    I am having a problem with Manager.ActiveBrowser.Frames.ById() returns null intermittently. The conditions are as follows:

      var resultsFrameExpression = new HtmlFindExpression("tagname=iframe", "id=searchResultsFrame");        

      browser.WaitForElement(resultsFrameExpression, 60000, false); // Successfully returns

      browser.RefreshDomTree();

    -!!->  resultFrame = browser.Manager.ActiveBrowser.Frames.ById("searchResultsFrame");

    Most of the time, resultFrame comes back with a valid result. Sometimes it comes back as null. If there is even a 10 second delay before calling RefreshDomTree() and trying again, it still occurs with about the same frequency. (My assumption was that there may have been a timing issue between WaitForElement()'s successful return before being able to access the element that it successfully claims exists, but this is not the case either.

    Any insight as to what I am doing wrong here would be appreciated.

     

    Thanks for your help

     

  2. tsjax
    tsjax avatar
    8 posts
    Member since:
    Sep 2016

    Posted 27 Apr 2017 Link to this post

    This isn't a "reply", just more detailed information:

     

    When things fail, the frame exists as an accessible element:

    this.ThisFrame.Find.ById("searchResultsFrame")
    {[Element: 'iframe:0' (id=searchResultsFrame)]}
        AbsoluteSiblingTagIndex: 0
        AbsoluteTagIndex: 71
        Attributes: Count = 5
        ChildNodes: Count = 1
        Children: Count = 0
        Content: "<iframe width=\"100%\" height=\"400\" id=\"searchResultsFrame\" src=\"blah">"
        CssClassAttributeValue: ""
        Data: ""
        Depth: 11
        ElementType: IFrame
        FindExpressionUsed: {[id 'Exact' searchResultsFrame]}
        FindObjectUsed: {ArtOfTest.WebAii.Core.Find}
        FindParamsUsed: {ArtOfTest.WebAii.ObjectModel.FindParam[1]}
        FrameElement: null
        HasIdOrName: true
        Host: {ArtOfTest.WebAii.Core.Browser}
        IdAttributeValue: "searchResultsFrame"
        InnerMarkup: ""
        InnerText: ""
        InputElementType: NotSet
        IsBeginTag: true
        IsEndTag: false
        IsProxy: false
        IsSelfClosing: false
        IsTestRegion: false
        MatchingClosingTag: {[Element: 'iframe:-1']}
        NameAttributeValue: ""
        OuterMarkup: "<iframe width=\"100%\" height=\"400\" id=\"searchResultsFrame\" src=\"blah"></iframe>"
        OwnerBrowser: {ArtOfTest.WebAii.Core.Browser}
        Parent: {[Element: 'td:20']}
        ParsedElement: {<iframe width="100%" height="400" id="searchResultsFrame" src="blah" style="height: 1075px;">}
        ParsingType: Markup
        TagName: "iframe"
        TagNameIndex: 0
        TechnologyType: Html
        TextContent: ""
        Wait: {ArtOfTest.WebAii.Synchronization.Wait}

    But it claims it has no frames:
    this.ThisFrame.Frames
    Count = 0

    Requesting the frames from the parent-most browser also does not include it:
    this.CrmMain.Frames
    Count = 2
        [0]: {[Frame_0, ArtOfTest.WebAii.Core.Browser]} // which is Frame:id=frame-scale,name=Frame_0
        [1]: {[Frame_1, ArtOfTest.WebAii.Core.Browser]} // which is FrameInfo: Frame:id=Main,name=Frame_1 ("this.ThisFrame")

    There should be three, though. It is nested within Frame[1] (which is what this.ThisFrame above refers to).
    Sidenote: I believe that the missing frame is part of the same pageload (loads with and at the same time - no AJAX) with its parent, Frame_1 (this.ThisFrame), when it is loaded.

  3. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    308 posts

    Posted 01 May 2017 Link to this post

    Hi Travis,

    This problem seems to be an odd one. To be able to investigate it could you provide a test project for sample public accessible app that reproduces it, please? 

    Kind Regards,
    Nikolay Petrov
    Telerik by Progress
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  4. tsjax
    tsjax avatar
    8 posts
    Member since:
    Sep 2016

    Posted 01 May 2017 in reply to Nikolay Petrov Link to this post

    Hello Nikolay,

    I was playing around with this some more on Friday and I was able to get it working consistently (so far).  I am not refreshing the DOM of the top-most browser rather than the one that technically holds the iframe I was seeking. I understand that Telerik holds all the iframes "flattened" in the top-level browser and even if the DOM one level in that has a child iframe is refreshed, this will have no effect on the top-most browser's frame list of that third generation iframe even though the frame is accessible as an element from its parent's browser.

  5. tsjax
    tsjax avatar
    8 posts
    Member since:
    Sep 2016

    Posted 01 May 2017 in reply to tsjax Link to this post

    correction: "I am _now_ refreshing..."
  6. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    308 posts

    Posted 03 May 2017 Link to this post

    Hi Travis,

    Thank you for your feedback on the case.

    Best Regards,
    Nikolay Petrov
    Telerik by Progress
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top