Error while running .locateMultipleElements() protocol action: Given css selector expression "@gettingstartedMenu" is invalid: SyntaxError: '@gettingstartedMenu' is not a valid selectormodule.exports = { url: function () { return "https://nightwatchjs.org/"; }, elements: { page: "#index-container" }, sections: { menu: { selector: "#navbar", locateStrategy: 'css selector', elements: { gettingstartedMenu: "#navbar > ul > li > a[href=\"/gettingstarted\"]", guideMenu: "#navbar > ul > li > a[href=\"/guide\"]" }, commands: [{ getTextFotGuide: function (callback) { this.api.getText("css selector", "#navbar > ul > li > a[href=\"/guide\"]", callback); return this; },
getTestForGettingStarted: function (callback) { this.api.getText( "@gettingstartedMenu", callback); return this; } }] }, examples: { selector: "#example", locateStrategy: 'css selector', } }};const { client, createSession, closeSession, startWebDriver, stopWebDriver, getNewScreenshots} = require('nightwatch-api');
const chai = require('chai');const expect = chai.expect;
describe('Nightwatch api', function () {
this.timeout(60000); before(async () => { await startWebDriver({env: process.env.NIGHTWATCH_ENV || 'firefox'}); await createSession({env: process.env.NIGHTWATCH_ENV || 'firefox'}); });
after(async () => { await closeSession(); await stopWebDriver(); });
it.only('works with section commands', async function () { const nightwatch_page = client.page.nightwatch(); await nightwatch_page .navigate() .section .menu .getTextFotGuide((result) => { expect(result.value).to.contain("Guide") }) .getTestForGettingStarted((result) =>{ expect(result.value).to.contain("Started") }) });}); search: function(searchTerm) { const page = this; page.waitForElementVisible("@table", 30000) .setValue('@searchField', searchTerm); return page; },.... sections: { myFooterSection: { selector: '#my-footer', locateStrategy: 'css selector', elements: { myLogo: { selector: '.my-logo', locateStrategy: 'css selector' } }, commands: [ { myMoveToLogo: function () { this.moveToElement('@myLogo', this.props.myLogoX, this.props.myLogoY); } } ], .....--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/a9483081-d00a-4d77-8a55-28c2befdbbf6%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to nightw...@googlegroups.com.