1

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
            .click('@confirmButton')
            .waitForElementVisible('@notification', 45000)
            .pause(1000)
            .api.refresh()
            .pause(10000)
            .waitForElementPresent('@dashboardButton', 30000)
            .end();
            
    }

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"

2 Answers 2

0

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.

0

I would change your structure slightly:

checkfile: function () {
    this
        .click('@confirmButton')
        .waitForElementVisible('@notification', 45000)
        .pause(1000)
        .api.refresh()
    this
        .pause(10000)
        .waitForElementPresent('@dashboardButton', 30000)
        .end();
    return this;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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