Tags, Web aplication and user code
Tags, Web aplication and user code
Hello all, I'm new at Ranorex and I need to create a usercode routine to select multiple items on a website.
I have the XPath of each item, and I want to select, and insert text on the items that have that option, and then perform other actions.
the problem that I'm facing is that it seams that I can't assign the XPath to any variable in order to perform CliCK() ou GetValue() ... etc.
I try to use the Selenium "driver" but even that, gives me error. I think this is a easy fix, but I realy do not have the knoledge yet. Also I start C# learming in April and basicly I'm a beginer.
Hope someone could help me.
Regards
I have the XPath of each item, and I want to select, and insert text on the items that have that option, and then perform other actions.
the problem that I'm facing is that it seams that I can't assign the XPath to any variable in order to perform CliCK() ou GetValue() ... etc.
I try to use the Selenium "driver" but even that, gives me error. I think this is a easy fix, but I realy do not have the knoledge yet. Also I start C# learming in April and basicly I'm a beginer.
Hope someone could help me.
Regards
Re: Tags, Web aplication and user code
Hi,
At first, please create a Ranorex snapshot (NOT screenshot) of the UI you are working with and post it here (zipped please). Then add some example xpaths and ideally, also step-by-step instructions for what you are trying to do.
Without, at very least, Ranorx snapshot, there is not much anyone here can do or suggest. Thanks.
At first, please create a Ranorex snapshot (NOT screenshot) of the UI you are working with and post it here (zipped please). Then add some example xpaths and ideally, also step-by-step instructions for what you are trying to do.
Without, at very least, Ranorx snapshot, there is not much anyone here can do or suggest. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Tags, Web aplication and user code
Ok. So, for example. I have a website, with a certain url, and I am doing some test on it. But for the validation of some instances, I need to aply some logic (C#) and decide witch option select. On the image atached you could see what tipe of options I have.
For the Download users, I have imagine, the follow XPath: "blablablablablablaXPATH\input[@value='Download Users']"
I just simply can't use the repository item option to select this specific button, because, the ID is not unique, there are others equal, but the XPath is unique. I need to find a way to link the XPath with the user code area on Ranorex test environment.
How can I do that? I try to use selenium but or I lack knoledge, more likely, or I can´t use it.
Can someone help?
For the Download users, I have imagine, the follow XPath: "blablablablablablaXPATH\input[@value='Download Users']"
I just simply can't use the repository item option to select this specific button, because, the ID is not unique, there are others equal, but the XPath is unique. I need to find a way to link the XPath with the user code area on Ranorex test environment.
How can I do that? I try to use selenium but or I lack knoledge, more likely, or I can´t use it.
Can someone help?
You do not have the required permissions to view the files attached to this post.
Re: Tags, Web aplication and user code
Hi,
Unfortunately, what you've posted is screenshot, not snapshot. Please create and upload a Ranorex snapshot of your AUT, which will help us with creating sample code or providing reasonable suggestion. Thanks.
Unfortunately, what you've posted is screenshot, not snapshot. Please create and upload a Ranorex snapshot of your AUT, which will help us with creating sample code or providing reasonable suggestion. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Tags, Web aplication and user code
I did not know what was that. Thank you.
Unfortunatly I can't do it because is private information of my company. It that will be an issue? Because it's a normal button, it could be anything actually. My question is how I can handle XPaths on ranorex.
Unfortunatly I can't do it because is private information of my company. It that will be an issue? Because it's a normal button, it could be anything actually. My question is how I can handle XPaths on ranorex.
Re: Tags, Web aplication and user code
Hi,
I'm afraid, that without snapshot I can suggest only some general suggestions.
Basically, if the id of a particular element is not unique, you should use another element (with unique information) as an 'anchor', from which you need (somehow) traverse to the element of your choice relationship operators. It's relative, easy process. Sadly, without knowledge of structure of your GUI, I can't give you any reliable sample. All I can suggest is to thoroughly read Ranorex user guide, especially chapters about xpath construction. And check also these blog posts:
https://www.ranorex.com/blog/automated- ... namic-ids/
https://www.ranorex.com/blog/ranorexpat ... nd-tricks/
I'm afraid, that without snapshot I can suggest only some general suggestions.
Basically, if the id of a particular element is not unique, you should use another element (with unique information) as an 'anchor', from which you need (somehow) traverse to the element of your choice relationship operators. It's relative, easy process. Sadly, without knowledge of structure of your GUI, I can't give you any reliable sample. All I can suggest is to thoroughly read Ranorex user guide, especially chapters about xpath construction. And check also these blog posts:
https://www.ranorex.com/blog/automated- ... namic-ids/
https://www.ranorex.com/blog/ranorexpat ... nd-tricks/
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Tags, Web aplication and user code
Ok, so, let me try to simplify it.
I have installed on my Chrome browser the Ranorex tool to extract the XPath from any item(exemple on image attached).
With this, I want to, using the code, create a new item, to then perform a validation, for example.
I know that it would be esay to just add the item to the repository, and then use it. But first that will only resolve some of my tests, and then I use a lot of items, it became very confuse.
Can you help?
I have installed on my Chrome browser the Ranorex tool to extract the XPath from any item(exemple on image attached).
With this, I want to, using the code, create a new item, to then perform a validation, for example.
Code: Select all
RxPath newXPath = "xpath copy from the browser";
bool exists = Validate.Exists(newXPath, 20000, "Check Object '{0}'", false);
Can you help?
You do not have the required permissions to view the files attached to this post.
Re: Tags, Web aplication and user code
Hi,
I'm afraid, you are trying to overcomplicate things a bit? What you want is definitely possible, but if you are new to Ranorex, you should really stick with repository and recordings modules and then, once you get comfortable, add coded things.
Ranorex is not Selenium and you should really use repository, which makes Ranorex projects easy to edit and grow. Hardcoding xpaths directly in CS files is way to hell, from long-term project perspective.
At next, I would really recommend to use Ranorex Studio tools for generating xpaths, not browser specific tools! Not even Ranorex Selocity tool, which is intended to be used with Selenium and Ranorex WebTestit tool and not Ranorex Studio! The thing is, that Ranorex Studio does not support all xpath keywords and some other aspects of xpath specification. So you should really use Ranorex Studio Spy to generate xpaths and then, if you wish, edit them accordingly. Ranorex will validate your edited xpaths and make sure they are 100% compatible.
I'm afraid, you are trying to overcomplicate things a bit? What you want is definitely possible, but if you are new to Ranorex, you should really stick with repository and recordings modules and then, once you get comfortable, add coded things.
Ranorex is not Selenium and you should really use repository, which makes Ranorex projects easy to edit and grow. Hardcoding xpaths directly in CS files is way to hell, from long-term project perspective.
At next, I would really recommend to use Ranorex Studio tools for generating xpaths, not browser specific tools! Not even Ranorex Selocity tool, which is intended to be used with Selenium and Ranorex WebTestit tool and not Ranorex Studio! The thing is, that Ranorex Studio does not support all xpath keywords and some other aspects of xpath specification. So you should really use Ranorex Studio Spy to generate xpaths and then, if you wish, edit them accordingly. Ranorex will validate your edited xpaths and make sure they are 100% compatible.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Tags, Web aplication and user code
Yes, that would be perfect but the person I came to replace, have a high level of ranorex coding, and I need to catch up fast.
Image this instead, what can I use on the variable newXPath (code 1)? For example, if I copy the path from the items on ranorex, and create a variable for example (code 2):
Image this instead, what can I use on the variable newXPath (code 1)? For example, if I copy the path from the items on ranorex, and create a variable for example (code 2):
Code: Select all
bool exists = Validate.Exists(newXPath, 20000, "Check Object", false);
Code: Select all
(vartypr?) newXPath = path from item on ranorex?
Re: Tags, Web aplication and user code
More simple, how can I get the path, from an item on the repository?
Because that could help me understand how the xpath and the RXpath work.
Because that could help me understand how the xpath and the RXpath work.
Re: Tags, Web aplication and user code
Hi,
So basically, you can do something like this:
Add this method to recording of your choice and simply drag&drop repo element to "repoElement" parameter of above method (in recording table).
So basically, you can do something like this:
Code: Select all
public void GetXpathFromRepoItemInfo(RepoItemInfo repoElement)
{
string xpathFromElement = repoElement.Path.ToString();
}
Last edited by odklizec on Wed Apr 28, 2021 2:28 pm, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Tags, Web aplication and user code
Hy,
I try to use it, but I got the follow code compile error:
Non-invocable member 'RepoItemInfo.Path' cannot be used like a method. (CS1955)
Do you know what I am doing wrong?
I try to use it, but I got the follow code compile error:
Non-invocable member 'RepoItemInfo.Path' cannot be used like a method. (CS1955)
Do you know what I am doing wrong?
Re: Tags, Web aplication and user code
Hi,
Sorry, my mistake. Get the updated code
Sorry, my mistake. Get the updated code
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Tags, Web aplication and user code
Hy,
Yes, the code works just fine. But I have an issue now. the code bellow, only the one I use the "repoElement" works, I can´t figure out why when I use the path fails the validation. The first one work, the second one no.
Yes, the code works just fine. But I have an issue now. the code bellow, only the one I use the "repoElement" works, I can´t figure out why when I use the path fails the validation. The first one work, the second one no.
Code: Select all
public void GetXpathFromRepoItemInfo(RepoItemInfo repoElement){
string xpathFromElement = repoElement.Path.ToString();
bool exists = Validate.Exists(repoElement, "Check Object '{0}'", false);
}
Code: Select all
public void GetXpathFromRepoItemInfo(RepoItemInfo repoElement){
string xpathFromElement = repoElement.Path.ToString();
bool exists = Validate.Exists(xpathFromElement, 20000, "Check Object '{0}'", false);
}
Re: Tags, Web aplication and user code
Hi,
There are two things to try:
- Replace Path with AbsolutePath. Path returns path, relative to its parent. So if the element is buried in a nested structure of root folders, you may need to use AbsolutePath instead.
- Try to increase search timeout value.
There are two things to try:
- Replace Path with AbsolutePath. Path returns path, relative to its parent. So if the element is buried in a nested structure of root folders, you may need to use AbsolutePath instead.
- Try to increase search timeout value.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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