Using Nighwatch's POM below is a page function to click a button, page needs to be refreshed and validate if element present.

using this.api.refresh() to refresh the page. But waitForElementPresent fails:

checkfile: function () {
        return this
            .waitForElementVisible('@notification', 45000)
            .waitForElementPresent('@dashboardButton', 30000)


The .waitForElementPresent('@dashboardButton', 30000) returns error:

Error while running .locateMultipleElements() protocol action: invalid selector: An invalid or illegal selector was specified

Timed out while waiting for element <@dashboardButton> to be present for 30000 milliseconds. - expected "found" but got: "not found"


It might be useful for you to provide the selectors in @notification and @dashboardButton for additional troubleshooting. The error indicates a problem with the syntax, or a character that the browser you're testing with doesn't like, in one of those two decorators.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.