RX path - get by WinForm elem name

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
kOoO
Posts: 25
Joined: Wed Oct 17, 2018 11:15 am
Location: Zlin, CR

RX path - get by WinForm elem name

Post by kOoO » Tue Feb 23, 2021 3:34 pm

Hi,

In web environment, you can get element name using "tagname" like this:
tag[@tagname='table' or @tagname='div']

What is the equivalent for WinForms elements? For example I have a "text" element with rxpath "text" and want to rewrite rxpath as *[@someattr='text']. I just can't find the correct attribute name.

Can I somehow use the preffered capability/role in RXpath?

manish
Posts: 51
Joined: Fri Aug 10, 2018 12:46 pm

Re: RX path - get by WinForm elem name

Post by manish » Wed Feb 24, 2021 10:08 am

Hi,

It is really difficult to guess anything here without a snapshot of the problematic element. Winforms work in generally the same way as other UI elements. You have to use the SPY to check the predicates for rxpath.

One suggestion would be something like

Code: Select all

/form[@title='form title']/.//tagname[@text='your text']
You could also check for attributes under Control or Accessible capabilities in SPY to get the correct attribute for your issue.

In any case, yould you post the Rx snapshot of the winform that you want the xpath for?

Thanks
Manish

kOoO
Posts: 25
Joined: Wed Oct 17, 2018 11:15 am
Location: Zlin, CR

Re: RX path - get by WinForm elem name

Post by kOoO » Wed Feb 24, 2021 2:02 pm

Hi, there is no snapshot and no problematic element. This is more like general question about technology specific object identification.

I will try to give better example: I want to select a element that can be either a "Button" or a "Form". So, I want to write a RX path, that would look something like this:

*[@elementname='Button' or @elementname='Form']

Problem is the highlighted part - "elementname" is not valid attribute name and I don't know what attribute name, that I can put in RX path, corresponds to the element name (Button, Form, Menubar .....). Question is, what should I put instead of the "elementname"?

This is what I am trying to get:
rxxxx1.png
rxxxx1.png (4.11 KiB) Viewed 24 times
And the next question was about whether and how to put advanced attributes (highlighted in attachment) from spy window into RX path. If I could somehow use the "Role->Name" attribute in RX path, that would solve my question 1.
Attachments
rxxx.png
rxxx.png (44.77 KiB) Viewed 26 times