Adding Size setting to Xpath

Ask general questions here.
965702
Posts: 11
Joined: Fri Dec 21, 2018 9:49 am

Adding Size setting to Xpath

Post by 965702 » Fri Dec 21, 2018 9:54 am

Hello Guys

I am trying to narrow down the insrtances Ranorex is locating a container. Currently it is finding 8 instances but I only want a certain one. The current Xpath is as follows:

/form[@title~'-']/element[@class='AfxMDIFrame100']//container[@instance='0']

I tried adding an extra instance to the end:

/form[@title~'-']/element[@class='AfxMDIFrame100']//container[@instance='0'] [8]

But when the system changes to another sector (I work on Air Traffic Systems) the instance simply couldn't be seen.

My question; is there a way we can add the size to the Xpath as this is unique?

Thanks in advance

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4532
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Adding Size setting to Xpath

Post by odklizec » Fri Dec 21, 2018 10:09 am

Hi,

Could you please upload a Ranorex snapshot (NOT screesnhot) of the app under test? This would greatly help us to find a best way, how to specify the xpath for your particular element.

Generally speaking, it should be possible to add a width/height and x/y coordinates of desired element to the xpath. This information just got lost in new Ranorex User guide. Check for example this post:
rawtext-based-off-location-t12938.html#p51785
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

965702
Posts: 11
Joined: Fri Dec 21, 2018 9:49 am

Re: Adding Size setting to Xpath

Post by 965702 » Fri Dec 21, 2018 10:41 am

Thanks for the response.

The SIZE of the instance is 585,67 I'm not sure how to insert this as i dont want to edit the form only the container:

/form[@title~'-']/element[@class='AfxMDIFrame100']//container[@instance='0']

I'm not at work so cant upload just yet.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4532
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Adding Size setting to Xpath

Post by odklizec » Fri Dec 21, 2018 10:46 am

Hi,

Unfortunately, without snapshot, I can only guess the xpath ;) You can try something like this:
/form[@title~'-']/element[@class='AfxMDIFrame100']//container[@instance='0' and (width()=585 and height()=67)]
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

965702
Posts: 11
Joined: Fri Dec 21, 2018 9:49 am

Re: Adding Size setting to Xpath

Post by 965702 » Fri Dec 21, 2018 12:33 pm

Thats worked very much appreciated