Need to automate by interacting with shadow dow, how can i get such element so i can click on that ???
We can not automate this type of element directly via driver.findElement, because multiple shadow roots available in the node amplify-authenticator.
So here we can automate with help of CSS selector (XPath not working here)
We can automate via CSS selector with help of javascript executor
Open the console, write the -
document.querySelector(âamplify-authenticatorâ) (Here if Shadow root is not open like close then we can automate with help of WebdriverIO)
here cover the all executeScript root via query selector
Then write the code in our class-
JavascriptExecutor jse = (JavascriptExecutor) driver;
WebElement clearData = (WebElement) jse.executeScript(âpaste here executeScrpteâ);
String js = âargument[0].setAttribute(âvalueâ, âwhat you want to sendâ)â;
((JavascriptExecutor)driver).executeScript(js, username);