无法使用 Test Cafe 播放视频,Click 事件不执行任何操作
Not able to play Video using Test Cafe, Click event is doing nothing
无法使用 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);
如果错误重现,您能否分享一个显示错误的示例?我会在当地研究一下。
执行命令有问题。早些时候我使用的是 testcafe chrome --autoplay-policy=no-user-gesture-required src/tests/.js -s takeOnFails=true。但现在我将其更改为 testcafe 'chrome --autoplay-policy=no-user-gesture-required' src/tests/.js -s takeOnFails=true 并且它起作用了。
无法使用 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);
如果错误重现,您能否分享一个显示错误的示例?我会在当地研究一下。
执行命令有问题。早些时候我使用的是 testcafe chrome --autoplay-policy=no-user-gesture-required src/tests/.js -s takeOnFails=true。但现在我将其更改为 testcafe 'chrome --autoplay-policy=no-user-gesture-required' src/tests/.js -s takeOnFails=true 并且它起作用了。