Skip to content

Commit

Permalink
Create isVisible.js
Browse files Browse the repository at this point in the history
Fixed issue nightwatchjs#4037
  • Loading branch information
Vaaruna2709 committed Feb 25, 2024
1 parent c990fc6 commit 90896b4
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions lib/api/web-element/commands/isVisible.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Determines if an element is visible.
*
* For more info on working with DOM elements in Nightwatch, refer to the
* <a href="https://nightwatchjs.org/guide/writing-tests/finding-interacting-with-dom-elements.html">Finding & interacting with DOM Elements</a> guide page.
*
* @example
* describe('isVisible Demo', function() {
*
* it('test isVisible', function(browser) {
* browser.element('#search')
* .isVisible()
* .assert.equals(true);
* });
*
* it('test async isVisible', async function(browser) {
* const result = await browser.element('#search').isVisible();
* browser.assert.equal(result, true)
* });
*
* after(browser => browser.end());
* });
*
* @since 3.0.0
* @method isVisible
* @memberof ScopedWebElement
* @instance
* @syntax browser.element(selector).isVisible()
* @see https://www.w3.org/TR/webdriver/#is-element-visible
* @returns {ScopedValue<boolean>}
* @alias isDisplayed
*/
module.exports.command = function () {
return this.runQueuedCommandScoped('isElementVisible');
};

0 comments on commit 90896b4

Please sign in to comment.