Skip to content

Commit 42c7165

Browse files
committed
[JS] Adds move by offset code sample [deploy site] 6251c9d
1 parent 31cb3de commit 42c7165

File tree

29 files changed

+93
-61
lines changed

29 files changed

+93
-61
lines changed

documentation/_print/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5679,8 +5679,10 @@
56795679
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>move_to</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>mouse_tracker</span><span style=color:#000;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>8</span><span style=color:#000;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>11</span><span style=color:#000;font-weight:700>)</span>
56805680
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>perform</span></span></span></code></pre></div><div class="text-right mb-5 pb-2"><a href=https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk//examples/ruby/spec/actions_api/mouse_spec.rb#L97-L100 target=_blank><i class="fas fa-external-link-alt pl-2"></i>
56815681
<i class="fas fa-external-link" aria-hidden=true></i>
5682-
<small>Check code on GitHub</small></a></div></div></div><div class="tab-pane fade" id=tabs-7-4 role=tabpanel aria-labelled-by=tabs-7-4-tab><div class="my-3 py-2"><pre><code> // Add Code
5683-
</code></pre></div></div><div class="tab-pane fade" id=tabs-7-5 role=tabpanel aria-labelled-by=tabs-7-5-tab><div class="my-3 py-2"><pre><code> // Add Code
5682+
<small>Check code on GitHub</small></a></div></div></div><div class="tab-pane fade" id=tabs-7-4 role=tabpanel aria-labelled-by=tabs-7-4-tab><div class="my-3 py-2"><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>const</span> <span style=color:#000>actions</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>actions</span><span style=color:#000;font-weight:700>({</span><span style=color:#204a87;font-weight:700>async</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>});</span>
5683+
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>await</span> <span style=color:#000>actions</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>move</span><span style=color:#000;font-weight:700>({</span><span style=color:#000>x</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8</span><span style=color:#000;font-weight:700>,</span> <span style=color:#000>y</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span> <span style=color:#000>origin</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>mouseTracker</span><span style=color:#000;font-weight:700>}).</span><span style=color:#000>perform</span><span style=color:#000;font-weight:700>();</span></span></span></code></pre></div><div class="text-right mb-5 pb-2"><a href=https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk//examples/javascript/test/actionsApi/mouse/moveByOffset.spec.js#L18-L19 target=_blank><i class="fas fa-external-link-alt pl-2"></i>
5684+
<i class="fas fa-external-link" aria-hidden=true></i>
5685+
<small>Check code on GitHub</small></a></div></div></div><div class="tab-pane fade" id=tabs-7-5 role=tabpanel aria-labelled-by=tabs-7-5-tab><div class="my-3 py-2"><pre><code> // Add Code
56845686
</code></pre></div></div></div><h3 id=offset-from-element-center-origin>Offset from Element (Center Origin)</h3><p>This method moves to the in-view center point of the element,
56855687
then moves the mouse by the provided offset</p><p>This is the default behavior in Java as of Selenium 4.0, and will be the default
56865688
for the remaining languages as of Selenium 4.3.</p><ul class="nav nav-tabs" id=tabs-8 role=tablist><li class=nav-item><a class="nav-link active tab-java" id=tabs-8-0-tab data-toggle=tab href=#tabs-8-0 role=tab onclick='handleClick("java")' aria-controls=tabs-8-0 aria-selected=true>Java</a></li><li class=nav-item><a class="nav-link tab-python" id=tabs-8-1-tab data-toggle=tab href=#tabs-8-1 role=tab onclick='handleClick("python")' aria-controls=tabs-8-1 aria-selected=false>Python</a></li><li class=nav-item><a class="nav-link tab-csharp" id=tabs-8-2-tab data-toggle=tab href=#tabs-8-2 role=tab onclick='handleClick("csharp")' aria-controls=tabs-8-2 aria-selected=false>CSharp</a></li><li class=nav-item><a class="nav-link tab-ruby" id=tabs-8-3-tab data-toggle=tab href=#tabs-8-3 role=tab onclick='handleClick("ruby")' aria-controls=tabs-8-3 aria-selected=false>Ruby</a></li><li class=nav-item><a class="nav-link tab-javascript" id=tabs-8-4-tab data-toggle=tab href=#tabs-8-4 role=tab onclick='handleClick("javascript")' aria-controls=tabs-8-4 aria-selected=false>JavaScript</a></li><li class=nav-item><a class="nav-link tab-kotlin" id=tabs-8-5-tab data-toggle=tab href=#tabs-8-5 role=tab onclick='handleClick("kotlin")' aria-controls=tabs-8-5 aria-selected=false>Kotlin</a></li></ul><div class="tab-content border-bottom height-4" id=tabs-8-content><div class="tab-pane fade show active" id=tabs-8-0 role=tabpanel aria-labelled-by=tabs-8-0-tab><div class="my-3 py-2"><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span> <span style=color:#000>WebElement</span> <span style=color:#000>tracker</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:#c4a000>findElement</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>By</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;mouse-tracker&#34;</span><span style=color:#ce5c00;font-weight:700>));</span>
@@ -11967,7 +11969,7 @@
1196711969
<label><a href=https://github.com/tadashi0713>@tadashi0713</a></label>
1196811970
<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>
1196911971
<label><a href=https://github.com/diemol>@diemol</a></label>
11970-
<span class=contributions>540 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>
11972+
<span class=contributions>541 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>
1197111973
<label><a href=https://github.com/harsha509>@harsha509</a></label>
1197211974
<span class=contributions>480 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>
1197311975
<label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>

documentation/about/_print/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@
510510
<label><a href=https://github.com/tadashi0713>@tadashi0713</a></label>
511511
<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>
512512
<label><a href=https://github.com/diemol>@diemol</a></label>
513-
<span class=contributions>540 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>
513+
<span class=contributions>541 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>
514514
<label><a href=https://github.com/harsha509>@harsha509</a></label>
515515
<span class=contributions>480 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>
516516
<label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>

documentation/about/copyright/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@
498498
<label><a href=https://github.com/tadashi0713>@tadashi0713</a></label>
499499
<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>
500500
<label><a href=https://github.com/diemol>@diemol</a></label>
501-
<span class=contributions>540 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>
501+
<span class=contributions>541 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>
502502
<label><a href=https://github.com/harsha509>@harsha509</a></label>
503503
<span class=contributions>480 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>
504504
<label><a href=https://github.com/selenium-ci>@selenium-ci</a></label>

documentation/webdriver/_print/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5480,8 +5480,10 @@
54805480
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>move_to</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>mouse_tracker</span><span style=color:#000;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>8</span><span style=color:#000;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>11</span><span style=color:#000;font-weight:700>)</span>
54815481
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>perform</span></span></span></code></pre></div><div class="text-right mb-5 pb-2"><a href=https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk//examples/ruby/spec/actions_api/mouse_spec.rb#L97-L100 target=_blank><i class="fas fa-external-link-alt pl-2"></i>
54825482
<i class="fas fa-external-link" aria-hidden=true></i>
5483-
<small>Check code on GitHub</small></a></div></div></div><div class="tab-pane fade" id=tabs-7-4 role=tabpanel aria-labelled-by=tabs-7-4-tab><div class="my-3 py-2"><pre><code> // Add Code
5484-
</code></pre></div></div><div class="tab-pane fade" id=tabs-7-5 role=tabpanel aria-labelled-by=tabs-7-5-tab><div class="my-3 py-2"><pre><code> // Add Code
5483+
<small>Check code on GitHub</small></a></div></div></div><div class="tab-pane fade" id=tabs-7-4 role=tabpanel aria-labelled-by=tabs-7-4-tab><div class="my-3 py-2"><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>const</span> <span style=color:#000>actions</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>driver</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>actions</span><span style=color:#000;font-weight:700>({</span><span style=color:#204a87;font-weight:700>async</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>});</span>
5484+
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>await</span> <span style=color:#000>actions</span><span style=color:#000;font-weight:700>.</span><span style=color:#000>move</span><span style=color:#000;font-weight:700>({</span><span style=color:#000>x</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8</span><span style=color:#000;font-weight:700>,</span> <span style=color:#000>y</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span> <span style=color:#000>origin</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>mouseTracker</span><span style=color:#000;font-weight:700>}).</span><span style=color:#000>perform</span><span style=color:#000;font-weight:700>();</span></span></span></code></pre></div><div class="text-right mb-5 pb-2"><a href=https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk//examples/javascript/test/actionsApi/mouse/moveByOffset.spec.js#L18-L19 target=_blank><i class="fas fa-external-link-alt pl-2"></i>
5485+
<i class="fas fa-external-link" aria-hidden=true></i>
5486+
<small>Check code on GitHub</small></a></div></div></div><div class="tab-pane fade" id=tabs-7-5 role=tabpanel aria-labelled-by=tabs-7-5-tab><div class="my-3 py-2"><pre><code> // Add Code
54855487
</code></pre></div></div></div><h3 id=offset-from-element-center-origin>Offset from Element (Center Origin)</h3><p>This method moves to the in-view center point of the element,
54865488
then moves the mouse by the provided offset</p><p>This is the default behavior in Java as of Selenium 4.0, and will be the default
54875489
for the remaining languages as of Selenium 4.3.</p><ul class="nav nav-tabs" id=tabs-8 role=tablist><li class=nav-item><a class="nav-link active tab-java" id=tabs-8-0-tab data-toggle=tab href=#tabs-8-0 role=tab onclick='handleClick("java")' aria-controls=tabs-8-0 aria-selected=true>Java</a></li><li class=nav-item><a class="nav-link tab-python" id=tabs-8-1-tab data-toggle=tab href=#tabs-8-1 role=tab onclick='handleClick("python")' aria-controls=tabs-8-1 aria-selected=false>Python</a></li><li class=nav-item><a class="nav-link tab-csharp" id=tabs-8-2-tab data-toggle=tab href=#tabs-8-2 role=tab onclick='handleClick("csharp")' aria-controls=tabs-8-2 aria-selected=false>CSharp</a></li><li class=nav-item><a class="nav-link tab-ruby" id=tabs-8-3-tab data-toggle=tab href=#tabs-8-3 role=tab onclick='handleClick("ruby")' aria-controls=tabs-8-3 aria-selected=false>Ruby</a></li><li class=nav-item><a class="nav-link tab-javascript" id=tabs-8-4-tab data-toggle=tab href=#tabs-8-4 role=tab onclick='handleClick("javascript")' aria-controls=tabs-8-4 aria-selected=false>JavaScript</a></li><li class=nav-item><a class="nav-link tab-kotlin" id=tabs-8-5-tab data-toggle=tab href=#tabs-8-5 role=tab onclick='handleClick("kotlin")' aria-controls=tabs-8-5 aria-selected=false>Kotlin</a></li></ul><div class="tab-content border-bottom height-4" id=tabs-8-content><div class="tab-pane fade show active" id=tabs-8-0 role=tabpanel aria-labelled-by=tabs-8-0-tab><div class="my-3 py-2"><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span> <span style=color:#000>WebElement</span> <span style=color:#000>tracker</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:#c4a000>findElement</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>By</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;mouse-tracker&#34;</span><span style=color:#ce5c00;font-weight:700>));</span>

0 commit comments

Comments
 (0)