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

Unable to find the target host (Browser/SilverlightApp) to locate an element. Failure: Waiting for frame

8 Answers 330 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Avinash
Top achievements
Rank 1
Avinash asked on 03 Jan 2013, 08:19 AM
I am using the trial edition of TeleikTest Studio 2012.2.1204.0 with Firefox 17.0.1 in windows 7. There is a key Iframe and tabbed target iframes. The error log is as follows.

Overall Result: Fail
------------------------------------------------------------
'03-01-2013 12:48:39' - Using .Net Runtime version: '4.0.30319.269' for tests execution.
'03-01-2013 12:48:39' - Starting execution....
'03-01-2013 12:49:02' - Detected custom code in test. Locating test assembly: SubjectLookup.dll.
'03-01-2013 12:49:02' - Assembly Found: C:\Users\avvenn\Desktop\SubjectLookup_Old\bin\SubjectLookup.dll
'03-01-2013 12:49:02' - Loading code class: 'SubjectLookup.Subject_Test_2'.
------------------------------------------------------------
------------------------------------------------------------
'03-01-2013 12:49:02' - Enabling Html Popup Tracker. Test expecting Popups.
'03-01-2013 12:49:02' - Using 'FireFox' version '17.0.1' as default browser. 
'03-01-2013 12:49:11' - LOG: Unexpected dialog encountered. Taking no action.
'03-01-2013 12:49:11' - LOG: Unexpected dialog encountered. Taking no action.
'03-01-2013 12:49:14' - 'Pass' : 1. Navigate to : 'http://mytestapp/'
'03-01-2013 12:49:14' - 'Pass' : 2. Handle 'Logon' dialog.
'03-01-2013 12:49:16' - 'Pass' : 3. Navigate to : 'http://mytestapp/'
'03-01-2013 12:49:21' - 'Pass' : 4. Navigate to : 'http://mytestapp/Contoso/main.aspx'
'03-01-2013 12:49:21' - 'NotRun' : 5. Navigate to : 'http://mytestapp/Contoso/main.aspx'
'03-01-2013 12:49:21' - 'NotRun' : 6. Navigate to : 'http://mytestapp/Contoso/main.aspx'
'03-01-2013 12:49:26' - 'Pass' : 7. Wait for '5000' msec.
'03-01-2013 12:49:31' - 'Pass' : 8. Wait for '5000' msec.
'03-01-2013 12:49:36' - 'Pass' : 9. Wait for '5000' msec.
'03-01-2013 12:49:37' - 'Pass' : 10. Click 'SettingsNobrTag'
'03-01-2013 12:49:38' - 'Pass' : 11. Click 'BusinessNobrTag'
'03-01-2013 12:49:39' - 'Pass' : 12. Click 'A10Link'
'03-01-2013 12:50:10' - 'Fail' : 13. Click 'AddASubjectLink'
------------------------------------------------------------
Failure Information: 
~~~~~~~~~~~~~~~
Unable to find the target host (Browser/SilverlightApp) to locate an element. Failure: Waiting for frame '[Frame:id=ViewArea,name=ViewArea,src=http://mytestapp/subjectmanager/subjecteditor.aspx,UseQuery:False]' timed out. Error: Wait for condition has timed out
InnerException:
System.Exception: Unable to find the target host (Browser/SilverlightApp) to locate an element. Failure: Waiting for frame '[Frame:id=ViewArea,name=ViewArea,src=http://mytestapp/subjectmanager/subjecteditor.aspx,UseQuery:False]' timed out. Error: Wait for condition has timed out
   at ArtOfTest.WebAii.Design.Execution.ExecutionUtils.WaitForAllElements(IAutomationHost host, AutomationDescriptor descriptor, Int32 timeout)
   at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)
------------------------------------------------------------
'03-01-2013 12:50:10' - Detected a failure. Step is marked 'ContinueOnFailure=False' aborting test execution.
------------------------------------------------------------
'03-01-2013 12:50:10' - Overall Result: Fail
'03-01-2013 12:50:10' - Duration: [1 min: 8 sec: 337 msec]
------------------------------------------------------------
'03-01-2013 12:50:12' - Test completed!

this is working fine IE9 but failing in Firefox and Chrome(version 23.0.1271.97).

Then i worked on this problem,

Click on "AddASubjectLink " will open a model popup, now i removed the base url (according to one of the telerik solution which i find in this forum link for that solution is "http://www.telerik.com/automated-testing-tools/ClientsFiles/197551_framesettings.jpg") from the Frame in which AddASubjectLink is there, then this step passed but model popup was not opened. So now next step connecting to the popup is failing because popup was not opened on click of "AddASubjectLink".

.

8 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 04 Jan 2013, 01:50 PM
Hello Avinash,

I am sorry to hear you are experiencing this issue.

This is often due to a dynamic frame Id or Name. This is remedied by using the tilde (~) character to indicate a partial match. This can be used in the BaseURL, Id, and Name fields. If the Src string contains a dynamic query, set UseQuery to False.

Please follow this article in order to get more information about frames and what is causing this issue.

Also if you are using the BaseURL feature to test a page containing frames against multiple environments, see the bottom of this article for configuration instructions. 

Let me know if this helps. 

Regards,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Avinash
Top achievements
Rank 1
answered on 08 Jan 2013, 09:15 AM
Thanks for the reply Boyan Boev.


I have followed the article while i am recording the my Test case.

I don't have any frames with dynamic frame Id or name. I am working only on one URL so there is no "BaseURL feature" here,but still i am facing this problem. 

So i tried in different way like this:

Log.WriteLine("Test1");
HtmlSpan sp=Pages.ContactsMyActiveContacts.FrameViewArea2.Find.ByExpression<HtmlSpan>("tagname=span","textcontent=New"); 
Log.WriteLine("Test");

This line has thrown exception while running on Chrome and Firefox but it is working fine for IE9.

'08-01-2013 13:47:22' - Using 'Chrome' version '23.0.1271.97' as default browser. 
'08-01-2013 13:47:37' - 'Pass' : 1. Navigate to : 'http://mytestapp/'
'08-01-2013 13:47:37' - 'Pass' : 2. Handle 'Logon' dialog.
'08-01-2013 13:47:48' - 'Pass' : 3. Navigate to : 'http://mytestapp/'
'08-01-2013 13:48:10' - 'Pass' : 6. Click 'SettingsNobrTag'
'08-01-2013 13:48:40' - 'Pass' : 7. Click 'A04Link'
'08-01-2013 13:48:45' - 'Pass' : 8. Wait for '5000' msec.
'08-01-2013 13:48:45' - LOG: Test1
'08-01-2013 13:49:19' - 'Fail' : 9. [Test_1_CodedStep] : Click 'NewSpan'

------------------------------------------------------------
Failure Information: 
~~~~~~~~~~~~~~~
Exception thrown executing coded step: '[Test_1_CodedStep] : Click 'NewSpan''.
InnerException:
System.TimeoutException: Wait for condition has timed out
   at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
   at ArtOfTest.Common.WaitSync.For[T,V](Func`3 func, T target, V custom, Boolean invertCondition, Int32 timeout)
   at ArtOfTest.Common.WaitSync.For[T,V](Func`3 func, T target, V custom, Int32 timeout)
   at ArtOfTest.WebAii.Core.Browser.WaitForFrame(FrameInfo frameInfo, Int32 timeout)
   at ArtOfTest.WebAii.Core.Browser.WaitForFrame(FrameInfo frameInfo)


Can please give some solution for this?

.
0
Avinash
Top achievements
Rank 1
answered on 08 Jan 2013, 02:55 PM
While i am fixing this issue i found that One IFrame is nested with another IFrame.
Like Below:

<IFrame1>
  <IFrame2>
  </IFrame2>
</IFrame1>

Here i am able to access the Parent IFrame elements but i am not able to access the elements in Child IFrame.

So how we can we handle these Nested IFrames?

0
Boyan Boev
Telerik team
answered on 09 Jan 2013, 03:15 PM
Hi Avinash,

This is again a WaitForFrame exception. Please double check again the name, id or src for some dynamic part.

If the problem persists please send us a copy of the project na give us a direct access to the application. We can run your tests against the application and reproduce the issue on our end. Once we've reproduced it it should be easy troubleshoot it.

You can send us a screen shot of the DOM tree also.

Another option is to send us a Fiddler trace using FiddlerCap.

Thank you for your cooperation.

All the best,

Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Avinash
Top achievements
Rank 1
answered on 18 Jan 2013, 12:14 PM
I followed the article and i used tilde (~) character to indicate a partial match but it was not worked for me.

So Here i tried different code this worked for me:

Browser br1 = Manager.Current.Browsers[0].Frames.ById("IFrame1");
Log.WriteLine("Iframes Before Refreshing DOM: " + Manager.Current.Browsers[0].Frames.Count.ToString());
br.RefreshDomTree();
ActiveBrowser.RefreshDomTree();
Log.WriteLine("Iframes After Refreshing DOM: " + Manager.Current.Browsers[0].Frames.Count.ToString());
Browser br2 = Manager.Current.Browsers[0].Frames.ById("IFrame2");   
HtmlSpan sp=br2.Find.ByExpression<HtmlSpan>("tagname=span","textcontent=New");
sp.Click();

If we see the log for above code,  before refreshing the DOM of the First IFrame there are only one IFrame in Browser after refreshing the IFrame1 there are 2 IFrames in Browser. So now i am able to access the elements in second IFrame. For Reference see the bold lines in below log: 

'18-01-2013 17:12:43' - Using 'Chrome' version '24.0.1312.52' as default browser. 
'18-01-2013 17:12:50' - 'Pass' : 1. Navigate to : 'http://mytestapp/'
'18-01-2013 17:12:53' - 'Pass' : 2. Wait for '3000' msec.
'18-01-2013 17:12:55' - 'Pass' : 3. Handle 'Logon' dialog.
'18-01-2013 17:12:58' - 'Pass' : 4. Navigate to : 'http://mytestapp/'
'18-01-2013 17:13:02' - 'Pass' : 7. Click 'Settings'
'18-01-2013 17:13:09' - 'Pass' : 8. Click 'Sub'
'18-01-2013 17:13:12' - 'Pass' : 9. Wait for '3000' msec.
'18-01-2013 17:13:12' - 'NotRun' : 10. Click 'NewSpan'
'18-01-2013 17:13:12' - LOG: Iframes Before Refreshing DOM: 1
'18-01-2013 17:13:12' - LOG: Iframes After Refreshing DOM: 2

'18-01-2013 17:13:16' - 'Pass' : 11. [InnerFrame_CodedStep] : Click 'NewSpan'
'18-01-2013 17:13:16' - 'Pass' : 12. Connect to pop-up window : 'http://mytestapp/Cont/tools/mangage/edit.aspx'
'18-01-2013 17:13:17' - 'Pass' : 13. Close pop-up window : 'http://mytestapp/Cont/tools/manage/edit.aspx'

To click the new button(Step "Click 'NewSpan'")i have customized the code But can i find the elements in second iframe without any code customization?
0
Boyan Boev
Telerik team
answered on 21 Jan 2013, 04:53 PM
Hi Avinash,

I am happy to hear you were able to resolve the issue.

Yes, after refreshing the DOM Test Studio should find and click on that element with a regural record without any problems.

Kind regards,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Avinash
Top achievements
Rank 1
answered on 22 Jan 2013, 04:56 AM
Hi Boyan,

Still i did not found the answer, when ever i want to access the elements of second IFrame i have customize the code every time but i don't want to do that every time.

So can i find the elements in second IFrame without any code customization? OR customizing the code once so that i can access the elements of second IFrame directly from next time?



0
Boyan Boev
Telerik team
answered on 23 Jan 2013, 12:51 PM
Hello Avinash,

An option is to add WaitForExists step on the element you want to access in the second frame.

If it doesn't help you will need to add "ActiveBrowser.RefreshDomTree();" so that the second frame appears. Once it appears in the DOM you will be able to perform any actions.

Kind regards,
Boyan Boev
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Avinash
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Avinash
Top achievements
Rank 1
Share this question
or