Nightwatch: Provided locating strategy is not supported. XPath used

Created on 2 Jul 2015  路  4Comments  路  Source: nightwatchjs/nightwatch

Error while running click command: Provided locating strategy is not supported: //a[@title="edit user [email protected]"]. It must be one of the following:
class name, css selector, id, name, link text, partial link text, tag name, xpath
class name, css selector, id, name, link text, partial link text, tag name, xpath
    at element (c:\Freelance\luxlane\node_modules\nightwatch\lib\api\protocol.js:162:13)
"Edit user": function (browser) {

        browser
            .useXpath()
            .click('//a[@title="edit user ' + tc.TEST_EMAIL2 + '"]', 10000)
            .waitForElementVisible('//h1[contains(text(), "Users edit")]', 10000)
            .end()

    },

Most helpful comment

.click('//a[@title="edit user ' + tc.TEST_EMAIL2 + '"]', 10000)

click doesn't take a timeout parameter. Try .click('//a[@title="edit user ' + tc.TEST_EMAIL2 + '"]')

All 4 comments

Update: If I changed click to waitForElementVisible it works like a charm.

.click('//a[@title="edit user ' + tc.TEST_EMAIL2 + '"]', 10000)

click doesn't take a timeout parameter. Try .click('//a[@title="edit user ' + tc.TEST_EMAIL2 + '"]')

Oh, exactly!

I have also just made the same mistake by providing a timeout parameter to the click command. I would expect for the error message to be different though. As as it currently stands, it made me question my selector. I never doubted my arguments.

Was this page helpful?
0 / 5 - 0 ratings