【发布时间】:2021-07-29 10:55:43
【问题描述】:
我在尝试为元素设置值时发现错误:setValue is not a function。
但我想出了一个解决方案,比如使用 async 函数
describe("Interaction with web elements", function () {
it("Enter Value in a field", async function () {
await browser.url('/');
const Search = await $('#twotabsearchtextbox')
await Search.setValue('MacBook');
})
});
是否有任何其他替代方法来修复它们?
【问题讨论】:
-
您在什么情况下使用
setValue导致该错误? -
setValue(), getText() 任何方法都不能用作同步功能......我只能使用异步 ===>> 你知道任何解决方案
标签: javascript unit-testing automation webdriver-io setvalue