Skip to content

Commit c218b05

Browse files
committed
[JS] Link code sample to github [deploy site] a4156d4
1 parent a7504b2 commit c218b05

File tree

29 files changed

+137
-341
lines changed

29 files changed

+137
-341
lines changed

documentation/_print/index.html

+8-22
Original file line numberDiff line numberDiff line change
@@ -5362,26 +5362,12 @@
53625362
</span></span><span style=display:flex><span> </span></span></code></pre></div></div><div class="tab-pane fade" id=tabs-17-04 role=tabpanel aria-labelled-by=tabs-17-04-tab tabindex=17><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>driver</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>navigate_to</span> <span style=color:#4e9a06>&#39;https://www.selenium.dev&#39;</span>
53635363
</span></span><span style=display:flex><span>
53645364
</span></span><span style=display:flex><span> <span style=color:#000>base64encodedContent</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>print_page</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>orientation</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#39;landscape&#39;</span><span style=color:#000;font-weight:700>)</span>
5365-
</span></span><span style=display:flex><span> </span></span></code></pre></div></div><div class="tab-pane fade" id=tabs-17-05 role=tabpanel aria-labelled-by=tabs-17-05-tab tabindex=17><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><span style=display:flex><span> <span style=color:#204a87;font-weight:700>const</span> <span style=color:#000;font-weight:700>{</span><span style=color:#000>Builder</span><span style=color:#000;font-weight:700>}</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>require</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#39;selenium-webdriver&#39;</span><span style=color:#000;font-weight:700>);</span>
5366-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>const</span> <span style=color:#000>chrome</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>require</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#39;selenium-webdriver/chrome&#39;</span><span style=color:#000;font-weight:700>);</span>
5367-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>let</span> <span style=color:#000>opts</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>chrome</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>Options</span><span style=color:#000;font-weight:700>();</span>
5368-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>let</span> <span style=color:#000>fs</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>require</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#39;fs&#39;</span><span style=color:#000;font-weight:700>);</span>
5369-
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>(</span><span style=color:#204a87;font-weight:700>async</span> <span style=color:#204a87;font-weight:700>function</span> <span style=color:#000>example</span><span style=color:#000;font-weight:700>()</span> <span style=color:#000;font-weight:700>{</span>
5370-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>let</span> <span style=color:#000>driver</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Builder</span><span style=color:#000;font-weight:700>()</span>
5371-
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>.</span><span style=color:#000>forBrowser</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#39;chrome&#39;</span><span style=color:#000;font-weight:700>)</span>
5372-
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>.</span><span style=color:#000>setChromeOptions</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>opts</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>headless</span><span style=color:#000;font-weight:700>())</span>
5373-
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>.</span><span style=color:#000>build</span><span style=color:#000;font-weight:700>();</span>
5374-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>await</span> <span style=color:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>get</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#39;https://www.selenium.dev&#39;</span><span style=color:#000;font-weight:700>);</span>
5375-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>try</span> <span style=color:#000;font-weight:700>{</span>
5376-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>let</span> <span style=color:#000>base64</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>await</span> <span style=color:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>printPage</span><span style=color:#000;font-weight:700>({</span><span style=color:#000>pageRanges</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;1-2&#34;</span><span style=color:#000;font-weight:700>]});</span>
5377-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>await</span> <span style=color:#000>fs</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>writeFileSync</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#39;./test.pdf&#39;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#000>base64</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#39;base64&#39;</span><span style=color:#000;font-weight:700>);</span>
5378-
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span> <span style=color:#204a87;font-weight:700>catch</span> <span style=color:#000;font-weight:700>(</span><span style=color:#000>e</span><span style=color:#000;font-weight:700>)</span> <span style=color:#000;font-weight:700>{</span>
5379-
</span></span><span style=display:flex><span> <span style=color:#000>console</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>log</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>e</span><span style=color:#000;font-weight:700>)</span>
5380-
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
5381-
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>await</span> <span style=color:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>quit</span><span style=color:#000;font-weight:700>();</span>
5382-
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>})();</span>
5383-
</span></span><span style=display:flex><span>
5384-
</span></span></code></pre></div></div><div class="tab-pane fade" id=tabs-17-06 role=tabpanel aria-labelled-by=tabs-17-06-tab tabindex=17><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:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#204a87;font-weight:700>get</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#34;https://www.selenium.dev&#34;</span><span style=color:#000;font-weight:700>)</span>
5365+
</span></span><span style=display:flex><span> </span></span></code></pre></div></div><div class="tab-body tab-pane fade" id=tabs-17-05 role=tabpanel aria-labelled-by=tabs-17-05-tab tabindex=17><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-js data-lang=js><span style=display:flex><span> <span style=color:#204a87;font-weight:700>await</span> <span style=color:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>get</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#39;https://www.selenium.dev/selenium/web/alerts.html&#39;</span><span style=color:#000;font-weight:700>);</span>
5366+
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>let</span> <span style=color:#000>base64</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>await</span> <span style=color:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>printPage</span><span style=color:#000;font-weight:700>({</span><span style=color:#000>pageRanges</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;1-2&#34;</span><span style=color:#000;font-weight:700>]});</span>
5367+
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// page can be saved as a PDF as below
5368+
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#8f5902;font-style:italic>// await fs.writeFileSync(&#39;./test.pdf&#39;, base64, &#39;base64&#39;);
5369+
</span></span></span></code></pre></div><div class="text-end pb-2"><a href=https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/examples/javascript/test/interactions/windows.spec.js#L22-L25 target=_blank><i class="fas fa-external-link-alt pl-2"></i>
5370+
<strong>View full example on GitHub</strong></a></div></div><div class="tab-pane fade" id=tabs-17-06 role=tabpanel aria-labelled-by=tabs-17-06-tab tabindex=17><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:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#204a87;font-weight:700>get</span><span style=color:#000;font-weight:700>(</span><span style=color:#4e9a06>&#34;https://www.selenium.dev&#34;</span><span style=color:#000;font-weight:700>)</span>
53855371
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>val</span> <span style=color:#000>printer</span> <span style=color:#000;font-weight:700>=</span> <span style=color:#000>driver</span> <span style=color:#204a87;font-weight:700>as</span> <span style=color:#000>PrintsPage</span>
53865372
</span></span><span style=display:flex><span>
53875373
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>val</span> <span style=color:#000>printOptions</span> <span style=color:#000;font-weight:700>=</span> <span style=color:#000>PrintOptions</span><span style=color:#000;font-weight:700>()</span>
@@ -14003,9 +13989,9 @@
1400313989
<label><a href=https://github.com/neben>@neben</a></label>
1400413990
<span class=contributions>1 commits</span></div></div><h4 id=selenium-website--docsgithubcomseleniumhqseleniumhqgithubio><a href=//github.com/SeleniumHQ/seleniumhq.github.io/>Selenium Website & Docs</a></h4><style type=text/css>.ghContributors{display:flex;flex-flow:wrap;align-content:flex-start}.ghContributors>div{width:50%;display:inline-flex;margin-bottom:5px}.ghContributors>div label{padding-left:4px}.ghContributors>div span{font-size:x-small;padding-left:4px}</style><div class=ghContributors><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>
1400513991
<label><a href=https://github.com/diemol>@diemol</a></label>
14006-
<span class=contributions>720 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/12621691?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
13992+
<span class=contributions>722 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/12621691?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1400713993
<label><a href=https://github.com/harsha509>@harsha509</a></label>
14008-
<span class=contributions>684 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>
13994+
<span class=contributions>686 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>
1400913995
<label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>
1401013996
<span class=contributions>323 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/777185?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
1401113997
<label><a href=https://github.com/titusfortner>@titusfortner</a></label>

documentation/about/_print/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,9 @@
523523
<label><a href=https://github.com/neben>@neben</a></label>
524524
<span class=contributions>1 commits</span></div></div><h4 id=selenium-website--docsgithubcomseleniumhqseleniumhqgithubio><a href=//github.com/SeleniumHQ/seleniumhq.github.io/>Selenium Website & Docs</a></h4><style type=text/css>.ghContributors{display:flex;flex-flow:wrap;align-content:flex-start}.ghContributors>div{width:50%;display:inline-flex;margin-bottom:5px}.ghContributors>div label{padding-left:4px}.ghContributors>div span{font-size:x-small;padding-left:4px}</style><div class=ghContributors><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>
525525
<label><a href=https://github.com/diemol>@diemol</a></label>
526-
<span class=contributions>720 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/12621691?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
526+
<span class=contributions>722 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/12621691?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
527527
<label><a href=https://github.com/harsha509>@harsha509</a></label>
528-
<span class=contributions>684 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>
528+
<span class=contributions>686 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>
529529
<label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>
530530
<span class=contributions>323 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/777185?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
531531
<label><a href=https://github.com/titusfortner>@titusfortner</a></label>

documentation/about/copyright/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,9 @@
512512
<label><a href=https://github.com/neben>@neben</a></label>
513513
<span class=contributions>1 commits</span></div></div><h4 id=selenium-website--docsgithubcomseleniumhqseleniumhqgithubio><a href=//github.com/SeleniumHQ/seleniumhq.github.io/>Selenium Website & Docs</a></h4><style type=text/css>.ghContributors{display:flex;flex-flow:wrap;align-content:flex-start}.ghContributors>div{width:50%;display:inline-flex;margin-bottom:5px}.ghContributors>div label{padding-left:4px}.ghContributors>div span{font-size:x-small;padding-left:4px}</style><div class=ghContributors><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>
514514
<label><a href=https://github.com/diemol>@diemol</a></label>
515-
<span class=contributions>720 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/12621691?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
515+
<span class=contributions>722 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/12621691?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
516516
<label><a href=https://github.com/harsha509>@harsha509</a></label>
517-
<span class=contributions>684 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>
517+
<span class=contributions>686 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>
518518
<label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>
519519
<span class=contributions>323 commits</span></div><div style=padding:10px><img src="https://avatars.githubusercontent.com/u/777185?v=4" class=inline width=100 height=100 style=height:100px;height:100px;margin-bottom:.25em;vertical-align:middle>
520520
<label><a href=https://github.com/titusfortner>@titusfortner</a></label>

0 commit comments

Comments
 (0)