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

Turning off CSS on a Wordpress page

I need some assistance with WordPress and CSS. By default, WordPress applies CSS to all posts and pages. However, I want to disable specific CSS styles for certain objects on the page. For example: When I insert a table, it automatically inherits the CSS ...

Looking to interact with a dropdown menu using Selenium WebDriver automation script?

Seeking help on clicking a dropdown button with Selenium WebDriver code. The HTML structure in question is as follows: <div class="btn-group bootstrap-select show-tick ua-bo-select" style="width: 222px;"> <button class="btn dropdown-toggle bs-p ...

The float right attribute doesn't stay contained within the box; instead, it drifts outside the box

I've been struggling to keep this box fixed at the top of the browser, but I'm facing an issue with the positioning on the right side. I can't seem to figure out how to solve it, so I'm reaching out for some help. #StickyBar #RightSide ...

Seeking out elements on a webpage using XPath in Selenium Webdriver C# for search results

Recently, I started learning Selenium and decided to practice by automating flight bookings on Webjet (www.webjet.com.au). Unfortunately, I faced some challenges when trying to locate the search results. Even after inspecting the link in Firebug, I found t ...

Angular js is a powerful framework that allows for the seamless transition of views, except for the home

I am currently using the ng-animate module to implement sliding effects for my app views. Each route has its own unique slide animation. Take a look at my simple code below: HTML: <div ng-view ng-animate class="slide"></div> CSS: /*Animatio ...

Tips for fixed positioning of a div on a webpage without being affected by the Windows logo shortcut keys + Left/Right arrow

Whenever I utilize the keyboard shortcuts to move a window from one side of the screen to another and then minimize it either upwards or downwards, I find myself faced with an issue. I can accomplish this action by using the Windows key in combination with ...

If you click outside of a Div element, the Div element will close

I am looking for a way to implement a function that will hide a specific div when I click outside of its area. The div is initially set to Position: none and can be made visible using the following function: Div Element: <div id="TopBarBoxInfo1" oncli ...

Jquery refuses to conceal a particular element

I've encountered this issue before, but I'm facing a problem this time. I'm attempting to create a popup that is initially hidden. When clicked, the popup does appear, but I'm unable to close it. Additionally, when trying to change the ...

Revamping CSS for a Responsive Wordpress Tesseract Theme

I'm currently in the process of developing a website using the Tesseract theme at thevandreasproject.com. However, I have encountered an issue with responsiveness when integrating the SiteOrigins PageBuilder plugin. The compatibility between PageBuild ...

Automatically granting permission on Google Chrome pop-ups with Selenium and Java

After researching, I found a method for handling notifications in Google Chrome versions below 50 and another method for versions above 50. However, I am currently using Google Chrome 91. An answer on this topic can be found here: How to click Allow on Sh ...

My custom styles no longer seem to be applying after upgrading Angular Material from version 14 to 15. What could be causing this issue

Having some challenges with the migration from Angular 14 to Angular 15 when it comes to overriding material UI elements and themes. Looking for blog posts or documentation that can provide guidance on how to smoothly transition. Specifically, experiencin ...

Utilizing spans to adjust the formatting of text within list items

When it comes to shaping text inside li elements, I've encountered a few issues. One of the problems is that the float-right divs aren't floating to the top right corner but instead leaving a space at the top. Additionally, the text isn't &a ...

Is there any way to determine if Bootstrap has been utilized to build my WordPress page?

I'm currently contemplating if it's worth incorporating Bootstrap into my pre-existing Wordpress site. During my research, an interesting thought crossed my mind - could the template I'm utilizing already be built with Bootstrap? Although a ...

Saving a targeted image with C# Selenium Webdriver no matter its whereabouts

There are many examples of how to save an image by taking a screenshot, but this method has a major flaw. The issue is that the screenshot only captures what is visible on the page at that moment. So, if there is an image at the bottom of the page and you ...

Grid layout with card tiles similar to Google Plus

I'm looking to develop a scrolling grid with card tiles similar to Google Plus that has three columns. I am currently using Material UI, but I can't seem to find the right functionality for this. I have experimented with the standard Material UI ...

Packaging an Angular project without the need for compiling

In order to enhance reusability, I structured my Angular 6 Project into multiple modules. These modules have a reference to a ui module that contains all the style sheets (SASS) as values such as: $primary-text-color: #dde7ff !default; Although this app ...

Is it feasible to use both position absolute and position sticky at the same time? If so, how can this be accomplished?

Is there a way to keep an element fixed on the display without using position: fixed? I want the element to always remain above other elements, so I used z-index. Additionally, I would like the element to be able to move horizontally without scrolling acro ...

Tips for making a sidebar sticky when scrolling

In order to keep the right-side bar fixed, I have implemented this javaScript function: <script type="text/javascript> $(document).ready(function () { var top = $('#rightsidebar-wrapper').offset().top - parseFloat($('#rightsideb ...

I desire my grid to exhibit an identical appearance to that of the jquery datepicker

I have an interactive element called the "open grid" that, when clicked on, reveals a grid of buttons. I'm looking for help with coding it so that instead of being displayed below the textbox, the grid of buttons can be hovered over the "open grid" li ...

Trouble with SCSS Nesting

Can anyone help me with styling an H3 and a p tag within a div? I'm facing an issue where the p tag is not being styled in this code block: .marketing-single-page-titles{ h3 { margin: 0; padding: 0; p { margin: 0; padding: 0; position: rel ...