This is the link to my website:
DM :
This is where you can find the locator for accepting all buttons:
@FindBy( xpath = "//button[@data-testid = 'uc-accept-all-button']")
WebElement cookies;
This snippet shows some HTML code:
I am using Selenium 4 and Java. I attempted a solution like this one:
public void acceptAllCookies( ) {
cookies = driver.executeScript("return document.querySelector('#usercentrics-root').shadowRoot.querySelector("cookies")");
cookies.click();
}
Unfortunately, the above solution did not work as expected and resulted in an error message:
If anyone could offer assistance, it would be greatly appreciated. As a beginner, I am encountering this issue for the first time.
I even tried adding additional quotation marks based on a solution I found here, but ended up getting the entire executeScript command as text.