Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

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

Hi,

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 !!!

sathya

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:

selenium.getValue("preceding-sibling:://table[@id='ctl00_cphMasterPlaceHolder_grvTitleListDistribution']/tr/td[@value='2345'][3]"]);

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

metman
Amateur
Amateur

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