Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara

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