mirror of
https://github.com/appium/appium.git
synced 2026-10-24 17:51:56 +08:00
35 lines
795 B
HTML
35 lines
795 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>I am a page title with shadow content</title>
|
|
</head>
|
|
<body>
|
|
|
|
<h1>This page is a Shadow DOM sandbox</h1>
|
|
|
|
<appium-form></appium-form>
|
|
|
|
<script>
|
|
customElements.define('appium-form', class extends HTMLElement {
|
|
connectedCallback () {
|
|
this.attachShadow({mode: 'open'});
|
|
// add html with style, which _will_ cause a circular reference when parsed
|
|
// by Selenium
|
|
this.shadowRoot.innerHTML = `<p>
|
|
<style>
|
|
:host {
|
|
display: block;
|
|
}
|
|
</style>
|
|
<button id="shadowButton">Click me</button>
|
|
</p>`;
|
|
this.shadowRoot.firstElementChild.onclick = (e) => alert(`Inner target: ${e.target.tagName}`);
|
|
}
|
|
});
|
|
|
|
document.onclick = (e) => alert(`Outer target: ${e.target.tagName}`);
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|