【发布时间】:2021-08-21 23:08:20
【问题描述】:
我正在使用以下语句编写一个简单的 WDIO 选择器。我能够在浏览器中唯一地识别它。不知道为什么 WDIO 无法设置该值。
Given(/^I am on the login page$/, function () {
browser.url('https://secure-sandbox.modulrfinance.com/')
browser.maximizeWindow()
});
When(/^I enter password as \"([^\"]*)\"$/, function (password:string) {
//const txt_username = $('#username-inp')
//const txt_password = $('#password-inp')
$('#username-inp').setValue('')
$('#password-inp').setValue(password)
});
Then(/^I should see a flash message under username saying \"([^\"]*)\"$/, async function () {
const banner = await $('#.ng-star-inserted')
expect(banner).toHaveText('This field is required1')
});```
**error**
**[0-0] error: 'no such element',
[0-0] message: 'no such element: Unable to locate element: {"method":"css selector","selector":"#password-inp"}\n'** +
【问题讨论】:
-
你能为这个元素添加你的 DOM 细节吗?
标签: webdriver-io