|
5362 | 5362 | </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>'https://www.selenium.dev'</span>
|
5363 | 5363 | </span></span><span style=display:flex><span>
|
5364 | 5364 | </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>'landscape'</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>'selenium-webdriver'</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>'selenium-webdriver/chrome'</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>'fs'</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>'chrome'</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>'https://www.selenium.dev'</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>"1-2"</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>'./test.pdf'</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>'base64'</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>"https://www.selenium.dev"</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>'https://www.selenium.dev/selenium/web/alerts.html'</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>"1-2"</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('./test.pdf', base64, 'base64'); |
| 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>"https://www.selenium.dev"</span><span style=color:#000;font-weight:700>)</span> |
5385 | 5371 | </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>
|
5386 | 5372 | </span></span><span style=display:flex><span>
|
5387 | 5373 | </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 | 13989 | <label><a href=https://github.com/neben>@neben</a></label>
|
14004 | 13990 | <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>
|
14005 | 13991 | <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> |
14007 | 13993 | <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> |
14009 | 13995 | <label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>
|
14010 | 13996 | <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>
|
14011 | 13997 | <label><a href=https://github.com/titusfortner>@titusfortner</a></label>
|
|
0 commit comments