Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isPresent command to new Element API #4154

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/api/web-element/commands/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
* @param {String|Object} selector
* @returns {ScopedWebElement}
*/
module.exports.command = function(selector) {
module.exports.command = function (selector) {
return this.createScopedElement(selector, this);
};

// Add the aliases below the existing module.exports.command function
module.exports.command.get = module.exports.command.find;
3 changes: 3 additions & 0 deletions lib/api/web-element/commands/findAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
module.exports.command = function(selector) {
return this.createScopedElements(selector, {parentElement: this, commandName: 'findAll'});
};

// Add the alias below the existing module.exports.command function
module.exports.command.getAll = module.exports.command.findAll;
18 changes: 18 additions & 0 deletions lib/api/web-element/commands/isPresent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// isPresent.js

/**
* Check if an element is present on the page.
*
* @example
* browser.element('<selector>').isPresent();
*
* @since 3.0.0
* @method isPresent
* @memberof ScopedWebElement
* @instance
* @syntax browser.element('<selector>').isPresent()
* @returns {Boolean} returns true if the element is present, false otherwise.
*/
module.exports.command = function() {
return this.runQueuedCommandScoped('isElementPresent', arguments);
};
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions snpashot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html class="no-js" lang=""><head><base href="https://nightwatchjs.org"> <meta charset="utf-8"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="og:title" content=""> <meta property="og:type" content=""> <meta property="og:url" content=""> <meta property="og:image" content=""> <link rel="manifest" href="site.webmanifest"> <link rel="apple-touch-icon" href="icon.png"> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> <meta name="theme-color" content="#fafafa"></head><body> <p>Hello world! This is HTML5 Boilerplate.</p> </body></html>