Problems using 'following-sibling'
Posted: Wed Apr 30, 2014 4:34 pm
Hi,
I'm using Ranorex 4.06. Here's my problem (or perhaps failure to understand how this works)
As an example, I have a parent element (Body) that contains multiple DIV children. Some of these DIV's have an ID and one doesn't. It happens that the DIV I want to find doesn't, but the one just before it does.
So I can find the DIV before it no problem and store it in "MyDiv" which is a DivTag object.
Now to get the next div, I have tried(which returns nothing) and I have tried this:
And this returns the first div in parent element which is not the right one at all.
If I go into Spy and the Xpath is showing MyDiv, if I modify it to append to the xpath 'following-sibling::div', Spy will show will ALL the Divs in the parent. Some of these divs are BEFORE MyDiv and one is after (the one I want).
The instructions say that Following-sibling refers to ALL siblings after the current node. I was under the impression my current node was MyDiv, not it's parent.
Why doesn't this work, or do I not get it?
Oh, and I'm not looking for another way to get the element. I know how to do it. I really want to know why following-sibling isn't work as I expect it to.
Aracknid
I'm using Ranorex 4.06. Here's my problem (or perhaps failure to understand how this works)
As an example, I have a parent element (Body) that contains multiple DIV children. Some of these DIV's have an ID and one doesn't. It happens that the DIV I want to find doesn't, but the one just before it does.
So I can find the DIV before it no problem and store it in "MyDiv" which is a DivTag object.
Now to get the next div, I have tried
Code: Select all
MyNewDiv = MyDiv.nextsibling
Code: Select all
MyNewDiv = MyDiv.FindSingle("./following-sibling::div",5000)
If I go into Spy and the Xpath is showing MyDiv, if I modify it to append to the xpath 'following-sibling::div', Spy will show will ALL the Divs in the parent. Some of these divs are BEFORE MyDiv and one is after (the one I want).
The instructions say that Following-sibling refers to ALL siblings after the current node. I was under the impression my current node was MyDiv, not it's parent.
Why doesn't this work, or do I not get it?
Oh, and I'm not looking for another way to get the element. I know how to do it. I really want to know why following-sibling isn't work as I expect it to.
Aracknid