Automation WebdriverIO Browser.click语句不是函数错误
我是WebDriverIO框架的新手,我尝试自动化以下场景: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
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提供的自定义方法,它们使用了与上述相同的方法