rxpath: get all deepest nodes

Ask general questions here.
User avatar
BMT
Posts: 22
Joined: Fri Jun 12, 2020 11:48 am

rxpath: get all deepest nodes

Post by BMT » Thu Oct 08, 2020 8:44 am

I have an complex xml document. What I need is to get all deepest nodes (I need their values actually).

Code: Select all

<root>
    <a>
        <b>text1</b>
        <c>text2</c>
    </a>
    <d>
        <e>
            <f>text3</f>
        </e>
    </d>
    <f>text4</f>
</root>
I want to get a list with "text1","text2","text3","text4" . Could you help me with rxpath expression? Thanks.
With xpath there is a possibility to get the most deepest node with this expression

Code: Select all

//*[not(*)]
But this expression doesnt work with ranorex. What Ive tried ist:

Code: Select all

IList<Ranorex.WebElement> cellsInActRow = actTableRows.Find<Ranorex.WebElement>("//*[not(*)]"); 
Image

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

Re: rxpath: get all deepest nodes

Post by odklizec » Thu Oct 08, 2020 10:13 am

Hi,

Unfortunately, Ranorex does not implement entire xpath specification. Therefore, many of the xpath expressions may not work in Ranorex. And I'm afraid, "Not" function is one of them. In other words, you are probably out of luck with the idea to find the deepest element via Ranorex xpath. I think you will have to use C# code for this purpose (either xml or xpath parser)?
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

User avatar
BMT
Posts: 22
Joined: Fri Jun 12, 2020 11:48 am

Re: rxpath: get all deepest nodes

Post by BMT » Thu Oct 08, 2020 10:22 am

Oh no. But thank you for your response and the information!
Image