Confirming class Value with Selenium IDE

I am looking to confirm the value of a specific class within an HTML code using Selenium IDE. Specifically, I want to retrieve the value of: data-val located under the class named tgl. In my example, this value can be either 0 or 1. How can I achieve this using Selenium IDE? How can I validate that the value is either 0 or 1?

<!DOCTYPE html>
<html>
   <head>
   <body id="rpt-page-control-wafd" data-dir="ltr" data-lang="en" dir="ltr">
  <div id="wrapper">
  <div id="nav" style="background-color: transparent;">
  <div id="page-ext">
  <div id="page-content">
  <div id="page-main" class="module module-simple" style="left:0px;top:0px;width:1008px;height:532px;display:;">
     <div id="wafd-t" class="cont cont-full" style="left: 0px; top: 91px; width: 1008px; height: 441px; background-color: transparent;">
        <div class="cont-grid cont-grid-extended-header">
           <table id="wafd-t-tblh" class="data-grid data-grid-header" style="background-color: transparent;">
           <table id="wafd-t-tblb" class="data-grid data-grid-body" style="background-color: transparent;">
              <tbody>
                 <tr class="" data-row="1">
                    <td class="col-idx" style="width:72px;" data-max="999.0" data-min="0.0" data-val="1" data-col="CONTROL_WATER_AND_FEED__Day">
                    <td class="hour editable" style="width:80px;" data-max="1440.0" data-min="0.0" data-val="01:01" data-col="CONTROL_WATER_AND_FEED__Time">
                    <td class="tgl" style="width: 60px; background-color: rgb(244, 244, 244);" data-val="0" data-col="water_1">
                    <td class="tgl" style="width: 60px; background-color: rgb(244, 244, 244);" data-val="0" data-col="water_2">
                    <td class="tgl" style="width: 60px; background-color: rgb(244, 244, 244);" data-val="1" data-col="water_3">
                    <td class="tgl" style="width:60px;" data-val="0" data-col="water_4">
                    <td class="tgl" style="width:60px;" data-val="0" data-col="feed_1">
                    <td class="tgl" style="width:60px;" data-val="1" data-col="feed_2">
                    <td class="tgl" style="width:60px;" data-val="0" data-col="feed_3">
                    <td class="tgl" style="width:60px;" data-val="0" data-col="feed_4">
                    <td class="tgl" style="width:60px;" data-val="0" data-col="auger_1">
                    <td class="tgl" style="width:60px;" data-val="0" data-col="auger_2">
                    <td class="tgl" style="width:60px;" data-val="0" data-col="auger_3">
                    <td class="tgl" style="width:60px;" data-val="0" data-col="auger_4">
                    <td class="col-edit" style="width:72px;" data-col="col_edit">
                 </tr>
                 <tr data-row="2">
                 <tr data-row="3">
                 <tr data-row="4">
                 <tr data-row="5">
                 <tr data-row="6">
                 <tr data-row="7">
              </tbody>
           </table>
           <table id="wafd-t-tbl" class="data-grid" style="display: none;"></table>
           <div id="wafd-t-tbl-vscroll" class="data-grid-vscroller" style="top: 64px; height: 330px; width: 872px; background-color: transparent;"></div>
        </div>
     </div>
     <div id="wafd-s" class="cont cont-modal" style="left:8px;top:20px;width:992px;height:470px;display:none;">
     </div>
  </div>
  <div id="page-overlay" style="display:none;"></div>
  <div id="page-float-ext" style="display:none;">
  </div>
  <script src="js/common.js?v11">
  <script src="js/plugins/plugin.numkeypad.js?v11">
  <script src="js/plugins/plugin.timekeypad.js?v11">
  <script src="js/plugins/plugin.passcodepanel.js?v11">
  <script src="js/plugins/plugin.datagrid.js?v11">
  <script src="js/plugins/plugin.settingspanel.js?v11">
  <script src="js/plugins/plugin.helppanel.js?v11">
  <script src="js/ESLNS/JSGlobals.js?v11">
  <script src="js/ESLNS/DataServiceUtils.js?v11">
  <script src="js/ESLNS/DataConverts.js?v11">
  <script src="js/libs/moment.min.js">
  <script src="js/page.control-wafd.js">
  <script src="js/libs/jquery-2.0.3.min.js">
  <script src="js/libs/highcharts.js">
  <script src="js/libs/highcharts-more.js">
  <script src="js/libs/yepnope.1.5.4-min.js">
  <script src="js/libs/jquery.touchSwipe.min.js">
  <script src="js/main.js">
  </body>
  </html>
  

Answer №1

To achieve this task, you can use the power of JavaScript. The runScriptAndWait function enables you to compare attribute values with a specific tag. It is essential to pay attention while crafting the script.

runScriptAndWait|

document.querySelector("data-col='CONTROL_WATER_AND_FEED__Day'").getAttribute("data-val")
|1

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

How to retrieve Checkbox label text using Selenium and C#

Trying to extract the text value of a checkbox label. Check out this HTML code snippet <div id="content" class="large-12 columns"> <div class="example"> <h3>Checkboxes</h3> <form id='checkboxes'> &l ...

Tips on correctly determining font size

I'm attempting to style a span element with a specific height (in this case, 23px). However, the browser is automatically adding some extra pixels to the element. There are no additional styles like padding or margin affecting it, just the size of th ...

The Art of Patience in Selenium - Harnessing the Power of

Typically, I use the following code to locate an element with the name "email": WebElement emailInput = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.presenceOfElementLocated(By .name("email"))); But what if there is a ...

Proceed with Selenium script execution even if there is difficulty in finding the element

Whenever I visit a website, I encounter an issue where I need to verify if a specific element is both displayed and enabled. If it meets these conditions, I want to output a message. However, if the element is not displayed or enabled, I need to check for ...

How to create a dynamic background color animation in jQuery similar to a progress bar animation

I have a container with text content (for example: My Name) and it is displayed in a RED background color along with a button. What I am looking for : When the button is clicked, I want to change the background color of the container from RED to BLUE, si ...

I'm looking for the specific numeric keycodes that are compatible with the keyPress function in Selenium. Can anyone point

Check out for details on the keySequence parameter in the keyPress command: You can specify the key to be pressed as either a string (starting with "\" followed by the numeric keycode, usually the ASCII value) or a single character. For example: " ...

The behavior of Mozilla in handling JQuery attr() function may result in variations in design elements such as font-family or font-size

I'm currently working on the login form. Below is my view in CodeIgnitor: <div id="login-form"> <?php echo heading('Login', 2); echo form_open('login/login_user'); echo form_input('email', set_value ...

Placing a button above another element using CSS styled components

I'm attempting to make a button overlap and be positioned in a specific location on top of a search bar. The current appearance is not what I desire, as the button seems to shift back to its original position when adding a :hover element after applyin ...

Can CSS be utilized to consistently display text in a uniform manner?

Currently developing a unique Qur'an app for Muslims, standing out from the already existing ones in the market. There are two common types of Qur'an apps available: one that replicates the exact look of a physical copy, page by page, using imag ...

Angular and Node.js Integration: Compiling Files into a Single File

I have a question, is it possible to include multiple require js files in one file? If so, how can I create objects from them? Calling 'new AllPages.OnePage()' doesn't seem to work. To provide some context, I'm looking for something sim ...

Tips for establishing a framework with Selenium web driver

I am looking to develop a framework using selenium web driver. Where should I begin? My vision is as follows: 1 - Develop a simple GUI where our tester team can log in to access the selenium framework. 2 - I have created several selenium programs for tas ...

I am having trouble with node.js express not recognizing the path to my CSS files

My objective is to load information onto an HTML page using Node.js and Express. The issue I am facing is that when I try to open the main page (which displays all the books from the database), everything works smoothly - the CSS and JS files are located ...

Experiencing issues with verifying text within a dropdown menu on SeleniumIDE version 3.12.1

I have recently started using Selenium IDE after having experience in QA. I am facing an issue with verifying the values in a simple dropdown. Despite setting up the verify text command correctly, the validation is failing. The web page that I am testing ...

What is the best way to stop "a" style from affecting a hyperlink?

I'm facing a challenge in designing a banner for my website that doesn't involve using an image. This banner also needs to be clickable as it will serve as a link. Is there a way for me to prioritize the CSS styling of my div over the default "a ...

Electron JS application for automating headless browser tasks

Exploring the idea of creating an electron app capable of web automation based on user input through a GUI. After conducting research, it appears that my top two options are Phantom and Selenium+Chromedriver. The ultimate goal is to develop an app that ca ...

Tips for inputting text into a textarea using WYSIWYG editor with Behat

Currently, I am attempting to add content to a textarea utilizing a wysiwyg editor (summernote) from a form. To achieve this, I am using the behat featurecontext file. The challenge lies in the fact that the textarea lacks an id tag, prompting me to employ ...

How to Align Navigation Bar Items to the Right in Bootstrap 4

I need some help with bootstrap. I've looked at various discussions on this topic and tried numerous solutions, but I still can't get it right. I want the logo to be on the left and the navigation links aligned to the right. Here's what I&ap ...

The nightwatchjs selector is having trouble selecting an attribute that contains a space

I am currently using nightwatchjs to perform end-to-end tests on a few pages. <div role="tab" aria-selected="true" title="My TV"><span>MyReal TV</span></div> On these pages, I have multiple tabs that I need to validate with code ...

What is the best way to adjust Material UI Grid properties according to the screen size?

I am working with Material UI and have a grid on the homepage that needs to maintain certain properties regardless of screen size. However, I want to apply a negative margin when the screen reaches 1200px or larger (lg). Currently, the grid is set up like ...

Trouble with Displaying Table Outside of Div in Internet Explorer

As a UI developer, I encountered an issue where the table inside two divs is not displaying correctly in IE8. It works seamlessly in Firefox, but IE is causing me headache. If anyone has any suggestions or advice on how to fix this, please help me out. Yo ...