How to access an element screenlocation in xpath.

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
QATest879
Posts: 31
Joined: Fri Jul 02, 2021 2:35 pm

How to access an element screenlocation in xpath.

Post by QATest879 » Thu Jan 06, 2022 5:37 pm

I am wondering how to access an element's "ScreenLocation" value from a repository XPath.

The end of my XPath looks like span/label[@element.screenlocation.y='588']

And when I run this Ranorex tells me that it failed to find the attribute. So I must be calling the attribute the wrong way, and I'm wondering how should I go about accessing the screen location. Does anybody know of any proper examples?

What I'm trying to do is create a repo item equal to the label located at 588, there should only be one.

Thank you.

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

Re: How to access an element screenlocation in xpath.

Post by odklizec » Mon Jan 10, 2022 8:02 am

Hi,

You can't use screenlocation in the xpath. However, there are some screen coordinate functions in the xpath. Check this User Guide chapter:
https://www.ranorex.com/help/latest/ran ... #Functions
So in your case, it should be like this:

Code: Select all

span/label[y()=‘588‘]
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