Skip to content

Commit 984591d

Browse files
committed
added badge codes and fixed ruby code example (#1897)[deploy site]
added badge codes to missing shadow dom examples, and made made ruby code no longer of type text Co-authored-by: Sri Harsha <12621691+harsha509@users.noreply.github.com> eab7aad
1 parent a9abd84 commit 984591d

File tree

39 files changed

+174
-142
lines changed

39 files changed

+174
-142
lines changed

documentation/_print/index.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,7 +2708,9 @@
27082708
</span></span></code></pre></div></div><div class="tab-pane fade" id=tabs-10-06 role=tabpanel aria-labelled-by=tabs-10-06-tab tabindex=10><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-Kotlin data-lang=Kotlin><span style=display:flex><span> <span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.openqa.selenium.By</span>
27092709
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>val</span> <span style=color:#000>driver</span> <span style=color:#000;font-weight:700>=</span> <span style=color:#000>ChromeDriver</span><span style=color:#000;font-weight:700>()</span>
27102710
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>val</span> <span style=color:#000>loc</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000>WebElement</span> <span style=color:#000;font-weight:700>=</span> <span style=color:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>findElement</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>By</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>xpath</span><span style=color:#000;font-weight:700>(</span><span style=color:#a40000>&#39;</span><span style=color:#8f5902;font-style:italic>//input[@value=&#39;f&#39;]&#39;))
2711-
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> </span></span></code></pre></div></div></div><h2 id=utilizing-locators>Utilizing Locators</h2><p>The FindElement makes using locators a breeze! For most languages, all you need to do is utilize <code>webdriver.common.by.By</code>, however in others it&rsquo;s as simple as setting a parameter in the FindElement function></p><p><a href=/documentation/about/contributing/#moving-examples><span class=selenium-badge-code data-bs-toggle=tooltip data-bs-placement=right title="One or more of these examples need to be implemented in the examples directory; click for details in the contribution guide">Move Code</span></a></p><ul class="nav nav-tabs" id=tabs-11 role=tablist><li class=nav-item><button class="nav-link active" id=tabs-11-01-tab data-bs-toggle=tab data-bs-target=#tabs-11-01 role=tab data-td-tp-persist=java aria-controls=tabs-11-01 aria-selected=true>
2711+
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> </span></span></code></pre></div></div></div><h2 id=utilizing-locators>Utilizing Locators</h2><p>The FindElement makes using locators a breeze! For most languages,
2712+
all you need to do is utilize <code>webdriver.common.by.By</code>, however in
2713+
others it&rsquo;s as simple as setting a parameter in the FindElement function</p><p><a href=/documentation/about/contributing/#moving-examples><span class=selenium-badge-code data-bs-toggle=tooltip data-bs-placement=right title="One or more of these examples need to be implemented in the examples directory; click for details in the contribution guide">Move Code</span></a></p><ul class="nav nav-tabs" id=tabs-11 role=tablist><li class=nav-item><button class="nav-link active" id=tabs-11-01-tab data-bs-toggle=tab data-bs-target=#tabs-11-01 role=tab data-td-tp-persist=java aria-controls=tabs-11-01 aria-selected=true>
27122714
Java</button></li><li class=nav-item><button class=nav-link id=tabs-11-02-tab data-bs-toggle=tab data-bs-target=#tabs-11-02 role=tab data-td-tp-persist=python aria-controls=tabs-11-02 aria-selected=false>
27132715
Python</button></li><li class=nav-item><button class=nav-link id=tabs-11-03-tab data-bs-toggle=tab data-bs-target=#tabs-11-03 role=tab data-td-tp-persist=csharp aria-controls=tabs-11-03 aria-selected=false>
27142716
CSharp</button></li><li class=nav-item><button class=nav-link id=tabs-11-04-tab data-bs-toggle=tab data-bs-target=#tabs-11-04 role=tab data-td-tp-persist=ruby aria-controls=tabs-11-04 aria-selected=false>
@@ -2855,9 +2857,9 @@
28552857
</span></span><span style=display:flex><span><span style=color:#000>shadow_root</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>shadow_host</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>shadow_root</span>
28562858
</span></span><span style=display:flex><span><span style=color:#000>shadow_content</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>shadow_root</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>find_element</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>By</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>CSS_SELECTOR</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#39;#shadow_content&#39;</span><span style=color:#000;font-weight:700>)</span></span></span></code></pre></div></div><div class="tab-pane fade" id=tabs-04-03 role=tabpanel aria-labelled-by=tabs-04-03-tab tabindex=4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-CSharp data-lang=CSharp><span style=display:flex><span><span style=color:#204a87;font-weight:700>var</span> <span style=color:#000>shadowHost</span> <span style=color:#000;font-weight:700>=</span> <span style=color:#000>_driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>FindElement</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>By</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>CssSelector</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#34;#shadow_host&#34;</span><span style=color:#000;font-weight:700>));</span>
28572859
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>var</span> <span style=color:#000>shadowRoot</span> <span style=color:#000;font-weight:700>=</span> <span style=color:#000>shadowHost</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>GetShadowRoot</span><span style=color:#000;font-weight:700>();</span>
2858-
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>var</span> <span style=color:#000>shadowContent</span> <span style=color:#000;font-weight:700>=</span> <span style=color:#000>shadowRoot</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>FindElement</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>By</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>CssSelector</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#34;#shadow_content&#34;</span><span style=color:#000;font-weight:700>));</span></span></span></code></pre></div></div><div class="tab-body tab-pane fade" id=tabs-04-04 role=tabpanel aria-labelled-by=tabs-04-04-tab tabindex=4>shadow_host = @driver.find_element(css: '#shadow_host')
2859-
shadow_root = shadow_host.shadow_root
2860-
shadow_content = shadow_root.find_element(css: '#shadow_content')</div><div class="tab-pane fade" id=tabs-04-05 role=tabpanel aria-labelled-by=tabs-04-05-tab tabindex=4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-JavaScript data-lang=JavaScript></code></pre></div></div><div class="tab-pane fade" id=tabs-04-06 role=tabpanel aria-labelled-by=tabs-04-06-tab tabindex=4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-Kotlin data-lang=Kotlin></code></pre></div></div></div><h3 id=optimized-locator>Optimized locator</h3><p>A nested lookup might not be the most effective location strategy since it requires two
2860+
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>var</span> <span style=color:#000>shadowContent</span> <span style=color:#000;font-weight:700>=</span> <span style=color:#000>shadowRoot</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>FindElement</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>By</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>CssSelector</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#34;#shadow_content&#34;</span><span style=color:#000;font-weight:700>));</span></span></span></code></pre></div></div><div class="tab-pane fade" id=tabs-04-04 role=tabpanel aria-labelled-by=tabs-04-04-tab tabindex=4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-Ruby data-lang=Ruby><span style=display:flex><span><span style=color:#000>shadow_host</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>@driver</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>find_element</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>css</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#39;#shadow_host&#39;</span><span style=color:#000;font-weight:700>)</span>
2861+
</span></span><span style=display:flex><span><span style=color:#000>shadow_root</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>shadow_host</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>shadow_root</span>
2862+
</span></span><span style=display:flex><span><span style=color:#000>shadow_content</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>shadow_root</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>find_element</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>css</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#39;#shadow_content&#39;</span><span style=color:#000;font-weight:700>)</span></span></span></code></pre></div></div><div class="tab-body tab-pane fade" id=tabs-04-05 role=tabpanel aria-labelled-by=tabs-04-05-tab tabindex=4><p><a href=/documentation/about/contributing/#creating-examples><span class=selenium-badge-code data-bs-toggle=tooltip data-bs-placement=right title="This code example is missing. Examples are added to the examples directory; click for details in the contribution guide">Add Example</span></a></p></div><div class="tab-body tab-pane fade" id=tabs-04-06 role=tabpanel aria-labelled-by=tabs-04-06-tab tabindex=4><p><a href=/documentation/about/contributing/#creating-examples><span class=selenium-badge-code data-bs-toggle=tooltip data-bs-placement=right title="This code example is missing. Examples are added to the examples directory; click for details in the contribution guide">Add Example</span></a></p></div></div><h3 id=optimized-locator>Optimized locator</h3><p>A nested lookup might not be the most effective location strategy since it requires two
28612863
separate commands to be issued to the browser.</p><p>To improve the performance slightly, we can use either CSS or XPath to find this element in a single command.
28622864
See the <a href=https://www.selenium.dev/documentation/test_practices/encouraged/locators/>Locator strategy suggestions</a> in our
28632865
<a href=https://www.selenium.dev/documentation/test_practices/encouraged/>Encouraged test practices</a> section.</p><p>For this example, we&rsquo;ll use a CSS Selector:</p><p><a href=/documentation/about/contributing/#moving-examples><span class=selenium-badge-code data-bs-toggle=tooltip data-bs-placement=right title="One or more of these examples need to be implemented in the examples directory; click for details in the contribution guide">Move Code</span></a></p><ul class="nav nav-tabs" id=tabs-7 role=tablist><li class=nav-item><button class="nav-link active" id=tabs-07-01-tab data-bs-toggle=tab data-bs-target=#tabs-07-01 role=tab data-td-tp-persist=java aria-controls=tabs-07-01 aria-selected=true>
@@ -13969,7 +13971,7 @@
1396913971
<label><a href=https://github.com/jarib>@jarib</a></label>
1397013972
<span class=contributions>1299 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/5992658?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1397113973
<label><a href=https://github.com/diemol>@diemol</a></label>
13972-
<span class=contributions>1237 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/128518?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
13974+
<span class=contributions>1240 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/128518?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1397313975
<label><a href=https://github.com/AutomatedTester>@AutomatedTester</a></label>
1397413976
<span class=contributions>1223 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/96150?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1397513977
<label><a href=https://github.com/dfabulich>@dfabulich</a></label>
@@ -14249,7 +14251,7 @@
1424914251
<label><a href=https://github.com/diemol>@diemol</a></label>
1425014252
<span class=contributions>538 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/23253546?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1425114253
<label><a href=https://github.com/VietND96>@VietND96</a></label>
14252-
<span class=contributions>222 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/3331063?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
14254+
<span class=contributions>223 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/3331063?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1425314255
<label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>
1425414256
<span class=contributions>154 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/2972876?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1425514257
<label><a href=https://github.com/ddavison>@ddavison</a></label>
@@ -14487,7 +14489,7 @@
1448714489
<label><a href=https://github.com/luisfcorreia>@luisfcorreia</a></label>
1448814490
<span class=contributions>15 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/69980130?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1448914491
<label><a href=https://github.com/shbenzer>@shbenzer</a></label>
14490-
<span class=contributions>13 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/in/15368?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
14492+
<span class=contributions>14 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/in/15368?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1449114493
<label><a href=https://github.com/apps/github-actions>@github-actions[bot]</a></label>
1449214494
<span class=contributions>13 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/28229?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1449314495
<label><a href=https://github.com/shs96c>@shs96c</a></label>

documentation/about/_print/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<label><a href=https://github.com/jarib>@jarib</a></label>
5353
<span class=contributions>1299 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/5992658?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
5454
<label><a href=https://github.com/diemol>@diemol</a></label>
55-
<span class=contributions>1237 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/128518?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
55+
<span class=contributions>1240 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/128518?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
5656
<label><a href=https://github.com/AutomatedTester>@AutomatedTester</a></label>
5757
<span class=contributions>1223 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/96150?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
5858
<label><a href=https://github.com/dfabulich>@dfabulich</a></label>
@@ -332,7 +332,7 @@
332332
<label><a href=https://github.com/diemol>@diemol</a></label>
333333
<span class=contributions>538 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/23253546?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
334334
<label><a href=https://github.com/VietND96>@VietND96</a></label>
335-
<span class=contributions>222 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/3331063?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
335+
<span class=contributions>223 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/3331063?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
336336
<label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>
337337
<span class=contributions>154 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/2972876?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
338338
<label><a href=https://github.com/ddavison>@ddavison</a></label>
@@ -570,7 +570,7 @@
570570
<label><a href=https://github.com/luisfcorreia>@luisfcorreia</a></label>
571571
<span class=contributions>15 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/69980130?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
572572
<label><a href=https://github.com/shbenzer>@shbenzer</a></label>
573-
<span class=contributions>13 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/in/15368?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
573+
<span class=contributions>14 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/in/15368?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
574574
<label><a href=https://github.com/apps/github-actions>@github-actions[bot]</a></label>
575575
<span class=contributions>13 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/28229?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
576576
<label><a href=https://github.com/shs96c>@shs96c</a></label>

0 commit comments

Comments
 (0)