Hey
I've started work on automating our Sandbox testing (JSON flows).
And the issue on hand atm is that i have a response area where all the requests and responses are shown.
I need to get the InnerText of the last child element of the repository item that displays all this info.
So the repository item will be the "Div'yui-log-bd' and in this case i will need the InnerText from the last child element aka "Div 'Application is not connected to the server.'. As info can be different the child elements name can also be different.
So the question is how can i achieve this with C#?
Getting value of last child element of a repository item
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Getting value of last child element of a repository item
Hi Martin,
In order to get the last element within this DIV tag you can use the following regular expression in your RanoreXPath
Starting from div[‘yui-log-bd’]
It is also possible to combine the last()=’true’ with one of your attributes.
For example:
Please find more information about Regular Expressions in combination with our RanorexPath in our User Guide.
Regards,
Markus (S)
In order to get the last element within this DIV tag you can use the following regular expression in your RanoreXPath
Starting from div[‘yui-log-bd’]
Code: Select all
/Div[@attribute=‘yui-log-bd’]/Div[last()=’true’]
For example:
Code: Select all
/Div[@innertext>’Application’ and last()=’true’] //This path finds the last Div tag whereby the innertext starts with’Application’
Regards,
Markus (S)
Re: Getting value of last child element of a repository item
HeySupport Team wrote:Hi Martin,
In order to get the last element within this DIV tag you can use the following regular expression in your RanoreXPath
Starting from div[‘yui-log-bd’]It is also possible to combine the last()=’true’ with one of your attributes.Code: Select all
/Div[@attribute=‘yui-log-bd’]/Div[last()=’true’]
For example:Please find more information about Regular Expressions in combination with our RanorexPath in our User Guide.Code: Select all
/Div[@innertext>’Application’ and last()=’true’] //This path finds the last Div tag whereby the innertext starts with’Application’
Regards,
Markus (S)
Thank you for the reply. Got my last element.
Though for someone else who might have this issue i'd like to point out that "last()='True'" seems to actually be case sensitive. Didn't work with lowercase "t" in "True".
Re: Getting value of last child element of a repository item
But another question (I won't as of yet start a new topic for this):
It came out that some of the info i need might be nested even more in one of those nested Divs.
I have a functionality in my mind but i would like to know if there is a possibility to gather all "innerText"-s of all nested Divs in one main Div?
Example taking into account the picture in my first post.
Main Div: "yui-log-bd"
It has nested Divs: "Logger reset", "Web Socket connection..." etc
And these nested Divs might have even more nested Divs.
Is it possible to gather all the innerTexts of these nested Divs from my main Div (yui-log-bd)?
It came out that some of the info i need might be nested even more in one of those nested Divs.
I have a functionality in my mind but i would like to know if there is a possibility to gather all "innerText"-s of all nested Divs in one main Div?
Example taking into account the picture in my first post.
Main Div: "yui-log-bd"
It has nested Divs: "Logger reset", "Web Socket connection..." etc
And these nested Divs might have even more nested Divs.
Is it possible to gather all the innerTexts of these nested Divs from my main Div (yui-log-bd)?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Getting value of last child element of a repository item
Hi Martin,
RanoreXPath is based on W3C XPath. Therefore, you can use different Syntaxes to achieve your plan.
Please find some examples about the RanoreXPath in our User Guide.
Regards,
Markus (S)
RanoreXPath is based on W3C XPath. Therefore, you can use different Syntaxes to achieve your plan.
Please find some examples about the RanoreXPath in our User Guide.
Regards,
Markus (S)