I am attempting to click an element in a shadow dom. I am using Selenium Webdriver JS. I currently get access the shadow root. I also can find an element. So I thought the last bit clicking it would be straight forward but cant find out how. There is not much support for Shadow Dom with js.
Line await element.click() is the offending code. But cant work out how to click that element.
// This gets the shadow Root
async function getShadowRoot() {
let shadowHost;
await (shadowHost = await driver.wait(until.elementLocated(By.css("body > div.project > sn-component-va-web-client"))),5000);
return driver.executeScript("return arguments[0].shadowRoot", shadowHost);
};
//This find element inside the shadow Dom.
async function findShadowDomElement() {
let shadowRoot;
let element;
await (shadowRoot = getShadowRoot());
await shadowRoot.then(async (result) => {
await (element = result.findElement(By.css("div.menu-item.contact-support-clicker")));
await element.click()
});
return element
}