【问题标题】:Testcafe - Selecting an element in Shadowroot is not workingTestcafe - 在 Shadowroot 中选择元素不起作用
【发布时间】:2020-10-21 16:01:46
【问题描述】:

我有这个网站https://www.storytel.com/sg/en/我试图单击位于 Shadowroot 中的订阅组件中的按钮(请参阅图像)。我已尝试使用以下代码,但没有成功。如果有人可以提供帮助,那就太好了。提前致谢。

test('Click inside shadowDOM', async t => {
  const shadowBtn = Selector(() => document.querySelector('storytel-subscription').shadowRoot.querySelectorAll('*[data-testid="subscription-card-0-button"]'));

  await t        
      .click(shadowBtn);
});

【问题讨论】:

  • 为什么选择器中有 *
  • 因此它与任何具有 data-testid="subscription-card-0-button" 属性的标签匹配

标签: testing automated-tests selector testcafe shadow-dom


【解决方案1】:

shadow dom 中的处理元素似乎存在错误。我建议您在 TestCafe GitHub 存储库中创建一个问题并在那里描述您的场景:https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多