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 8562981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:51:14+00:00 2026-06-11T16:51:14+00:00

I have a checkbox that is not a real checkbox. The CSS looks like:

  • 0

I have a checkbox that is not a “real” checkbox. The CSS looks like:

<li id="privileges:1" class="ui-tree-parent default" data-rowkey="1">
   <div class="ui-tree-node ui-state-default" aria-checked="true" aria-selected="true" aria-expanded="true" role="treeitem">
      <span class="ui-helper-clearfix ui-tree-node-content ui-corner-all ui-tree-selectable-node">
         <span class="ui-tree-icon ui-icon ui-icon-triangle-1-s"></span>
         <span></span>
         <div class="ui-tree-checkbox ui-widget">
            <div class="ui-tree-checkbox-box ui-widget ui-corner-all ui-state-default">
               <span class="ui-tree-checkbox-icon ui-icon ui-icon-check"></span>

The last span appears when the checkbox is checked.

My coworker had the following code which after review appears to be black magic and shouldn’t validate anything:

WebElement checkedBox = findElementByXpath("//li[@id='privileges:1']/div[@aria-checked='true']/span/div/div");
@SuppressWarnings("unused")
Boolean isChecked;
isChecked = checkedBox.findElement(By.xpath("//li[@id='privileges:1']/div[@aria-checked='true']/span/div/div")).isSelected();

What is the best way to validate the checkbox is checked using Selenium2/Webdriver?

This does not work:

WebElement checkedBox = findElementByClass("//li[@id='privileges:1']/div/span/div/div/span[@class='ui-tree-checkbox-icon.ui-icon.ui-icon-check']");
assertTrue(checkedBox.isEnabled());

Nor does:

WebElement checkedBox = findElementByClass("//li[@id='privileges:1']/div/span/div/div/span[@class='ui-tree-checkbox-icon.ui-icon.ui-icon-check']");
assertTrue(checkedBox.isDisplayed());
  • 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-06-11T16:51:15+00:00Added an answer on June 11, 2026 at 4:51 pm

    You have period/fullstops where the spaces should be in the XPath.

    The period/fullstop will only work in CSS selector. Also you seem to be using the By ClassName function and passing in an XPath query. I’ll assume this was just a typo.

    This is what you have:

    //li[@id='privileges:1']/div/span/div/div/span[@class='ui-tree-checkbox-icon.ui-icon.ui-icon-check']
    

    It should be:

    //li[@id='privileges:1']/div/span/div/div/span[@class='ui-tree-checkbox-icon ui-icon ui-icon-check']
    

    Tip in case you didn’t know: If you open Chrome Developer tools, go directly to the Console, type in:

    $x("//li[@id='privileges:1']/div/span/div/div/span[@class='ui-tree-checkbox-icon.ui-icon.ui-icon-check']")
    

    You’ll see it returns nothing.

    Do the same with this:

    $x("//li[@id='privileges:1']/div/span/div/div/span[@class='ui-tree-checkbox-icon ui-icon ui-icon-check']")
    

    It’ll return something. Both Firebug and Chrome Developer tools can be used to execute CSS and XPath selectors. So you can see if the issue is with Selenium or the selector you are using.

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

Sidebar

Related Questions

I have a checkbox that I do not want the user to have direct
In my html.beginform I have this checkbox that I want to persist. I'm not
I would like to have a checkbox preference that takes the user to a
I have a checkbox that when it is clicked it submits the form to
I am trying to create my own Native win32 C++ Checkbox that can have
I have a CheckBox in my application that is using the TriState mode. The
i have disabled all the checkboxes except one. On click of that checkbox i
I have datagridview with checkbox column, but I want, that some of the columns
I have a .NET application that contains a checkbox (System.Windows.Forms.Checkbox). This component (WindowsForms10.BUTTON.app.0.378734a1) is
I have an aspx page that contains a checkbox, and a button. The button

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.