Hi
I need coordinates for some objects, but when I spy on objects I cant not see anything for coordinates.
Is there a way for this in Ranorex ?
Thank,
Rastek.
How to get coordinates for an object ?
Re: How to get coordinates for an object ?
Use the repo object's element location or screenlocation properties. Location is relative to the parent element, while screenlocation is relative to the whole screen.
Code: Select all
MyRepoObject.Element.Location.X
MyRepoObject.Element.Location.Y
MyRepoObject.Element.ScreenLocation.X
MyRepoObject.Element.ScreenLocation.Y
Shortcuts usually aren't...
Re: How to get coordinates for an object ?
Could you help me, please?
code:
Error:
only assignment call increment decrement await and new object expressions can be used as a statement.
Please tell me how to write the code that does it right?
code:
Code: Select all
gridTravelOptRet.Element.Location.X;
gridTravelOptRet.Element.Location.Y;
gridTravelOptRet.Element.ScreenLocation.X;
gridTravelOptRet.Element.ScreenLocation.Y;
only assignment call increment decrement await and new object expressions can be used as a statement.
Please tell me how to write the code that does it right?
Re: How to get coordinates for an object ?
You need to set the value of a variable to the result of the element information...
Code: Select all
int locationX = gridTravelOptRet.Element.Location.X;
int locationY = gridTravelOptRet.Element.Location.Y;
int screenLocationX = gridTravelOptRet.Element.ScreenLocation.X;
int ScreenLocationY = gridTravelOptRet.Element.ScreenLocation.Y;
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: How to get coordinates for an object ?
You just right, but I can not locate the object with the parameters which. Because that are the coordinates of the screen, each screen has different coordinates.
I still have no solution to the problem when the object value changes over timer and do not follow a rule. Please, Could you help me?
I still have no solution to the problem when the object value changes over timer and do not follow a rule. Please, Could you help me?
Re: How to get coordinates for an object ?
I'm not sure what issue you are having now. Can you be a little more clear?
Are you wondering how to find the location of an object on different screens? You will need to get that at runtime when you visit that screen. If the "object values change overtime" I assume you mean the object moves and is never in the same place twice. In that case, again, you need to check the location of the object at runtime, you cannot store that value and expect it to work the same each and every time.
Are you wondering how to find the location of an object on different screens? You will need to get that at runtime when you visit that screen. If the "object values change overtime" I assume you mean the object moves and is never in the same place twice. In that case, again, you need to check the location of the object at runtime, you cannot store that value and expect it to work the same each and every time.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: How to get coordinates for an object ?
My issue:
To day, 01-21-2015 .To begin creating a reservation with:
Form "FindingFlights"
[*]Depart date: +2 date compare to now date.
[*]Return date: +4 date compare to now date.
Form "SelectingFlights"
[*]Depart: select an object with value 16,U,O
[*]Return: select an object with value 21,U,O
But date 01-22-2015 I run again, that value has changes. I am wondering how to locate an object of "SelectingFlights" form.
Please,let me know any question for you to better my problem.
To day, 01-21-2015 .To begin creating a reservation with:
Form "FindingFlights"
[*]Depart date: +2 date compare to now date.
[*]Return date: +4 date compare to now date.
Form "SelectingFlights"
[*]Depart: select an object with value 16,U,O
[*]Return: select an object with value 21,U,O
But date 01-22-2015 I run again, that value has changes. I am wondering how to locate an object of "SelectingFlights" form.

Please,let me know any question for you to better my problem.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to get coordinates for an object ?
Hi ViMac,
It would help a log if you could post a Ranorex Snapshot from your application and a detailed description. If you have already a Ranorex Solution it would also be great if you could provide your solution.
Unfortunately it is very difficult to help you solving your issue with the given information.
Regards,
Bernhard
It would help a log if you could post a Ranorex Snapshot from your application and a detailed description. If you have already a Ranorex Solution it would also be great if you could provide your solution.
Unfortunately it is very difficult to help you solving your issue with the given information.
Regards,
Bernhard
Re: How to get coordinates for an object ?
The problem I am having is that the value of the option changes through each day (attached below). I would like to locate and select one of them, but the option to change every day, it's not supposed to change. Suddenly, I have a solution is to use the function if .... else.
EX:
var gridTravelOptDep = repo.CMAReservationsSiteSearchFlights1.GridTravelOptDep;
if(gridTravelOptDep.Value =="6,U,O"){
gridTravelOptDep.Focus();
gridTravelOptDep.Click();
}
else if(gridTravelOptDep.Value =="7,U,O"){
gridTravelOptDep.Focus();
gridTravelOptDep.Click();
}
else if(gridTravelOptDep.Value =="10,R,O"){
gridTravelOptDep.Focus();
gridTravelOptDep.Click();
}
Please advise if that solution is okay?
EX:
var gridTravelOptDep = repo.CMAReservationsSiteSearchFlights1.GridTravelOptDep;
if(gridTravelOptDep.Value =="6,U,O"){
gridTravelOptDep.Focus();
gridTravelOptDep.Click();
}
else if(gridTravelOptDep.Value =="7,U,O"){
gridTravelOptDep.Focus();
gridTravelOptDep.Click();
}
else if(gridTravelOptDep.Value =="10,R,O"){
gridTravelOptDep.Focus();
gridTravelOptDep.Click();
}
Please advise if that solution is okay?
You do not have the required permissions to view the files attached to this post.
Re: How to get coordinates for an object ?
It seems to me you time would be best spent with your dev team to determine what the values mean, why and when they change so that you can accurately code for the different values of the radio buttons. Blindly coding a bunch of if statements is not a reliable solution. What if you didn't code for the right value? What if multiple values appear that you have if's for?
In my not so humble opinion, you really should spend some time understanding how your AUT works so you know how to test it.
In my not so humble opinion, you really should spend some time understanding how your AUT works so you know how to test it.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...