Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
Archana
Archana
Regular Participant
Regular Participant
Posts : 33
Join date : 2009-08-21

how to store number of rows of a table Empty how to store number of rows of a table

Fri Aug 28, 2009 9:01 pm
I have a table, how can I store number of table rows in an element through IDE command?

Also I want to locate the table, but not through xpath here, becoz my page design may change later, but I know the table title which is fixed. After this text, I have a table. I want to know the reference of this table. (this table has no id)

something like
[<]span id="text"[>]table title[<]/span[>]
[<]div[>]aaa[<]/div[>]
[<]table[>]
[<]tr[>] [<]td[>]xxx [] []
[<]tr[>] [<]td[>]yyy [] []
[<]/table[>]

I want to know the no.of rows as 2.
Is it possible?
Advisor
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
https://seleniumforum.forumotion.net

how to store number of rows of a table Empty Re: how to store number of rows of a table

Mon Aug 31, 2009 12:28 pm
hi,
you can use the following command to get the total row numbers:

storeElementIndex ( locator, variableName )

Get the relative index of an element to its parent (starting from 0). The comment node and empty text node will be ignored.

Arguments:

* locator - an element locator pointing to an element
* variableName - the name of a variable in which the result is to be stored.

Returns:
of relative index of the element to its parent (starting from 0)

For example use the following link:
http://clearspace.openqa.org/message/65957#65957

Best of luck.

bye
Archana
Archana
Regular Participant
Regular Participant
Posts : 33
Join date : 2009-08-21

how to store number of rows of a table Empty Re: how to store number of rows of a table

Mon Aug 31, 2009 7:55 pm
Hi,
could you expalin in detail?
storeElementIndex ( locator, variableName ) is not working for me.
storeElementIndex | //table[3]/tbody/tr/td[2]/table[2] | variableName

If I access ${variableName} is giving 4, but the no.of rows is not 4.
Please help.
Advisor
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
https://seleniumforum.forumotion.net

how to store number of rows of a table Empty Re: how to store number of rows of a table

Wed Sep 02, 2009 6:43 pm
hi,
how many row you have in that table?
Archana
Archana
Regular Participant
Regular Participant
Posts : 33
Join date : 2009-08-21

how to store number of rows of a table Empty Re: how to store number of rows of a table

Wed Sep 02, 2009 6:47 pm
12, but I'm not getting 12.
I was using
store | javascript{document.getElementsByTagName('table')[5].rows.length} | size, but this is also not working.
Advisor
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
https://seleniumforum.forumotion.net

how to store number of rows of a table Empty Re: how to store number of rows of a table

Thu Sep 03, 2009 6:08 pm
hi,

Use xpath instead of DOM locator to get table row and column.

Syntax for table row

storeXpathCount | //table[@id='form1:dataTable1']/tbody[@id='form1:dataTable1:tbody_element']/tr | row |

Note: This will not count header of table in which heading for each column define.

Syntax for table column:

storeXpathCount | //table[@id='form1:dataTable1']/tbody[@id='form1:dataTable1:tbody_element']/tr[2]/td | col|

Note: the above command will give you the column present in row 3


Try this and will work fine. Best of luck.
Archana
Archana
Regular Participant
Regular Participant
Posts : 33
Join date : 2009-08-21

how to store number of rows of a table Empty Re: how to store number of rows of a table

Sat Sep 05, 2009 12:18 pm
Yes, it's working fine Smile
avatar
rohitnirantar
Posts : 4
Join date : 2010-09-14

how to store number of rows of a table Empty Re: how to store number of rows of a table

Wed Oct 20, 2010 10:25 pm
Hi,
I am trying to use abovecommand on mercury flight application.
Below is command i am using :
col = sel.get_xpath_count("//table[1]/tbody/tr[7]/td")
it is returning 6
and for rows
row = sel.get_xpath_count("//table[1]/tbody/tr")
it is returning 36

But actually there are only 5 columns and 10 rows in table.
Can you please help me out of this?
avatar
Priyanka
Regular Participant
Regular Participant
Posts : 27
Join date : 2010-10-04

how to store number of rows of a table Empty Re: how to store number of rows of a table

Thu Dec 02, 2010 3:52 pm
how to get the total no of rows from a table using selenium?
Am using c#.
From the view source am getting only table's class. Table id is not getting. Can anyone pls help
Sponsored content

how to store number of rows of a table Empty Re: how to store number of rows of a table

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