File tree 5 files changed +24
-72
lines changed
examples/javascript/actionsApi/mouse
website_and_docs/content/documentation/webdriver/actions_api
5 files changed +24
-72
lines changed Original file line number Diff line number Diff line change
1
+ const { Builder, By} = require ( 'selenium-webdriver' ) ;
2
+
3
+ ( async function moveToElement ( ) {
4
+ let driver = await new Builder ( ) . forBrowser ( 'chrome' ) . build ( ) ;
5
+ try {
6
+ // Navigate to Url
7
+ await driver . get ( 'https://www.google.com' ) ;
8
+ // Store 'Gmail' anchor web element
9
+ let gmailLink = driver . findElement ( By . linkText ( "Gmail" ) ) ;
10
+ const actions = driver . actions ( { async : true } ) ;
11
+ // Performs mouse move action onto the element
12
+ await actions . move ( { origin :gmailLink } ) . perform ( ) ;
13
+ } finally {
14
+ await driver . quit ( ) ;
15
+ }
16
+ } ) ( ) ;
Original file line number Diff line number Diff line change @@ -452,24 +452,8 @@ ensure
452
452
driver.quit
453
453
end
454
454
{{< /tab >}}
455
- {{< tab header="JavaScript" >}}
456
- const {Builder, By} = require('selenium-webdriver');
457
-
458
- (async function moveToElement() {
459
- let driver = await new Builder().forBrowser('chrome').build();
460
- try {
461
- // Navigate to Url
462
- await driver.get('https://www.google.com ');
463
- // Store 'Gmail' anchor web element
464
- let gmailLink = driver.findElement(By.linkText("Gmail"));
465
- const actions = driver.actions({async: true});
466
- // Performs mouse move action onto the element
467
- await actions.move({origin: gmailLink }).perform();
468
- }
469
- finally {
470
- await driver.quit();
471
- }
472
- })();
455
+ {{< tab header="JavaScript" disableCodeBlock=true >}}
456
+ {{< gh-codeblock path="/examples/javascript/actionsApi/mouse/moveToElement.js">}}
473
457
{{< /tab >}}
474
458
{{< tab header="Kotlin" >}}
475
459
import org.openqa.selenium.By
Original file line number Diff line number Diff line change @@ -454,24 +454,8 @@ ensure
454
454
driver.quit
455
455
end
456
456
{{< /tab >}}
457
- {{< tab header="JavaScript" >}}
458
- const {Builder, By} = require('selenium-webdriver');
459
-
460
- (async function moveToElement() {
461
- let driver = await new Builder().forBrowser('chrome').build();
462
- try {
463
- // Navigate to Url
464
- await driver.get('https://www.google.com ');
465
- // Store 'Gmail' anchor web element
466
- let gmailLink = driver.findElement(By.linkText("Gmail"));
467
- const actions = driver.actions({async: true});
468
- // Performs mouse move action onto the element
469
- await actions.move({origin: gmailLink }).perform();
470
- }
471
- finally {
472
- await driver.quit();
473
- }
474
- })();
457
+ {{< tab header="JavaScript" disableCodeBlock=true >}}
458
+ {{< gh-codeblock path="/examples/javascript/actionsApi/mouse/moveToElement.js">}}
475
459
{{< /tab >}}
476
460
{{< tab header="Kotlin" >}}
477
461
import org.openqa.selenium.By
Original file line number Diff line number Diff line change @@ -454,24 +454,8 @@ ensure
454
454
driver.quit
455
455
end
456
456
{{< /tab >}}
457
- {{< tab header="JavaScript" >}}
458
- const {Builder, By} = require('selenium-webdriver');
459
-
460
- (async function moveToElement() {
461
- let driver = await new Builder().forBrowser('chrome').build();
462
- try {
463
- // Navigate to Url
464
- await driver.get('https://www.google.com ');
465
- // Store 'Gmail' anchor web element
466
- let gmailLink = driver.findElement(By.linkText("Gmail"));
467
- const actions = driver.actions({async: true});
468
- // Performs mouse move action onto the element
469
- await actions.move({origin: gmailLink }).perform();
470
- }
471
- finally {
472
- await driver.quit();
473
- }
474
- })();
457
+ {{< tab header="JavaScript" disableCodeBlock=true >}}
458
+ {{< gh-codeblock path="/examples/javascript/actionsApi/mouse/moveToElement.js">}}
475
459
{{< /tab >}}
476
460
{{< tab header="Kotlin" >}}
477
461
import org.openqa.selenium.By
Original file line number Diff line number Diff line change @@ -452,24 +452,8 @@ ensure
452
452
driver.quit
453
453
end
454
454
{{< /tab >}}
455
- {{< tab header="JavaScript" >}}
456
- const {Builder, By} = require('selenium-webdriver');
457
-
458
- (async function moveToElement() {
459
- let driver = await new Builder().forBrowser('chrome').build();
460
- try {
461
- // Navigate to Url
462
- await driver.get('https://www.google.com ');
463
- // Store 'Gmail' anchor web element
464
- let gmailLink = driver.findElement(By.linkText("Gmail"));
465
- const actions = driver.actions({async: true});
466
- // Performs mouse move action onto the element
467
- await actions.move({origin: gmailLink }).perform();
468
- }
469
- finally {
470
- await driver.quit();
471
- }
472
- })();
455
+ {{< tab header="JavaScript" disableCodeBlock=true >}}
456
+ {{< gh-codeblock path="/examples/javascript/actionsApi/mouse/moveToElement.js">}}
473
457
{{< /tab >}}
474
458
{{< tab header="Kotlin" >}}
475
459
import org.openqa.selenium.By
You can’t perform that action at this time.
0 commit comments