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

Error with step: wait for text 'content' 'Contains' 'xxx text -> System.Exception: Unable to find the target host (Browser/SilverlightApp) to locate an element

2 Answers 156 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jari Jämsä
Top achievements
Rank 1
Jari Jämsä asked on 28 Apr 2010, 11:42 AM
Hi,

i am trying trial version of WebUI test developer edition with Vs 2010 premium, win 7 and ie8.

I found interesting bug or feature when you save next step: wait for text 'content' 'Contains' 'xxx text' on 'SpanElement'

This was working me earlier yesterday, but suddenly it stop working. I did try to create step again, i did try to create whole test again, in different test, add more timedelay, everything what come to my mine..

Anyway i found one trick which solve this "in uggly way". If i add: wait for exist 'same span element what causes error' before wait for text 'content'... its work fine. Strange.

Otherwice i like very much your product, i hope you can help me with this.

Best regard, Jari Jämsä

Error message below:

Unhandled exception thrown during automation step execution
InnerException:
System.Exception: Unable to find the target host (Browser/SilverlightApp) to locate an element. Failure: ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
InError set by the client. Client Error:
System.IndexOutOfRangeException: Current frame index '7' is out of range of current frames count '7'
   at ArtOfTest.InternetExplorer.IECommandProcessor.SetTargetDocument(BrowserCommand& request, IHTMLDocument2 document)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Information',Info:'DocumentMarkup',Action:'NotSet',Target:'null',Data:'',ClientId:'Client_a6ca581e-5ee5-49f0-b1a2-44af83341ef2',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'7',InError:'True',Response:'System.IndexOutOfRangeException: Current frame index '7' is out of range of current frames count '7'
   at ArtOfTest.InternetExplorer.IECommandProcessor.SetTargetDocument(BrowserCommand& request, IHTMLDocument2 document)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.

   at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
   at ArtOfTest.WebAii.Core.Browser.RefreshDomTree()
   at ArtOfTest.WebAii.Core.FramesCollection.get_Item(FrameInfo frameInfo)
   at ArtOfTest.WebAii.Design.Execution.ExecutionUtils.GetFrameBrowserInstance(Browser topBrowser, FrameInfo frame, String& stringError)
   at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep()

2 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 28 Apr 2010, 04:16 PM
Hello Jari Jämsä,

It sounds like somehow the cached copy of the DOM contained in the framework is out of sync with the actual DOM in the browser. This can happen when an Ajax postback event happens and updates the DOM in the background. There's no notification to the framework that the DOM has changed (in your case a new IFrame was added... IFrame index 7 according to the exception message). The "Wait For Exist" step you added has the side effect of refreshing the local cached DOM copy.

You can achieve the same effect by adding a code behind step that manually refreshes the DOM. The code would look like this:

[CodedStep("Manually refresh cached copy of DOM")]
public void RefreshDOM()
{
    ActiveBrowser.RefreshDomTree();
}

Add this code behind step just before your "wait for text content" step. Let me know if that helps.

Regards,
Cody
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jari Jämsä
Top achievements
Rank 1
answered on 29 Apr 2010, 01:16 PM
Thanks Cody, this"ActiveBrowser.RefreshDomTree();" works perfect.

Best regards, Jari Jämsä
Tags
General Discussions
Asked by
Jari Jämsä
Top achievements
Rank 1
Answers by
Cody
Telerik team
Jari Jämsä
Top achievements
Rank 1
Share this question
or