Hi,
My script is not able to locate a Silverlight control which is inside a RadPanel and it throws Out of bound exception. Here are the steps:
1. I perform a few steps like loading the application, login and other things which are working fine.
2. I scroll the RadPanel to top of the page and then click it. This expands the RadPanel and here is when the Silverlight Application is loaded. You can now see a Silverlight Hyperlink button. Screenshot name “Step 2”.
3. When I click on the Hyperlink “AddDocumentlink..” the action is recorded and when I try to run the script it doesn’t click this hyperlink and an exception is seen.
The code that is recorded is:
[CodedStep(@"Click AddDocumentLinkHyperlinkbutton", RequiresSilverlight=true)]
public void AddProduct_CodedStep2()
{
// Click AddDocumentLinkHyperlinkbutton
Pages.RoadmapGetOnTheMap3.SilverlightApp.AddDocumentLinkHyperlinkbutton.User.Click();
}
Error Message: Exception thrown executing coded step: '[AddProduct_CodedStep2] : Click AddDocumentLinkHyperlinkbutton, RequiresSilverlight=True'.
Exception is:
ArtOfTest.Common.Design.Exceptions.ExecutionException: Exception thrown executing coded step: '[AddProduct_CodedStep2] : Click AddDocumentLinkHyperlinkbutton, RequiresSilverlight=True'. ---> System.InvalidOperationException: Point (223, 1027) outside bounds of browser window: (0, 140, 1366, 565)
at ArtOfTest.WebAii.Silverlight.UserInteraction.ValidateMouseLocationIfNeeded(Point point)
at ArtOfTest.WebAii.Silverlight.UserInteraction.Click(MouseClickType clickType, Point offsetPoint, OffsetReference reference)
at ArtOfTest.WebAii.Silverlight.UserInteraction.Click()
at BgRoadmap.AddProduct.AddProduct_CodedStep2() in d:\WebUI Automation\BgRoadmap\AddProduct.aii.cs:line 188
--- End of inner exception stack trace ---
at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.InternalExecuteSteps(AutomationStepList stepList, TestResult testResult, Object codeBehindInstance)
Please let me know how can I resolve this. Thanks, Mithul.
15 Answers, 1 is accepted
I am able to click the Silverlight Hyperlink button using this line of code:
Pages.RoadmapGetOnTheMap0.SilverlightApp.OwnerApp.Find.ByAutomationId("AddDocumentLink").User.Click();
But the script is not able to find the element with the below line of code which is auto generated by the WebUI tool.
Pages.RoadmapGetOnTheMap0.SilverlightApp.AddDocumentLinkHyperlinkbutton.User.Click();
I have a work around for this problem but however I would like to know if there is something wrong that I was doing or something wrong with the way WebUI was finding the "AddDocumentLinkHyperlinkbutton" element and performing the user click action.
Your response would be highly appericated. Please reply. Thanks,
Regards,
Mithul.
Hi Mithul,
The best code to use for this setup would be:
ActiveBrowser.SilverlightApps()[0].Find.ByAutomationId(
"AddDocumentLink"
).User.Click();
Instead of the working line you provided. This is the more direct way of calling the SL control. Regarding why this isn't working correctly for the original step, we would need to see a copy of the definition within Pages.g.cs (or Pages.g.vb if you are using vb.net) for the object in question (AddDocumentLinkHyperlinkbutton). Can you provide us with a copy of this to review?
Kind regards,
Keaegan
the Telerik team
Thanks for your reply. Yes what you suggested you be the right way provided if this is the first SL application in my web page. I would change
ActiveBrowser.SilverlightApps()[0] value to ActiveBrowser.SilverlightApps()[1] or [2] depending on the SL application number.
However I will share the Pages.g.cs with you once I am at my work place. To make you understand this issue in a better way, I can give you remote access to my desktop if you have got TeamViewer software at your end and we can talk on call or gtalk at your convenient time.
Please let me know when will you have some free time to look into this issue. Thanks,
Regards,
Mithul.
9885561190.
Please find the pages.g.cs file in the attachment. Do let me know incase you need any further information from me. Thanks,
Regards,
Mithul.
+91-9885561190.
Thank you for sending us your Pages file. I took a look and don't see anything obvious. I am curious what would happen if you tried using this like of code instead:
Pages.HttpDemosTelerik.SilverlightApp.OwnerApp.Find.ByExpression(
new
XamlFindExpression(
"XamlTag=hyperlinkbutton"
,
"AutomationId=AddDocumentLink"
)).User.Click();
That is functionally equivalent to:
RoadmapGetOnTheMap0.SilverlightApp.AddDocumentLinkHyperlinkbutton.User.Click();
Is your website publicly available? Can we access it to have a look at this situation? Regards,
Cody
Yes what you mentioned is correct. Both the lines of code should work the same way but unfortunately this is not happening at my end. I am sorry that this app is not available to public but I can show you the behaviour by providing you remote access to my desktop through TeamViewer software.
If you can let me know any convenient time we can have a look at this. Thanks,
Regards,
Mithul.
9885561190.
Did you try the last line of code I sent you? Did it find the element? To summarize we have three lines of code in question:
Pass/Fail? - Pages.HttpDemosTelerik.SilverlightApp.OwnerApp.Find.ByExpression(new XamlFindExpression("XamlTag=hyperlinkbutton", "AutomationId=AddDocumentLink")).User.Click();
Pass - Pages.RoadmapGetOnTheMap0.SilverlightApp.OwnerApp.Find.ByAutomationId("AddDocumentLink").User.Click();
Fail - Pages.RoadmapGetOnTheMap0.SilverlightApp.AddDocumentLinkHyperlinkbutton.User.Click();
Cody
Sorry, I was Out of Office for last two days and hence could not try this out. Yes, the last line of code that you have sent worked out. I could find the element and it performed the required action on it. So here is the summary of the lines of code:
Pass - Pages.HttpDemosTelerik.SilverlightApp.OwnerApp.Find.ByExpression(new XamlFindExpression("XamlTag=hyperlinkbutton", "AutomationId=AddDocumentLink")).User.Click();
Pass - Pages.RoadmapGetOnTheMap0.SilverlightApp.OwnerApp.Find.ByAutomationId("AddDocumentLink").User.Click();
Fail - Pages.RoadmapGetOnTheMap0.SilverlightApp.AddDocumentLinkHyperlinkbutton.User.Click();
I work in IST time zone which is GMT +5:30 from 9:00AM to 7:00PM. I am free on any day and if this time is odd then I can stay late in office and we can work this out. Please schedule a meeting at your convenient time and let me know. Thanks,
Regards,
Mithul.
+91-9885561190.
I have emailed you a meeting invite for Monday next week. Check the time in the invite and let me know if you can work with that.
Kind regards,Cody
As requested in the meeting, the attached are the DOM Tree of the complete page and the documents panel in two seperate files. Hope this helps you in bebugging the issue. Thanks,
Regards,
Mithul.
Thank you for the files. I have included with bug report 105686. Now we just need to figure out how to repro this problem in-house before we can get to the root cause and fix it.
Best wishes,Cody
Any updates on this?
I'm getting same error on my silverlight application too. Please see attached video/screenshots. Trying to click on "Field Chooser", but no luck. Using 2013.2.1219.0 standalone version.
Failure Information:
~~~~~~~~~~~~~~~
Exception thrown executing coded step: '[Selection_Field_Chooser_on_Portfolio_Holdings_CodedStep] : Coded Step'.
InnerException:
System.InvalidOperationException: Point (1073741824, 1073741824) outside bounds of browser window: (0, 53, 1280, 943)
You might need to maxmize the browser while running this test. Try adding the following code in a coded step: ActiveBrowser.Window.Maximize();
at ArtOfTest.WebAii.Silverlight.SilverlightApp.ValidateMouseLocation(Point point)
at ArtOfTest.WebAii.Silverlight.UserInteraction.Click(MouseClickType clickType, Point offsetPoint, OffsetReference reference)
at ArtOfTest.WebAii.Silverlight.UserInteraction.Click(MouseClickType clickType)
at CodedStepsProj.Selection_Field_Chooser_on_Portfolio_Holdings.Selection_Field_Chooser_on_Portfolio_Holdings_CodedStep() in C:\TrunkBuildScripts\HoldingBrowserVsCashBrowser_Vrfy\Sub Actions\Selection Field Chooser on Portfolio Holdings.tstest.vb:line 46
Piece of code:
Public Sub Selection_Field_Chooser_on_Portfolio_Holdings_CodedStep()
ActiveBrowser.Window.Maximize()
Dim ClickOnFieldChooser As TextBlock = Pages.SentryAuditTrailSessions0.SilverlightApp0.GearDropDownPopupBorder.Find.ByTextContent("Field Chooser").[As](Of TextBlock)()
ClickOnFieldChooser.User.Click(MouseClickType.LeftClick)
End Sub
Thanks,
Madhu
I am sorry to hear you are experiencing this issue.
Without being able to see the problem first hand, it's hard to say for certain what you need to do to fix this problem. My first guess is you need to add a "Scroll to visible" step for the target element in failing test step. You can try with the following code:
Public Sub Selection_Field_Chooser_on_Portfolio_Holdings_CodedStep()
ActiveBrowser.Window.Maximize()
Dim ClickOnFieldChooser As TextBlock = Pages.SentryAuditTrailSessions0.SilverlightApp0.GearDropDownPopupBorder.Find.ByTextContent("Field Chooser").[As](Of TextBlock)()
ClickOnFieldChooser.ScrollToVisible()
ClickOnFieldChooser.User.Click(MouseClickType.LeftClick)
End Sub
If the issue persists please give us a direct access to the application so we can reproduce the problem on our end and give you a solution.
Hope to hear from you soon.
Regards,
Velin Koychev
Telerik
Test Studio Trainings
Any updates?
{"Point (1073741824, 1073741824) outside bounds of browser window: (0, 55, 1920, 1105)
You might need to maxmize the browser while running this test. Try adding the following code in a coded step: ActiveBrowser.Window.Maximize();"}
at ArtOfTest.WebAii.Silverlight.SilverlightApp.ValidateMouseLocation(Point point)
at ArtOfTest.WebAii.Silverlight.UserInteraction.Click(MouseClickType clickType, Point offsetPoint, OffsetReference reference)
at ArtOfTest.WebAii.Silverlight.UserInteraction.Click(MouseClickType clickType)
at ArtOfTest.WebAii.Silverlight.UserInteraction.Click()
at TelerikWebAutomation.Program.FirstTest(List`1 langInput)
What version of Test Studio do you use? You can try installing our latest internal build (1016) and give it a try.
You can download it from here.
You can also try adding scroll to visible step even it is visible on the screen, just for testing purposes.
Hope to hear from you soon.
Regards,
Boyan Boev
Telerik
Test Studio Trainings