Nightwatch: Timed out while waiting for element to be present. - expected "found" but got "not found"

  • 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 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.

Suggested Topics