我在从网页上的元素获取文本时遇到问题。
我正在使用 TestCafe e2e 框架,想要将文本 Web 元素的内容打印到控制台。你能提供一些代码吗?
const getInnerText = ClientFunction(() => homePage.kzLink.innerText);
console.log(getInnerText());
我得到什么:
ReExecutablePromise { _then: [], _fn: [Function], _taskPromise: null }
要执行客户端函数,请使用await 关键字和依赖项来调用它。
const getInnerText = ClientFunction(() => homePage.kzLink.innerText, {
dependencies: { homePage.kzLink }
});
test('My Test', async t => {
const text = await getInnerText();
console.log(text);
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)