question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test fails when isVisible is called on a non visible element

See original GitHub issue

Consider the following code:

client.isVisible('.my-class', result => {
  if (result.value === true) {/*do something*/}
  else {/*do something else*/}
}

If the element is visible everything works great. However, if the element is not visible the test fails with an error: ERROR: Unable to locate element: ".my-class" using: css selector I believe that isVisible should just return the result and never fail the test.

[Nightwatch version 0.9.5; reproduced w/ Appium over iOS and Selenium over Chrome.]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
eladmoshecommented, Jul 24, 2016

I found a workaround in the mailing list if anyone has this issue.

 browser.element('css selector', 'select', function(result){
            if (result.value && result.value.ELEMENT) {
                // Element is present, do the appropriate tests
            } else {
                // Element is not present.
            }
        });
0reactions
eladmoshecommented, Jul 24, 2016

@senocular Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug the Element Visibility Problems in Cypress
Cypress fails the test when the clearly visible "Cypress is amazing!" element is deemed NOT ... Call isVisible and pass the selected element....
Read more >
Check if element is visible in Playwright - Stack Overflow
Here are two ways to check element is NOT visible (check waitForSelector options): await page.waitForSelector('.btn', { state: 'detached' });.
Read more >
waitForElementVisible() produces false fails - Bugs Report
I've noticed that this method is producing a Pass even when the element cannot be found. I do see that it stops the...
Read more >
isVisible | API Reference - Nightwatch.js
If the element is not found, an error is thrown which will cause the test to fail. You can suppress element not found...
Read more >
Check Visibility of Web Elements Using Various Types ...
Like isDisplayed() method, it is designed to result in a Boolean value with each success and failure. The method returns a “true” value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found