Display results as :

Rechercher Advanced Search

Latest topics

How do i get the ID or Xpath of Text from Dynamic table?

View previous topic View next topic Go down

How do i get the ID or Xpath of Text from Dynamic table?

Post by sathya on Tue Apr 20, 2010 1:52 pm


I have a dynamic table that has 220 rows and 22 col , out of which there are 2 col named ( LID and SVal) .I have to get the Sval for LID =2345

1) Currently i have got the Rowcount ;Rowcount = 220
2) Get the LID for each row

for (i = 1;i<=rowcount;i++)
j=17;( LID is in the 17th col)
String LID =selenium.getTable("xpath=//table[@id='ctl00_cphMasterPlaceHolder_grvTitleListDistribution']."+i+"."+j+"");

if (LID == 2345)
int x = 20;
String Svalue = selenium.getTable("xpath=//table[@id='ctl00_cphMasterPlaceHolder_grvTitleListDistribution']."+i+"."+x+"");


Although the above solution get me the Sval it is very very slow as i am using xpath becaz the table is dynamic and don't have a constant ID.

As i know i have to search for the value 2345 in the table , is there a way to get the ID or Xpath of the value"2345" and this will save from crawling to each row and this will be faster or can anybody suggest any other solution to this

Thanks in Advance !!!


Posts : 6
Join date : 2010-04-14

Back to top Go down

Re: How do i get the ID or Xpath of Text from Dynamic table?

Post by metman on Wed Apr 21, 2010 12:27 am

I'm not 100% sure on the solution, but I'd start by switching to getValue() and using xPath sibling keywords to get to the data cell you are looking for. I think what you are looking for is the equivalent code for "get the text of the 20th element in the row which has a 17th element containing the value 2345." Try something like:


That's not quite right I'd bet, but take that general idea.


Posts : 58
Join date : 2010-04-02

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum