-
-
Save jimevans/cddaa08392cf556eb2d08b1513623901 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.fixture | |
def test_shadow_page(inline, shadow_content): | |
return inline(""" | |
<custom-shadow-element></custom-shadow-element> | |
<script> | |
customElements.define('custom-shadow-element', | |
class extends HTMLElement {{ | |
constructor() {{ | |
super(); | |
this.attachShadow({{mode: 'open'}}).innerHTML = ` | |
{{ {0} }} | |
`; | |
}} | |
}}); | |
</script>""".format(shadow_content)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.parametrize("using,value", | |
[("css selector", "#linkText"), | |
("link text", "full link text"), | |
("partial link text", "link text"), | |
("tag name", "a"), | |
("xpath", "//a")]) | |
def test_find_element(session, test_shadow_page, using, value): | |
# Step 8 - 9 | |
session.url = test_shadow_page("<div><a href=# id=linkText>full link text</a></div>") | |
custom_element = session.find.css("custom-shadow-element", all=False) | |
shadow_root = custom_element.shadow_root | |
response = find_element(session, shadow_root, using, value) | |
assert_success(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment