【发布时间】:2021-02-15 09:55:37
【问题描述】:
我正在尝试运行它
await hoverElement.hover();
让鼠标悬停在相关元素上
我收到一条错误提示 TypeError: hoverElement.hover is not a function
我正在阅读剧作家 API 文档https://playwright.dev/#version=v1.5.2&path=docs%2Fapi.md&q=elementhandlehoveroptions
我做错了什么?
test('Selection using hover Speak', async () => {
if (EnableTests.run_hover_speak === "true") {
const expectedResult = TestPage.Div2_Expected_Result;
const hoverElement = TestPage.Div2_css;
await test_functions._hoverSpeak(page);
await hoverElement.hover();
const highlightedText = await test_functions._hiliteSelection(page);
const actual = JSON.stringify(highlightedText); console.log("ACTUAL RESPONSE " + actual);
const expected = JSON.stringify(expectedResult); console.log("EXPECTED RESPONSE " + expected);
assert(expected === actual);
};
});
【问题讨论】:
-
你能多分享一点你的代码吗?
-
听起来 hoverElement 不正确
-
我在帖子中分享了更多代码
标签: javascript testing automation playwright