Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Automation WebdriverIO Browser.click语句不是函数错误_Automation_Webdriver Io - Fatal编程技术网

Automation WebdriverIO Browser.click语句不是函数错误

Automation WebdriverIO Browser.click语句不是函数错误,automation,webdriver-io,Automation,Webdriver Io,我是WebDriverIO框架的新手,我尝试自动化以下场景: const assert = require('assert'); describe('Second Test With WebDriverIO', () => { it('Click the button for WebDriverIO Page', () => { browser.url('http://www.kevinlamping.com/webdriverio-course-con

我是WebDriverIO框架的新手,我尝试自动化以下场景:

const assert = require('assert');

describe('Second Test With WebDriverIO', () => {

    it('Click the button for WebDriverIO Page', () => {

        browser.url('http://www.kevinlamping.com/webdriverio-course-content/');
        var title = browser.getTitle();
        assert.strictEqual(title,'Robot Parts Emporium');
        //browser.click('.shop-callout a');
        $('.shop-callout a').click();
        title = browser.getTitle();
        assert.strictEqual(title,'Totally Not Evil Sentient Robot - Robot Parts Emporium');

    });
});
但是,我在提到[chrome windows nt#0-0]浏览器时遇到一个错误。单击不是一个功能“

但我使用
$('.shop callout a')。单击()而不是
浏览器。单击('.shop callout a')然后一切正常

const assert = require('assert');

describe('Second Test With WebDriverIO', () => {

    it('Click the button for WebDriverIO Page', () => {

        browser.url('http://www.kevinlamping.com/webdriverio-course-content/');
        var title = browser.getTitle();
        assert.strictEqual(title,'Robot Parts Emporium');
        //browser.click('.shop-callout a');
        $('.shop-callout a').click();
        title = browser.getTitle();
        assert.strictEqual(title,'Totally Not Evil Sentient Robot - Robot Parts Emporium');

    });
});

任何帮助都将不胜感激。

使用
浏览器。element单击(elementId)
,而不是
浏览器。单击()
,因为这是符合webdriver协议的正确方法名称

见下文:-


$(选择器)。click()
是WebDrivero提供的自定义方法,它们使用了与上述相同的方法。

使用
浏览器。元素click(elementId)
,而不是
浏览器。click()
,因为根据webdriver协议,这是正确的方法名称

见下文:-

$(选择器)。click()
是WebDrivero提供的自定义方法,它们使用了与上述相同的方法