Unable to choose an item from a table using the "editable-checkbox" option

Seeking assistance with the following situation:

I am trying to access a table, locate the row where the status is 'GOO', and then activate the editing of this row by clicking on a button. After that, I need to click on a checkbox in the last column to toggle its value between true and false.

The button click is handled within a function:

function changeConformStatus(statusCode){
     element(by.id('btnEdit-US.'+statusCode)).click(); 
     browser.sleep(500);
}

In the same function, I also have the code to click on the checkbox once it is visible and then save the changes:

element(by.css('[editable-checkbox="scopeValue.getConformMapping(scopeValue.getDataRow('+'US.'+statusCode+')).conform"]')).click();
     element(by.id('btnSubmit-US.'+statusCode)).click();

All elements contain the Status code after 'US.', hence why I pass the Status directly to the element locator from the test data.

However, my problem arises when trying to click on the checkbox - the test fails with the message: "No element found using locator..."

So, how can I successfully click on this checkbox?

HTML snippet:

<table id="datatableDir" class="table table-hover  table-bordered table-striped dataTable no-footer" style="width: 100%" role="grid" aria-describedby="datatableDir_info">
<thead>...</thead>
<tbody>
<tr role="row" class="odd">
    <td id="2-4" class="ng-scope">
        <span editable-checkbox="scopeValue.getConformMapping(scopeValue.getDataRow('US.GOO')).conform" e-name="conform" e-form="scopeValue.rowforms['US.GOO']" e-required="" class="ng-scope ng-binding editable editable-hide">false</span>
        <span class="editable-wrap editable-checkbox ng-scope">
            <span class="editable-controls">
                <input type="checkbox" name="conform" required="required" class="editable-input ng-touched ng-dirty ng-valid-parse ng-not-empty ng-valid ng-valid-required" ng-model="$data" style="">
                <div class="editable-error ng-binding ng-hide" ng-show="$error" ng-bind="$error" style=""></div>
            </span>
        </span>
    </td>
</tr>
</tbody>
</table>

UPDATE

The solution provided by @Sanja was almost correct, I made the following adjustment to resolve the issue:

element(by.xpath("//*[@editable-checkbox=\"scopeValue.getConformMapping(scopeValue.getDataRow("+'\'US.'+statusCode+"\')).conform\"]/../span/span/input")).click();

Answer №1

It appears from the code that the intended action is to click on the span element rather than the checkbox itself. To properly click on the checkbox, you should target the input element instead:

element(by.xpath(".//[@editable-checkbox='scopeValue.getConformMapping(scopeValue.getDataRow('+'US.'+statusCode+')).conform/../span[1]/span/input")).click()

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

verifying if checkbox is selected using a while loop in PHP

Help Needed: I am currently trying to loop through some code, but I'm struggling with checking checkboxes using PHP. Could someone please review my code and provide guidance on what needs to be added? Any assistance would be greatly appreciated. Thank ...

Tips for maintaining a scrollable Material-UI Table with dynamic height?

I'm encountering an issue with the Material-UI Table component in terms of its size and scrollability. Summary: The Material-UI table only becomes scrollable when its parent has a fixed size. If I set the size to 100% to fit the parent, it overflows. ...

Having trouble with a FlatList component causing a blank screen in React Native?

I've been attempting to display data in a view using FlatList but instead of showing the predefined values, it's just showing a blank screen. This is what I have tried so far. Note: I purposely excluded import elements from react import { ...

incapable of destructuring two objects simultaneously

Is there a way to map movies using columns as a property reference? For example: {movies.map(item => {columns.map(column => item.column.path)})} When I try this, the result is always undefined. The 'movies' array contains detailed inform ...

Locate the present position of the slider element

I am currently in the process of creating a website that features pages displayed in a slider format. Each page has its own unique ID, but all share a common class called 'section'. However, I am encountering difficulty in identifying the ID of t ...

Issues with ng-repeat not functioning properly within a Popover

I have a list that I am looping through using ng-repeat: <div class="row msf-row" ng-repeat="record in recordlist people-popover> <div class="col-md-1 msf-centered" ng-show="editItem == false" ng-hide="editItem"> <button class="btn ...

Is there a way to identify when no rows contain specific values in PostgreSQL or node.js and return false?

Here is an example of a table: P Q t f f t f f In SQL, is there a way to return false when querying for t t, but true when querying for t f, f t, or f f? Should this be handled with node.js by first doing a select and then using if-else statements based ...

What could be causing the hover effect to not work on other elements within the div?

I am working on creating a card that displays only the image when not hovered, but expands and reveals additional information in a div to the right of the image when hovered. Unfortunately, when I hover over the image and then move towards the adjacent div ...

ordering the date and time in a reverse sequence using javascript

I am working with dynamically generated date and time data and I am looking to sort them in descending order using JavaScript. Here is an example of the data format I am dealing with: var array= ["25-Jul-2017 12:46:39 pm","25-Jul-2017 12:52:23 pm","25-Ju ...

Authenticating child in Azure JWT token using the kid value hardcoded

As I obtained an Azure token, I decided to verify it by checking the kid in the header. I decoded the token on jwt.io and hardcoded the kid into my code for future tokens. However, after a few days, the public keys were updated, rendering the previous kid ...

[server-auth]: The `useSession` function is required to be enclosed within a <SessionProvider /> component to avoid the error occurring in the current JavaScript file

While trying to validate authentication by following the next-auth documentation, I encountered an error stating "[next-auth]: useSession must be wrapped in a SessionProvider". I am using GitHub credentials for the validations. Here is my code: Currently ...

Enhancing webpage design by dynamically changing borders and headers using JavaScript

I have implemented a fixed positioning for the table headers using the following code: onScroll={() => { document.querySelector('thead').style.transform = `translate(0,${this.scrollRef.scrollTop}px)`; }} However, when I scroll the ta ...

A malfunction report stemming from an HTTP error code while using react.js/javascript

In my react.js application, I have a Component that displays an error code. It currently looks like this: https://i.stack.imgur.com/2usiy.png Now, in addition to displaying just the code, I also want to show the reason for the error. Similar to how this ...

How to Run Selenium Webdriver Java Code in Eclipse via Command Line?

I am currently working with Windows Server 2003 and I am in the process of creating a webpage. I need a specific Java test case to be executed when I click a button on the webpage (which is hosted on the same server). The first step is to figure out how to ...

What steps should I follow to update this React Navigation v5 code to v6?

As I delve into my studies on React Native, I came across the deprecation of the tabBarOptions feature. I understand that now we need to include it in screenOptions, but I'm facing issues with implementing this in my code. I tried enclosing them in br ...

Tips for incorporating dynamic content into React Material UI expansion panels while maintaining the ability to have only one tab active at a time

I'm working on a project using WebGL and React where I generate a list of users from mock data upon clicking. To display this content in an accordion format, I decided to use Material UI's expansion panel due to my positive past experience with ...

Can you please elaborate on the concept of type coercion in JavaScript?

I've come across information stating that when comparing an object with a number, type-coercion occurs. ToPrimitive is called on the object which then invokes valueOf and, if necessary, toString. However, I'm struggling to understand how this pro ...

Is there a way to verify the file extension in a multi-input form during an upload process?

I am looking for a solution that requests users to upload 4 different files when filling out the form. Check out this example of one of the inputs: <div class="custom-file"> <input type="file" class="custom-file-input" accept="video/*" id="v ...

Filtering and selecting tables in HTML

I am dealing with an HTML table that combines static data and MySQL input. The filtering functionality is working properly, but I am struggling to add the options "yes" and "no" to the selection list. These values are test inputs fetched from MySQL. I need ...

When using PHP to echo buttons, only the value of the last echoed button will be returned in JavaScript

I am encountering an issue when trying to define a dynamic var for button value in my JavaScript code. Despite it working in PHP, the same code does not seem to function properly in JavaScript. Imagine I have three buttons echoed using PHP with values 1, ...