I was able to get to iframe in the shadow DOM using the code below, I need to switch to iframe in order to access the objects.Not sure How to do it ..?
public void shadowFrame() {
WebElement sroot = find(By.xpath("//adv-sch[@class='adv sch' and @id='is_new']"));
WebElement shadowRoot = expandRootElement(sroot);
WebElement myiframe =ele.findElement(By.tagName("iframe"));
//This is where I am stuck - I need to switch to iframe and the object I need to access is in iframe.
Can you help How to switch to iframe ..? driver.switchto().iframe(0) will not work
findElement(By.xpath("//input[@placeholder='Search' and @type='text']")) .sendKeys("Last Name");
}
private WebElement expandRootElement(WebElement element) {
WebElement ele = (WebElement) ((JavascriptExecutor) getDriver()).executeScript("return arguments[0].shadowRoot",
element);