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

Retrieving number of rows in a table

View previous topic View next topic Go down

Retrieving number of rows in a table

Post by mkunda on Sun Mar 21, 2010 12:59 am

Hi

I am new to Selenium. I am using Selenium with Java. I would like to retrieve number of rows of a table and need to retrieve content of each row of a specific column to validate. I can identify the table only with "id" property. But that ID property is not consistent. And I don't have any other property to identify the table.

Please help me out.

Thanks in advance

mkunda

Posts : 4
Join date : 2010-03-21

Back to top Go down

Re: Retrieving number of rows in a table

Post by Adviser on Sun Mar 21, 2010 11:29 am


Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

Re: Retrieving number of rows in a table

Post by mkunda on Sun Mar 21, 2010 2:19 pm

Thanks for the quick response. I have seen the post. But I dont under stand how to use this statement.
I am trying in the following way
Selenium sel = new Selenium();
s=sel.storeXpathCount("");
But I coudnt see any predefined method called storeXpathCount with Selenium. Do I need any Jar file for this.

Thanks in Advance

mkunda

Posts : 4
Join date : 2010-03-21

Back to top Go down

Re: Retrieving number of rows in a table

Post by Adviser on Mon Mar 22, 2010 1:19 pm

yes , you have to call selenium-server.jar into your code so that all function/API of selenium core can be accessible to you.

Checkout this post to get an idea:
http://seleniumforum.forumotion.net/selenium-rc-discussion-f4/can-t-make-rc-code-to-run-t165.htm

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

Re: Retrieving number of rows in a table

Post by mkunda on Tue Mar 23, 2010 11:22 am

Hi Adviser,

thanks for the quick reply I have added all the libraries. I am able to see sel.getXpathCount. But I am not able to see sel.storeXpathCount.

Actually I wanted to validated a text field value and as well as a table cell value.

I have added the following jar files
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

import junit.framework.TestCase;
import org.openqa.selenium.*;
import org.openqa.selenium.server.SeleniumServer;

Could you tell me the exact steps or code for this.
Sorry to ask too much in details .

mkunda

Posts : 4
Join date : 2010-03-21

Back to top Go down

Re: Retrieving number of rows in a table

Post by metman on Sat Apr 03, 2010 1:39 am

Yeah, just use:

int rowCount = sel.getXpathCount(XPathToTRElements).intValue();

getXpathCount returns a Number object, but ints are usually easier to deal with in circumstances like this. Also, if you are more interested in the aggregate contents of a column than the number of rows, you can also implicitly wildcard address all table cells in all rows by using an XPath like pathToHeadOfTable/tr/td[x] where x is the cell index across all rows. Be aware that spans may mess up using a path like that though.

Edit: scratch that, I forgot Selenium doesn't have a nice way of dumping out content of a wildcard path like that. So yeah, you'd have to loop through the rows with getXPathCount() and pull out the individual tds to validate 1 by 1.

metman
Amateur
Amateur

Posts : 58
Join date : 2010-04-02

Back to top Go down

Re: Retrieving number of rows in a table

Post by Sponsored content Today at 8:09 am


Sponsored content


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