Javascript Night watch pageobject元素选择器不能使用@notation

Javascript Night watch pageobject元素选择器不能使用@notation,javascript,ui-automation,nightwatch.js,nightwatch,Javascript,Ui Automation,Nightwatch.js,Nightwatch,当使用@notation从测试函数传递到页面对象时,选择器不起作用 这是我的主页对象 module.exports = { url: function () { return this.api.launchUrl; }, elements: { dropdownSelector: { selector: '#input-13', locateStrategy: 'css selector'

当使用@notation从测试函数传递到页面对象时,选择器不起作用

这是我的主页对象

module.exports = {

    url: function () {
        return this.api.launchUrl;
    },

    elements: {
        dropdownSelector: {
            selector: '#input-13',
            locateStrategy: 'css selector'
        },
        dropdownAuthSelector: {
            selector: '#list-item-18-5 > span > span.ml-1',
            locateStrategy: 'css selector'
        },
    },

    commands: [{

        setDropdown(selector, value) {
            let { selectDropdown } = require('../modules/Utils.js');
            selectDropdown(this.api, selector, value);
            return this;
        }

    }]

};
Utils.js

module.exports.selectDropdown = function (self,selector,value) {

    return self.click(selector).click(value);


}
测试js文件

module.exports = {

    '@tags': ['home'],

    'Dashboard Dropdown test'(browser) {
        const homePage = browser.page.homepage();
        homePage
            .navigate()
            //.setDropdown(homePage.elements.dropdownSelector.selector, homePage.elements.dropdownAuthSelector.selector)
            .setDropdown('@dropdownSelector', '@dropdownAuthSelector')
            .assert.urlContains('Authentication').end();
    }

};
所以基本上 setDropdown(homePage.elements.dropdownSelector.selector,homePage.elements.dropdownsauthselector.selector)工作正常,但当我使用@符号时,它不起作用 .setDropdown(“@dropdownSelector”,“@dropdownAuthSelector”)并抛出以下错误

错误 运行时出错。locateMultipleElements()协议操作:无效选择器:指定的选择器无效或非法


运行时出错。locateMultipleElements()协议操作:无效选择器:指定了无效或非法的选择器

由于夜视的排队行为,我认为无法通过@直接访问这些选择器。页面对象命令不会自动添加到主队列。另外,为什么不定义自定义命令主页页面对象,您可以直接访问它们,然后在测试中调用该命令