Testcafe - 无法点击按钮

Testcafe - Unable to click on a button

我想点击一个按钮,但出于某种奇怪的原因,我无法点击。这是代码。

import { ClientFunction } from 'testcafe';
import { Selector } from 'testcafe';

fixture `Fixture`    
    .page `https://viewshape.com/shapes/12b5ntdyuf7`

test(`test`, async t => {    

    await t.maximizeWindow();
    await t.wait(3000);

    const fullScreen = Selector('.sp-controls-btn.js-sp-fullscreen-button').filterVisible();   

    //await t.debug();

    await t
        .expect(fullScreen.with({visibilityCheck: true}).exists)
        .ok({timeout: 30000})
        .hover(fullScreen)
        .click(fullScreen);
    await t.wait(4000);

});

但是,如果我使用 .debug() 进入调试模式,然后在调试器中使用 Next-Action 选项,则 .click() 有效。

我不明白这里发生了什么。为什么 .click() 在 .debug() 中工作但在正常流程中不工作。

当在 DOM 元素上执行 Testcafe 单击操作时,它会调用 element.click() 方法。提到的“无法在 'Element' 上执行 'requestFullscreen'”错误意味着单击事件处理程序调用了 requestFullscreen 方法,该方法只能在用户交互中调用。这是浏览器的安全限制,没有办法克服。