Hi all,
I need to find a row of which two cells equal some distinct values. Using a code module I created a Ranorex table.
How can I iterate through that table and choose that row (or any cell of that row, it doesn't matter).
Thanks in advance
Fabio
Find a row in a Ranorex Table
Re: Find a row in a Ranorex Table
Hi,
Please post the code you already have and if the code should interact with GUI, upload also a Ranorex snapshot (NOT screenshot) of the GUI you would like to process with your code. Thanks.
Please post the code you already have and if the code should interact with GUI, upload also a Ranorex snapshot (NOT screenshot) of the GUI you would like to process with your code. 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: Find a row in a Ranorex Table
Hello,
I just have the following code:
Ranorex.Table cont = repository."something"."somethin"."something";
The code shouldn't interact with the GUI. I just need the index of the row of which two cells match some variables. I'm sorry if my explanation is not quite clear. Unfortunately I cannot upload a snapshot, because the software I work with is a banking software, and therefore it may contain Client Identifying Data.
Thanks
I just have the following code:
Ranorex.Table cont = repository."something"."somethin"."something";
The code shouldn't interact with the GUI. I just need the index of the row of which two cells match some variables. I'm sorry if my explanation is not quite clear. Unfortunately I cannot upload a snapshot, because the software I work with is a banking software, and therefore it may contain Client Identifying Data.
Thanks
Re: Find a row in a Ranorex Table
I'm afraid, that without snapshot, I can only provide you some general suggestions, like search this forum for table-related posts (there are quite a lot of them) and check also Ranorex codes samples, available here:
https://www.ranorex.com/help/latest/han ... e-examples
There may be not directly the code you are looking for, but you may find some good examples and ideas.
Generally speaking, you will either have to cycle the table rows/cells and read content of every cell and compare it with variable(s) you are looking for. For this, you may find useful Ranorex code samples from above link. Another way could be constructing a good xpath, which may help you to find proper table cell/row. Unfortunately, without seeing, at very least, Ranorex snapshot, it's impossible to tell how you should construct such xpath.
Here is a small example, which returns childindex of table row, containing two cells of given content.
Where table element is a repo element, pointing to tbale of your choice and elementTR, points to repo element, which should contain two cells of expected content.
xpath of given table...
https://www.ranorex.com/web-testing-examples/
https://www.ranorex.com/help/latest/han ... e-examples
There may be not directly the code you are looking for, but you may find some good examples and ideas.
Generally speaking, you will either have to cycle the table rows/cells and read content of every cell and compare it with variable(s) you are looking for. For this, you may find useful Ranorex code samples from above link. Another way could be constructing a good xpath, which may help you to find proper table cell/row. Unfortunately, without seeing, at very least, Ranorex snapshot, it's impossible to tell how you should construct such xpath.
Here is a small example, which returns childindex of table row, containing two cells of given content.
Code: Select all
int rowIndex = tableElement.CreateAdapter<Ranorex.TableTag>(false).FindSingle(elementTR.Path).ChildIndex;
xpath of given table...
xapth of row containing two cells of given content...body/div//table
You can test the above code and xpaths with this sample web table:.//td[@innertext='Third element ']/../td[@innertext='blue']/parent::tr
https://www.ranorex.com/web-testing-examples/
Last edited by odklizec on Thu Jul 11, 2019 2:34 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: Find a row in a Ranorex Table
Hi,odklizec wrote: ↑Thu Jul 11, 2019 1:36 pmI'm afraid, that without snapshot, I can only provide you some general suggestions, like search this forum for table-related posts (there are quite a lot of them) and check also Ranorex codes samples, available here:
https://www.ranorex.com/help/latest/han ... e-examples
There may be not directly the code you are looking for, but you may find some good examples and ideas.
Generally speaking, you will either have to cycle the table rows/cells and read content of every cell and compare it with variable(s) you are looking for. For this, you may find useful Ranorex code samples from above link. Another way could be constructing a good xpath, which may help you to find proper table cell/row. Unfortunately, without seeing, at very least, Ranorex snapshot, it's impossible to tell how you should construct such xpath.
All I can do is post a screenshot of the snapshot.
Both of the values (red circles) need to match another value. If that is the case, the solution needs to click any of the cells of that row to continue.
Thanks in advance.
Re: Find a row in a Ranorex Table
I'm afraid, screenshot of snapshot is useless. Just check the sample I provided and eventually, search the similar discussions on this forum.
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