From 42ccabeb7978483067502da49625fbc123135a41 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Thu, 25 Nov 2021 12:40:09 -0500 Subject: [PATCH] Update a Shadow Root test --- examples/shadow_root_test.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/examples/shadow_root_test.py b/examples/shadow_root_test.py index 87406201..b11a9e3f 100644 --- a/examples/shadow_root_test.py +++ b/examples/shadow_root_test.py @@ -1,14 +1,19 @@ +""" Piercing through shadow-root elements with the "::shadow" selector. + To confirm that "::shadow" works, print text and assert exact text. """ + from seleniumbase import BaseCase class ShadowRootTest(BaseCase): def test_shadow_root(self): - self.open("https://react-shadow.herokuapp.com/Patagonia") - self.click("section.weather::shadow div::shadow button") - self.assert_element('section.weather::shadow img[alt="Patagonia"]') - weather = self.get_text("section.weather::shadow h1") - self.post_message(weather) - self.click('section.weather::shadow a[href="/Kyoto"]') - self.assert_element('section.weather::shadow img[alt="Kyoto"]') - weather = self.get_text("section.weather::shadow h1") - self.post_message(weather) + self.open("https://seleniumbase.io/other/shadow_dom") + print("") + self.click("button.tab_1") + print(self.get_text("fancy-tabs::shadow #panels")) + self.assert_exact_text("Content Panel 1", "fancy-tabs::shadow #panels") + self.click("button.tab_2") + print(self.get_text("fancy-tabs::shadow #panels")) + self.assert_exact_text("Content Panel 2", "fancy-tabs::shadow #panels") + self.click("button.tab_3") + print(self.get_text("fancy-tabs::shadow #panels")) + self.assert_exact_text("Content Panel 3", "fancy-tabs::shadow #panels")