Skip to content

Instantly share code, notes, and snippets.

@seleniumgists
Created July 31, 2020 17:59
Show Gist options
  • Save seleniumgists/a010d31dbcc1d777fdd2fc3da277d839 to your computer and use it in GitHub Desktop.
Save seleniumgists/a010d31dbcc1d777fdd2fc3da277d839 to your computer and use it in GitHub Desktop.
generated automatically from #selenium on seleniumhq slack
<webview webpreferences="eHV5b21fcG9fbGJ1" src="<http://localhost:56995/settings>">
#shadow-root (open)
<style type="text/css">:host { display: flex; }</style>
<iframe style="flex: 1 1 auto; width: 100%; border: 0px;"></iframe>
</webview>```
Here is code snippet in Java. And I can acquire iframe but switching to it leave me at the same parent-context.
```WebDriver driver = WebDriverRunner.getWebDriver();
JavascriptExecutor js = (JavascriptExecutor) driver;
WebElement shadowDom = (WebElement) js.executeScript("return arguments[0].shadowRoot", driver.findElement(By.tagName("webview")));
WebElement iframe = shadowDom.findElement(By.tagName("iframe"));
driver.switchTo().frame(iframe);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment