无法使用Test Cafe播放视频,Click事件未播放视频。我可以将鼠标悬停在特定元素上,但是当我单击它时,应该开始播放视频。但它无法播放。
const logger = RequestLogger({ url: 'URL', method: 'post' },
{ logResponseBody: true, logRequestBody: true, stringifyResponseBody: true, stringifyRequestBody: true });
const obj = 'URL';
await t.navigateTo(obj.uri);
const loader = Selector('.web_player_loader.loader');
await t.expect(loader.exists).notOk({ timeout: 30000 });
console.log('Video Started....');
const playerBase=Selector('.player-base');
await t.hover(playerBase);
await t.click(playerBase);
console.log('Logger Request Length is ',logger.requests.length);```
I am running the script using following params.
testcafe chrome --autoplay-policy=no-user-gesture-required ./tests -s takeOnFails=true --skip-js-errors=true
Getting this error in the Console.
main.dad0fa6441f0af49d386.js:2 Uncaught (in promise) TypeError: Cannot read property 'topLPVs' of undefined
at t.value (main.dad0fa6441f0af49d386.js:2)
at e.value (main.dad0fa6441f0af49d386.js:2)
at e.value (main.dad0fa6441f0af49d386.js:2)
at t.<anonymous> (main.dad0fa6441f0af49d386.js:2)
at l (vendor~main.58.ac1d1027b98ee8b3b2d1.js:9)
at Generator._invoke (vendor~main.58.ac1d1027b98ee8b3b2d1.js:9)
at Generator.next (vendor~main.58.ac1d1027b98ee8b3b2d1.js:9)
at n (hammerhead.js:15)
at value (hammerhead.js:6)
at n (vendor~main.58.ac1d1027b98ee8b3b2d1.js:2)
at a (vendor~main.58.ac1d1027b98ee8b3b2d1.js:2)
根据您提供的调用堆栈,看来您的应用程序中发生了错误。发生这种现象的原因是testcafe点击的速度比最终用户快,并且被测试页面上的初始化代码可能没有足够的时间来完成。如果您要在悬停和点击操作之间添加延迟,请问是否会发生相同的错误?
t.hover(playerBase)
.wait(1000)
.click(playerBase);
如果重现错误,您可以分享一个显示错误的示例吗?我将在本地进行研究。