mercredi 21 octobre 2020

Testcafe - Selecting an element in Shadowroot is not working

I have this website https://www.storytel.com/sg/en/where I am trying to click on the button (refer to the image) in the Subscription Component which resides in the Shadowroot. I have tried with the following codes but it didn't work. It will be great if someone can help. Thanks in advance.

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);
});

enter image description here

Aucun commentaire:

Enregistrer un commentaire