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

  • SEARCH
  • Home
  • 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 4625598
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:17:46+00:00 2026-05-22T03:17:46+00:00

Decimal totalCheckboxes = selenium.GetXpathCount(//input[@type=’checkbox’]); for (int i = 1; i < totalCheckboxes + 1;

  • 0
Decimal totalCheckboxes = selenium.GetXpathCount("//input[@type='checkbox']");
  for (int i = 1; i < totalCheckboxes + 1; i++) 
        {
            // Assert attempt 1
            //Assert.IsTrue(selenium.IsChecked("/descendant-or-self::input[@type='checkbox'][" + i + "]"));

            // Assert attempt 2
            //Assert.IsTrue(selenium.IsChecked("//input[@type='checkbox'][" + i + "]")); 
        }

I need to assert multiple checkboxes are checked. The number of checkboxes are not always fixed because they depend on my search criteria. Also, the checkboxes have different id and name. For example, for the first checkbox, id = “ctl07_ctl01_ctl01_cbxRepeater_e5962e80-ca07-42e3-908f-1217ef5787d4” name = “ctl07$ctl01$ctl01$cbxRepeater_e5962e80-ca07-42e3-908f-1217ef5787d4”

and for the second checkbox, id=”ctl07_ctl01_ctl03_cbxRepeater_c094f428-7ead-4ded-a11b-5824be49a95b” name=”ctl07$ctl01$ctl03$cbxRepeater_c094f428-7ead-4ded-a11b-5824be49a95b”

and so on for the following checkboxes.

I have tried several things to add an assertion to assert the checkboxes are checked (Assert attempt 1 and Assert attempt 2 above), but when I run the test, it still fails at that point. Ther error I get:

Selenium.SeleniumException: ERROR: Element /descendant-or-self::input[@type='checkbox'][1] not found
Selenium.SeleniumException: ERROR: Element //input[@type='checkbox'][2] not found

Any help on this would be highly appreciated. Thanks in advance!

  • 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-22T03:17:47+00:00Added an answer on May 22, 2026 at 3:17 am

    Try :

    Assert.IsTrue(selenium.IsChecked("xpath=(//input[@type='checkbox'])[" + i + "]")); 
    

    Note the addition of ().

    The () says evaluate me first (as you would expect). This allows you to do (...)[1] to find the first element of the xpath evaluated in the ().

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

Sidebar

Related Questions

I was told that decimal is implemented as user defined type and other c#
Which type (Float or decimal) is best used to store prices in a mysql
How does a .NET decimal type get represented in binary in memory? We all
CSS decimal list style type, the hanging number doesnt have the same baseline as
I am trying to set decimal values,Below is my input string String rate=1.000000000; Converting
I have a Product table with non-null quantity (decimal) and status (int) columns, and
i am having hard time determining the length of a Decimal data type. The
I have decimal field in my DB. Users can input values in two formats:
Python Decimal doesn't support being constructed from float; it expects that you have to
I have a decimal number (let's call it goal ) and an array of

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.