Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:47:01+00:00 2026-05-30T03:47:01+00:00

I am new to Selenium. I am working with c#. There is a table

  • 0

I am new to Selenium. I am working with c#. There is a table like this . I saw it using FireBug.

<table>
  <tbody>
    <tr class="v-table-row-odd"></tr>
    <tr class="v-table-row"></tr>
    <tr class="v-table-row-odd"></tr>
    <tr class="v-table-row"></tr>
    <tr class="v-table-row-odd"></tr>
    <tr class="v-table-row"></tr>
  </tbody>
</table>

And the issue here is I am not knowing how to get the number of rows in a table which changes dynamically. Is there any way??

Tried xpathCount but got some exception issues..

decimal numOfRows = selenium.GetXpathCount("xpath=/html/body/div/div/div[2]/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[7]/div/div/div[2]/div/table/tbody/tr");

I also tried xpathCount like this

selenium.GetXpathCount("xpath=/html/body/div/div/div[2]/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[7]/div/div/div[2]/div/table/tbody");

But both raised exceptions. Can anyone help me out in this regard.

Thank You

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:47:02+00:00Added an answer on May 30, 2026 at 3:47 am

    If it’s the only table with rows marked with those class names, you could just use:

    decimal numOfOddRows = selenium.GetXpathCount("//tr[@class='v-table-row-odd']"); // 3
    decimal numOfEvenRows = selenium.GetXpathCount("//tr[@class='v-table-row']");    // 3
    decimal numOfRows = numOfOddRows + numOfEvenRows;                        // 3 + 3 = 6
    

    If not, then you need to find a better way of locating the table. Something is not quite right with your (very long) XPath selector which starts from the very top of the document. There’s nothing inherently wrong about this, but with a dynamic webpage it is very hard to get right.

    Instead, you need to locate an element closer to your table and then filter within that. If for instance, if one of your divs has a name attribute, you could use //div[@name='someName']//tr. For more information about using XPath selectors, see here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to javascript/jquery and having a hard time with using this or $(this) to
I am working with a tester who is using Selenium in my latest project.
I'm very new to Selenium RC. I'm using .NET (though I don't think it
I've got a problem with this class require test/unit require selenium/client class Test <
i'm using selenium rc for automation i used selenium.GetEval( var fso = new ActiveXObject('Scripting.FileSystemObject'));
I'm using Selenium Java 2.0b3 . I have this code: ... WebDriver driver =
I am new to Selenium. I am using Firefox and trying to export the
selenium = new DefaultSelenium( ConfigurationManager.AppSettings[TestMachine].ToString(), 4444, ConfigurationManager.AppSettings[Browser].ToString(), ConfigurationManager.AppSettings[URL].ToString() ); Is there an efficient way
I am new in selenium testing. I want to get the css class name
I'm new to Selenium and C#. I know this code is not optimal, can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.