Unable to select checkbox within a table using Selenium WebDriver with Java

Having trouble checking a checkbox inside a table using Selenium Webdriver in Java? Even with version 2.52.0 of Selenium, the element not found error persists across different web browsers. The iFrame seems to be correct as I can interact with other components on the same screen without any issues.

Check out this screenshot of the problematic screen: Screen Shot

Here's a snippet of the HTML code causing the headache:

<div id="j_id_jsp_2033766868_1pc7:innerTbl::db" class="x13r" _afrcolcount="4" style="position: relative; width: 958px; overflow: hidden; height: 320px; z-index: 1;">
  <table class="x13s x14j" cellspacing="0" _startrow="0" _rowcount="3" _selstate="{}" _totalwidth="395" style="table-layout: fixed; position: relative; width: 958px;">
    <tbody>
      <tr class="p_AFHighlighted x13q" _afrrk="0">
        <td class="xir" nowrap="" align="left" style="width:25px;">
        <td class="xir" nowrap="" align="left" style="width:50px;">
          <span id="j_id_jsp_2033766868_1pc7:innerTbl:0:select" class="p_AFHoverTarget x20j x1v" _adftrc="j_id_jsp_2033766868_1pc7:innerTbl:0:select::icon-style">
          <span class="x2e">
          <span class="xk2">
            <input id="j_id_jsp_2033766868_1pc7:innerTbl:0:select::content" class="xtj" type="checkbox" value="t" name="j_id_jsp_2033766868_1pc7:innerTbl:0:select"/>
          </span>
          </span>
          </span>
        </td>
        <td class="xir" nowrap="" align="left" style="width:100px;">
        <td class="xir" nowrap="" align="left" style="width: 763px;">
      </tr>
      <tr class="x13q" _afrrk="1">
      <tr class="x13q" _afrrk="2">
    </tbody>
  </table>
</div>

I've tried mapping the XPath to:

//*[@id='j_id_jsp_2033766868_1pc7:innerTbl:0:select::content']

as well as

//*[@name='j_id_jsp_2033766868_1pc7:innerTbl:0:select']

and

//*[@id='j_id_jsp_2033766868_1pc7:innerTbl::db']/table/tbody/tr/td/td/span/span/span/input

Still stuck? Any suggestions would be greatly appreciated!

Answer №1

Looks like utilizing the value attribute could be helpful in this scenario.

//input[@value='t']

I recently provided a response here on how to interact with an element using actions and Javascript execution if a normal click doesn't yield the expected results.

Sincerely, Murali

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Purge cookies from InternetExplorerDriver using Selenium WebDriver

Whenever I initialize my Internet Explorer instance, I rely on the following code snippet: public static WebDriver internetExplorerWebWDriver() { DesiredCapabilities returnCapabilities = DesiredCapabilities.internetExplorer(); returnCapabi ...

Utilizing SelenuimBase to fetch a Tableau dashboard for downloading

I have been working on a script to automate the download of my Tableau Public visualization for a project. However, I am facing issues after clicking on the download button. from seleniumbase import BaseCase import pyautogui class Test(BaseCase): def test ...

Border with curved edges

Having an issue with content boundaries while using CSS rounded corners in Firefox. Here is the code snippet: Code <html> <head> <style> #outter { width: 200px; margin: auto; text-align: cent ...

Is it possible to serve CSS using relative paths that go beyond the URL root?

I've encountered a file path issue with my HTML and CSS files. My HTML file is located in: src/test/html/index.html And the corresponding CSS file is in: src/test/css/index.css In the HTML file, the CSS is linked using: <link rel="stylesheet" ...

Utilize Selenium and Python to retrieve a collection of text items from a g element inside an svg tag

I am trying to extract specific text fields that are located within a <g> tag nested inside an <svg> tag. The website I am working on is: . My goal is to input a company name, search for it, expand the last drop-down menu, and extract informati ...

Firefox triggers drag events while passing over a div scrollbar

I am looking to create a file drag and drop feature using a styled div: When dragging files over the div, I want the border color to change When dragging files out of the div, I want the border color to revert back to the original In Firefox 35 (Ubuntu) ...

Leveraging the power of Required (html5) feature in Internet Explorer

What should I do if I want to make a textbox required on my webpage, but the issue is that it uses an HTML5 attribute? Is there a solution or alternative available? This is how I create my TextBox: @Html.TextBoxFor(model => model.SubChoiceText, new { ...

Issue with z-index not applying to a fixed header

I've been attempting to recreate the problem using this plunker. .demo-blog.mdl-layout .mdl-layout__content { padding-top: 0px; position: relative; margin-top: -80px; z-index: 100; } header.main-header{ z-index: -50; } My goal is ...

HTML forms are larger in size on web pages than in Internet Explorer

https://i.stack.imgur.com/bUPtm.png I have posted the issue, and it is predominantly visual in nature. When viewed on a web browser within a C++ interface, the HTML appears significantly distorted. ...

Preload-webpack-plugin does not support pre-fetching files

I have a query about prefetching and preloading content. In my vue app, I noticed that after building, I have duplicate files loaded in my dist/index.html file. Here is an example: Additionally, the "scripts" are not being preloaded/prefetched as expec ...

Display a persistent bar on the page until the user reaches a specified <div> element through scrolling

Looking to implement a sticky bar at the bottom of my page that fades out once the user scrolls to a specific div and then fades back in when scrolling up and the div is out of view. This bar should only appear if the user's screen size is not large ...

What strategies can I use to dynamically update the .active class in jquery so it doesn't only target the initial one?

Utilizing bootstrap for tab-fade functionality has been successful so far. However, I am facing an issue when trying to select multiple active classes instead of just one. My current JQuery code only changes the text in the first element with the "active" ...

Refine your search by name following the implementation of a character-altering filter

Encountered a scenario in which there is a need to filter elements generated by the 'ng-repeat' directive. I have implemented a custom filter that replaces one character with another and vice versa for each element created. However, when attempt ...

Accessing a JavaScript variable in another <script> section

I'm facing a challenge where I need to access a JavaScript variable that is declared in one block of an HTML page from another block on the same page. This is crucial for me to be able to halt an AJAX call that is currently ongoing. However, I'm ...

A guide to eliminating missing tags from HTML code using Asp.net

There have been instances where the HTML code we receive from certain websites does not have proper tag endings, causing issues with our UI. For example: <br /><p>hello the para start here </p> <p>some text and no ending tag As yo ...

Angular Pagination: Present a collection of pages formatted to the size of A4 paper

Currently, I am working on implementing pagination using NgbdPaginationBasic in my app.module.ts file. import { NgbdPaginationBasic } from './pagination-basic'; My goal is to create a series of A4 size pages with a visible Header and Footer onl ...

I am currently working on a one-page website that will feature both a Careers form and a Contact Us form. However, I am facing a challenge with the submission

I am currently working on integrating Careers FORM and Contact Us FORM into a single page website. However, I am facing an issue with the form Submit Buttons. The problem arises during validation of the input boxes. How can I differentiate between the two ...

The effectiveness of Selenium's find by name feature varies depending on the website being tested

While attempting to navigate to a specific website and input text into a field, I encountered an issue with the code. The example provided below successfully functions on Stack Overflow: from selenium.webdriver.chrome.service import Service from selenium.w ...

The primary container is brimming with an abundance of content

Can anyone help me with a CSS issue I'm experiencing in the latest versions of Chrome and Firefox? I can't seem to figure it out on my own. The problem arises with a container div that has a 50px top margin. Inside this container, there's a ...

Fix the positioning of a div in BootStrap and CSS code

Hey there, I'm relatively new to CSS/Bootstrap and currently in the process of learning. I might need to incorporate some CSS into the "chat_funcs" div, but unsure about what code to input to achieve my desired outcome. The issue at hand: What I am ...