Page 1 of 1

How to horizontal scroll to locate specific text

Posted: Fri Apr 27, 2012 12:02 am
by Neel72
I have silverlight application for which I am automating the test. I have recognized the Text obejct which I need to click to launch next screen.Manual step is I can use the hoprizontal scroll button to locate the required text and then click on it.
I want to automate this step, requrired Text is not available in the same location every run , so how should I use automation to acheive this task.
Need help as its an urgency. :roll:

Re: How to horizontal scroll to locate specific text

Posted: Fri Apr 27, 2012 4:12 pm
by Ciege
I've not done any Silverlight, but have done the same with a standard .NET app.
What you may try it to get the current X/Y coordinates for the element you want to click. Also get the rectangle coordinates for the display portion of the AUT. After some math you can test if the X/Y of the element is outside the bounds of the AUT visible rectangle. If so... scroll the AUT until the X/Y of the element is within the boundary of the AUTs window.

Re: How to horizontal scroll to locate specific text

Posted: Fri Apr 27, 2012 6:24 pm
by Neel72
Ciege,
I liked the solution, please review the attached scree shot and let wchih of these show the X and Y co-ordinates.

Thanks

Re: How to horizontal scroll to locate specific text

Posted: Fri Apr 27, 2012 7:03 pm
by Ciege
Expand the Location and ScreenLocation properties and you should see an X and a Y property.

Location = the X/Y location within the AUT
ScreenLocation = the absolute X/Y location to the screen

You can also check the Visible property to tell if the element is visible or not.

In your case the element IS visible. It is located at 54,18 in respect to the AUT window and 1357,457 in respect to the screen.

Re: How to horizontal scroll to locate specific text

Posted: Fri Apr 27, 2012 7:18 pm
by Neel72
Thanks that Helps :D