From 261f0ce1eff63985851f240be6ff1e2d01364fbc Mon Sep 17 00:00:00 2001 From: Simon Benzer Date: Thu, 22 Aug 2024 17:39:24 -0400 Subject: [PATCH 1/5] added shadow dom documentation to finders in all translations --- .../webdriver/elements/finders.en.md | 32 +++++++++++++++++++ .../webdriver/elements/finders.ja.md | 32 +++++++++++++++++++ .../webdriver/elements/finders.pt-br.md | 32 +++++++++++++++++++ .../webdriver/elements/finders.zh-cn.md | 32 +++++++++++++++++++ 4 files changed, 128 insertions(+) diff --git a/website_and_docs/content/documentation/webdriver/elements/finders.en.md b/website_and_docs/content/documentation/webdriver/elements/finders.en.md index 533e13eab3a9..177973c687ef 100644 --- a/website_and_docs/content/documentation/webdriver/elements/finders.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/finders.en.md @@ -108,6 +108,38 @@ driver implementation supports a given feature. These interfaces are clearly def to adhere to having only a single role of responsibility. {{% /pageinfo %}} +### Evaluating the Shadow DOM + +The Shadow DOM is an encapsulated DOM tree hidden inside an element. With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. + +{{< tabpane langEqualsHeader=true >}} +{{< badge-examples >}} +{{< tab header="Java" >}} +WebElement shadowHost = driver.findElement(By.cssSelector("#shadow_host")); +SearchContext shadowRoot = shadowHost.getShadowRoot(); +WebElement shadowContent = shadowRoot.findElement(By.cssSelector("#shadow_content")); +{{< /tab >}} +{{< tab header="Python" >}} +shadow_host = driver.find_element(By.CSS_SELECTOR, '#shadow_host') +shadow_root = shadow_host.shadow_root +shadow_content = shadow_root.find_element(By.CSS_SELECTOR, '#shadow_content') +{{< /tab >}} +{{< tab header="CSharp" >}} +var shadowHost = _driver.FindElement(By.CssSelector("#shadow_host")); +var shadowRoot = shadowHost.GetShadowRoot(); +var shadowContent = shadowRoot.FindElement(By.CssSelector("#shadow_content")); +{{< /tab >}} +{{< tab header="Ruby" text=true >}} +shadow_host = @driver.find_element(css: '#shadow_host') +shadow_root = shadow_host.shadow_root +shadow_content = shadow_root.find_element(css: '#shadow_content') +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ### Optimized locator A nested lookup might not be the most effective location strategy since it requires two diff --git a/website_and_docs/content/documentation/webdriver/elements/finders.ja.md b/website_and_docs/content/documentation/webdriver/elements/finders.ja.md index 47c4adac366d..d1cf6359bd8d 100644 --- a/website_and_docs/content/documentation/webdriver/elements/finders.ja.md +++ b/website_and_docs/content/documentation/webdriver/elements/finders.ja.md @@ -101,6 +101,38 @@ val fruit = fruits.findElement(By.className("tomatoes")) これらのインターフェースは明確に定義されており、責任の役割を1つだけ持つように努めています。 {{% /pageinfo %}} +### Evaluating the Shadow DOM + +The Shadow DOM is an encapsulated DOM tree hidden inside an element. With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. + +{{< tabpane langEqualsHeader=true >}} +{{< badge-examples >}} +{{< tab header="Java" >}} +WebElement shadowHost = driver.findElement(By.cssSelector("#shadow_host")); +SearchContext shadowRoot = shadowHost.getShadowRoot(); +WebElement shadowContent = shadowRoot.findElement(By.cssSelector("#shadow_content")); +{{< /tab >}} +{{< tab header="Python" >}} +shadow_host = driver.find_element(By.CSS_SELECTOR, '#shadow_host') +shadow_root = shadow_host.shadow_root +shadow_content = shadow_root.find_element(By.CSS_SELECTOR, '#shadow_content') +{{< /tab >}} +{{< tab header="CSharp" >}} +var shadowHost = _driver.FindElement(By.CssSelector("#shadow_host")); +var shadowRoot = shadowHost.GetShadowRoot(); +var shadowContent = shadowRoot.FindElement(By.CssSelector("#shadow_content")); +{{< /tab >}} +{{< tab header="Ruby" text=true >}} +shadow_host = @driver.find_element(css: '#shadow_host') +shadow_root = shadow_host.shadow_root +shadow_content = shadow_root.find_element(css: '#shadow_content') +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ### 最適化されたロケーター ネストされたルックアップは、ブラウザに2つの別々のコマンドを発行する必要があるため、最も効果的なロケーション戦略ではない可能性があります。 diff --git a/website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md b/website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md index 89e20a5414f0..2186ff5c2380 100644 --- a/website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md @@ -104,6 +104,38 @@ implementação de driver suporta um recurso específico. Essas interfaces são aderir a ter apenas um único papel de responsabilidade. {{% /pageinfo %}} +### Evaluating the Shadow DOM + +The Shadow DOM is an encapsulated DOM tree hidden inside an element. With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. + +{{< tabpane langEqualsHeader=true >}} +{{< badge-examples >}} +{{< tab header="Java" >}} +WebElement shadowHost = driver.findElement(By.cssSelector("#shadow_host")); +SearchContext shadowRoot = shadowHost.getShadowRoot(); +WebElement shadowContent = shadowRoot.findElement(By.cssSelector("#shadow_content")); +{{< /tab >}} +{{< tab header="Python" >}} +shadow_host = driver.find_element(By.CSS_SELECTOR, '#shadow_host') +shadow_root = shadow_host.shadow_root +shadow_content = shadow_root.find_element(By.CSS_SELECTOR, '#shadow_content') +{{< /tab >}} +{{< tab header="CSharp" >}} +var shadowHost = _driver.FindElement(By.CssSelector("#shadow_host")); +var shadowRoot = shadowHost.GetShadowRoot(); +var shadowContent = shadowRoot.FindElement(By.CssSelector("#shadow_content")); +{{< /tab >}} +{{< tab header="Ruby" text=true >}} +shadow_host = @driver.find_element(css: '#shadow_host') +shadow_root = shadow_host.shadow_root +shadow_content = shadow_root.find_element(css: '#shadow_content') +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ### Localizador otimizado Uma pesquisa aninhada pode não ser a estratégia de localização mais eficaz, pois requer dois comandos separados a serem emitidos para o navegador. diff --git a/website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md b/website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md index 372a13880ed4..d8cd07ef5e42 100644 --- a/website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md @@ -107,6 +107,38 @@ driver implementation supports a given feature. These interfaces are clearly def to adhere to having only a single role of responsibility. {{% /pageinfo %}} +### Evaluating the Shadow DOM + +The Shadow DOM is an encapsulated DOM tree hidden inside an element. With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. + +{{< tabpane langEqualsHeader=true >}} +{{< badge-examples >}} +{{< tab header="Java" >}} +WebElement shadowHost = driver.findElement(By.cssSelector("#shadow_host")); +SearchContext shadowRoot = shadowHost.getShadowRoot(); +WebElement shadowContent = shadowRoot.findElement(By.cssSelector("#shadow_content")); +{{< /tab >}} +{{< tab header="Python" >}} +shadow_host = driver.find_element(By.CSS_SELECTOR, '#shadow_host') +shadow_root = shadow_host.shadow_root +shadow_content = shadow_root.find_element(By.CSS_SELECTOR, '#shadow_content') +{{< /tab >}} +{{< tab header="CSharp" >}} +var shadowHost = _driver.FindElement(By.CssSelector("#shadow_host")); +var shadowRoot = shadowHost.GetShadowRoot(); +var shadowContent = shadowRoot.FindElement(By.CssSelector("#shadow_content")); +{{< /tab >}} +{{< tab header="Ruby" text=true >}} +shadow_host = @driver.find_element(css: '#shadow_host') +shadow_root = shadow_host.shadow_root +shadow_content = shadow_root.find_element(css: '#shadow_content') +{{< /tab >}} +{{< tab header="JavaScript" >}} +{{< /tab >}} +{{< tab header="Kotlin" >}} +{{< /tab >}} +{{< /tabpane >}} + ### Optimized locator A nested lookup might not be the most effective location strategy since it requires two From 0271018c55f77ddb4c23cb2fab0a96b73be7b8f2 Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:35:13 -0400 Subject: [PATCH 2/5] reduced line-count --- .../content/documentation/webdriver/elements/finders.en.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website_and_docs/content/documentation/webdriver/elements/finders.en.md b/website_and_docs/content/documentation/webdriver/elements/finders.en.md index 177973c687ef..d3e72962f547 100644 --- a/website_and_docs/content/documentation/webdriver/elements/finders.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/finders.en.md @@ -110,7 +110,9 @@ to adhere to having only a single role of responsibility. ### Evaluating the Shadow DOM -The Shadow DOM is an encapsulated DOM tree hidden inside an element. With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. +The Shadow DOM is an encapsulated DOM tree hidden inside an element. +With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with +easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. {{< tabpane langEqualsHeader=true >}} {{< badge-examples >}} From 0703150163d2b27d809e89988277bdff083b859a Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:35:37 -0400 Subject: [PATCH 3/5] reduced line-count --- .../content/documentation/webdriver/elements/finders.ja.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website_and_docs/content/documentation/webdriver/elements/finders.ja.md b/website_and_docs/content/documentation/webdriver/elements/finders.ja.md index d1cf6359bd8d..1b1b676b9577 100644 --- a/website_and_docs/content/documentation/webdriver/elements/finders.ja.md +++ b/website_and_docs/content/documentation/webdriver/elements/finders.ja.md @@ -103,7 +103,9 @@ val fruit = fruits.findElement(By.className("tomatoes")) ### Evaluating the Shadow DOM -The Shadow DOM is an encapsulated DOM tree hidden inside an element. With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. +The Shadow DOM is an encapsulated DOM tree hidden inside an element. +With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree +with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. {{< tabpane langEqualsHeader=true >}} {{< badge-examples >}} From beba834aac1c820e58e6e1fab82728791f215f6a Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:36:01 -0400 Subject: [PATCH 4/5] reduced line-count --- .../content/documentation/webdriver/elements/finders.pt-br.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md b/website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md index 2186ff5c2380..194dab752908 100644 --- a/website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md @@ -106,7 +106,9 @@ aderir a ter apenas um único papel de responsabilidade. ### Evaluating the Shadow DOM -The Shadow DOM is an encapsulated DOM tree hidden inside an element. With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. +The Shadow DOM is an encapsulated DOM tree hidden inside an element. +With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree +with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. {{< tabpane langEqualsHeader=true >}} {{< badge-examples >}} From 6d3395be90c564eb8f959c03316f0216548538b8 Mon Sep 17 00:00:00 2001 From: Simon Benzer <69980130+shbenzer@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:36:28 -0400 Subject: [PATCH 5/5] reduced line-count --- .../content/documentation/webdriver/elements/finders.zh-cn.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md b/website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md index d8cd07ef5e42..316d346f5b95 100644 --- a/website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md @@ -109,7 +109,9 @@ to adhere to having only a single role of responsibility. ### Evaluating the Shadow DOM -The Shadow DOM is an encapsulated DOM tree hidden inside an element. With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. +The Shadow DOM is an encapsulated DOM tree hidden inside an element. +With the release of v96 in Chromium Browsers, Selenium can now allow you to access this tree +with easy-to-use shadow root methods. NOTE: These methods require Selenium 4.0 or greater. {{< tabpane langEqualsHeader=true >}} {{< badge-examples >}}