Hi,
My Scenario:- have a grid table in flex application after adding one item rows will increment ,but i want to check the checkbox which is in second row.
table will getting updated regulalry i want to identify the element for a particular row
Thanks
Raghu
+91 9035806081
How to fetch Xpath for a dynamic table
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to fetch Xpath for a dynamic table
Hi,
Unfortunately I’m afraid that I don’t understand your problem. Please explain it in more detail.
If you want to access a specific row you can e.g. use an index:
Regards,
Robert
Unfortunately I’m afraid that I don’t understand your problem. Please explain it in more detail.
If you want to access a specific row you can e.g. use an index:
Code: Select all
/table[@id='Sample']/row[@index='2']
Robert
Re: How to fetch Xpath for a dynamic table
Hi, have also a problem with grid table. I have a dynamic table with the list of items. My scenario is that i want to add item, and work with the row where item present, that means to click button in this particular row.
As u see from my snapshot:
div 'ui-widget-content slick-row even zebra' is the first row with those items
div 'ui-widget-content slick-row odd zebra' is the second row
i want to focus for example on a row with div '14021151440587' (first row) and work with it. I need to store some how Xpath position to this row.
Any ideas?
As u see from my snapshot:
div 'ui-widget-content slick-row even zebra' is the first row with those items
div 'ui-widget-content slick-row odd zebra' is the second row
i want to focus for example on a row with div '14021151440587' (first row) and work with it. I need to store some how Xpath position to this row.
Any ideas?
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to fetch Xpath for a dynamic table
Hi,
There are different ways how you can identify the specific row.
One is to use the class attribute, in the case this attribute uniquely identidies the specific row:
another way is to use the unique RxPath to the child element to uniquely identify its parent element:
For more information about the RxPath please see: RanoreXPath and RanoreXPath – Tips and Tricks.
Regards,
Markus
There are different ways how you can identify the specific row.
One is to use the class attribute, in the case this attribute uniquely identidies the specific row:
Code: Select all
.../div[@class~'.*even zebra']
Code: Select all
/dom[@domain='localhost:40003']//div[#'formerExportsTable']/div//div[@innertext='140211151440587']/../../div[@class~'.*even zebra']
Regards,
Markus
Re: How to fetch Xpath for a dynamic table
yeee but i want to do that:
1. find an element in the table
2. focus on a row with this elemnt
3.press button in this row
Like i cant specify the row because next time it wont be on the same position. I need to store this row, and use this row for next commands
1. find an element in the table
2. focus on a row with this elemnt
3.press button in this row
Like i cant specify the row because next time it wont be on the same position. I need to store this row, and use this row for next commands
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to fetch Xpath for a dynamic table
Hi,
I have created a small sample solution, based on your snapshot which should fullfill all your requirements.
Regards,
Robert
I have created a small sample solution, based on your snapshot which should fullfill all your requirements.
public void ClickButton() { //You get a Div tag without knowing the row just the innertext of the element DivTag element1 = @"/dom[@caption='Tryit Editor v1.8']/body//div[@InnerText~'.*element 1.']"; //The row in your data structure is always the parent Div Tag of the element. DivTag row = element1.Parent.As<DivTag>(); Report.Info("Row: " + row.Id.ToString()); //Press button in this row ButtonTag button = row.FindSingle<ButtonTag>(@".//button[@innertext='Click']"); button.Click(); }Please have a look at the attached snapshot file aswell.
Regards,
Robert
You do not have the required permissions to view the files attached to this post.
Re: How to fetch Xpath for a dynamic table
We encounter this problem often. What we do is to write a proper Xpath for the button we need to click.
based on your snapshot, if you want to click on the Download button of the row that contains the Text '140211151440587':
the /../ part is to tell xpath to go up one level in the spy hierarchy, so we can search the download button from there down below.
You can also paramterize the xpath to look for a text that you can set from a variable ($yourparameter):
based on your snapshot, if you want to click on the Download button of the row that contains the Text '140211151440587':
Code: Select all
/dom[@domain='localhost:40003']//div[#'formerExportsTable']//div[@innertext='140211151440587']/..//button[@innertext='Download']
You can also paramterize the xpath to look for a text that you can set from a variable ($yourparameter):
Code: Select all
/dom[@domain='localhost:40003']//div[#'formerExportsTable']//div[@innertext=$yourparameter]/..//button[@innertext='Download']