This is a migrated thread and some comments may be shown as answers.

Unable to find the elements in IFrame

1 Answer 124 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hamza
Top achievements
Rank 1
Hamza asked on 21 Jul 2015, 12:06 PM

I am trying to create a UI test for an ASP.NET web site hosted in SharePoint 2010 using Test Studio. I am using WS2008 and IE10 for testing.

I am having a problem while getting element within an iFrame. This iFrame is created dynamically on click a link and loaded within a HTML page under the current page.

 I think that the iFrame is not loaded in the DOM and this is why I am getting error while accessing elements in the iFrame.

Can you please provide me a way to access elements in the iFrame?

 PFB, the error I have got in the log file:

Unable to find the target host (Browser/SilverlightApp) to locate an element. Failure waiting for frane '[Frame:id=DlfFrame1bc2fae4-baa8-45e1-9331-88asdlaewrfkdj,name=Frame_2,src=http://contoso.com/_layouts/listform.aspx,UseQuery:False]' time out. Error: Wait for condition has timed out.

 Thank you in advance.

1 Answer, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 24 Jul 2015, 10:50 AM
Hello Hamza,

As I can see from the find expression the ID is dynamically generated and that's why Test Studio cannot find it.

Please remove the ID from the frame's find expression and give that a try.

See this article for further information.

If the issue persists please try also add this coded step before find the element/frame:

ActiveBrowser.RefreshDomTree();
ActiveBrowser.Frames.RefreshAllDomTrees();

Let me know if this helps.

Regards,
Boyan Boev
Telerik 
Tags
General Discussions
Asked by
Hamza
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Share this question
or