Discovering obscured HTML elements using nightwatchJS

Within the form, there are checkbox and input fields present.

The custom-styled checkbox appears hidden in the browser view due to CSS settings (opacity: 0). An example can be found here.

Due to this styling, nightwatchjs is unable to detect whether the checkbox exists or not.

Is there a way to overcome this issue?

formFieldsExist:function(){
  return this
             .assert.visible('#name')
             .assert.visible('#yesOrNo')
             .pause(2000)
}

1) How can hidden elements be detected if they exist or not?

2) If a solution exists, how can the status of the checkbox (true or false) be detected?

Answer №1

In case the concealed element is hidden using a style declaration such as style="visibility: hidden;", here are some ways you can address it.

Using nightwatch:


.useXpath()
.waitForElementVisible("//*[@style='visibility: hidden;']", 1000)

For python:


driver.find_elements_by_xpath("//*[@style='visibility: hidden;']")

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

Tips for presenting information from MONGODB in the HTML of ANGULAR 5

It's been a challenge for me since yesterday. I've been working with an API that fetches data from mongodb (mlab.com). var helpers = require('../config/helper.js'); var UserModel = require('../model/UserModel.js'); module.ex ...

What is the process for importing from vueuse into Vue SFC Playground?

After attempting to integrate vueuse through an Import Map using the code @vueuse/core": "https://www.unpkg.com/@vueuse/core?module, I encountered an issue where reactivity was not functioning as expected in vueuse. The import process appeared t ...

Display the returned API data in a dropdown menu

I'm attempting to populate a dropdown list using JavaScript/jQuery (either one will suffice). Here is the code I've tried so far - $(document).ready(function () { $.ajax({ type:"POST", url: "function.php", //dataType: "j ...

Discover the secret to smoothly scrolling to an element in ReactJs

Currently, I am in the process of constructing a Single Page Application (SPA) using React and one key functionality I need to implement is navigation that scrolls to specific sections on the page when clicked. This behavior is similar to how anchor tags w ...

Asynchronous callback in mongoose with an undefined value

I am utilizing 'mongoose' and 'async'. While my search functionality is operational, I encounter an issue where my data does not get passed in the final callback. The variable always ends up being undefined. Despite referencing the mong ...

MongoDB Error: Unable to establish connection with server [localhost:27017]

When I try to run node server.js, I encounter the following error: MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017] at Pool.<anonymous> (/home/islam/workspace/project/n ...

Setting up jQuery UI

I recently downloaded jQuery UI and found myself overwhelmed with the numerous files that came with it. I am unsure if I need to use all of them or where they should be placed. Here is what I have: css/ development-bundle/ js/ index.html I moved the fol ...

Utilizing the power of THREE.ShaderLib.phong while integrating subsurface scattering within ThreeJS

My mesh utilizes a ShaderMaterial with THREE.ShaderLib.phong uniforms. I have successfully linked the map, bump, and specular maps textures. The code snippet below demonstrates this: defines = {}; defines["USE_MAP"] = ""; defines["USE_BUMPMAP"] = ""; defi ...

How to flatten an array in JavaScript without relying on the reduce library

In my code, there is a nested array called $scope.instruments which contains the following: Collapsed view: https://i.sstatic.net/Aii9N.png Expanded view: https://i.sstatic.net/Fh5Bz.png Additionally, I have an object: https://i.sstatic.net/qd8Xn.png ...

Optimal approach for transferring numerous variables with ajax

As a newcomer to jquery, I find myself inquiring about the most efficient approach for transmitting multiple variables to php through ajax. Should I bundle them up like this: $.ajax({ data:{ input: {x: 1, y: 2} }, ... }) or should I s ...

Leveraging retrieved API data to generate numerous components

Hey there! I'm new to JavaScript and I'm working on creating a todo list with fake ToDos from jsonplaceholder using Fetch. My goal is to fetch five different ToDos and display them in separate list items within my list. However, I'm encounte ...

Generate a list of keys along with an array containing sets of values

In my thesaurus app, users can enter a base word like "dog" and its synonyms like "canine, hound, mutt." Once entered, these words are stored in a database. However, to streamline the process and avoid multiple form submissions, I want to create simultaneo ...

How come webpack commonChunk is causing duplication of packages across my bundles?

I am aiming to generate a vendor.bundle.js file using my modules. I have set up webpack as follows: ... entry: { app: ['./src/index.js'], vendor: [ 'axios', 'lodash', 'recharts', &a ...

Adjust color in real-time with JavaScript

I am using a json file to store data for generating a diagram, and I want to change the color of the diagram conditionally based on an attribute in the json. If the attribute is false, the color should be red, and if true, it should be green. Here is a sni ...

Guide to using JavaScript to populate the dropdown list in ASP

On my aspx page, I have an ASP list box that I need to manually populate using external JavaScript. How can I access the list box in JavaScript without using jQuery? I am adding the JavaScript to the aspx page dynamically and not using any include or impor ...

Tips for transferring a prop from a parent component to a child in Vue.js

I have a main component named Stepper that includes a child component called ShortSummary. I am attempting to pass a property from Stepper to ShortSummary by clicking on a radiobutton, but it is not working! Here's my setup. This is the code for Stepp ...

Exploring the power of Blowfish encryption with Java and JavaScript

I am facing an issue where I need to encrypt data using Blowfish on a java-based server and send it to a client. Despite successfully encrypting the data, I am unable to decrypt it on the client side. Below is my Java code snippet: byte[] kd = key.getByt ...

Having trouble with Postgres not establishing a connection with Heroku

My website is hosted on Heroku, but I keep encountering the same error message: 2018-05-06T19:28:52.212104+00:00 app[web.1]:AssertionError [ERR_ASSERTION]: false == true 2018-05-06T19:28:52.212106+00:00 app[web.1]:at Object.exports.connect (_tls_wrap.js:1 ...

Is it possible to add animation to an SVG filter to create a captivating rotating planet with color effects?

I've added a filter to my self-created SVG and I'm interested in animating it so that the colors move diagonally, giving the appearance of a spinning planet. Below is the code featuring my SVG and how I'd like it to begin with the blue colo ...

Error occurs when attempting to run web scraping process on the second webpage

I am attempting to extract information from a table on a website, but I am facing issues when the page changes. The page changer is also not responding to the loop as expected. Below is the code snippet I am using: import time import requests import pandas ...