0

I am trying to scrape some websites, one of them has a 'Accept cookies' button which is nested inside a shadow root. I have posted a question about how to click this button here:

Click on accept cookie buton with R selenium

However, after some help I think the problem is that the element is within a shadow root, and therefore can not be accessed the way I usually do.

website: https://myterminal.ect.nl/app/object-schedule

enter image description here

I have found solutions in Python and Java, but I would like to do it with R selenium, any help will be greatly appreciated.

Kind regards

BillyBouw
  • 314
  • 2
  • 10

1 Answers1

0

I have found a way to do it using R, I am posting it here since I did not find it anywhere else for Rselenium;

remDr$executeScript('return document.querySelector("body > ect-cookie-dialog").shadowRoot.querySelector("#cookie-dialog > div._ect-cookie-dialog__links > div > ect-button").shadowRoot.querySelector("button").click()')
BillyBouw
  • 314
  • 2
  • 10