Skip to content

Commit 03c6a7d

Browse files
committed
[JS] Render code sample from github [deploy site]
1 parent f86ff73 commit 03c6a7d

File tree

5 files changed

+24
-72
lines changed

5 files changed

+24
-72
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
})();

website_and_docs/content/documentation/webdriver/actions_api/mouse.en.md

+2-18
Original file line numberDiff line numberDiff line change
@@ -452,24 +452,8 @@ ensure
452452
driver.quit
453453
end
454454
{{< /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">}}
473457
{{< /tab >}}
474458
{{< tab header="Kotlin" >}}
475459
import org.openqa.selenium.By

website_and_docs/content/documentation/webdriver/actions_api/mouse.ja.md

+2-18
Original file line numberDiff line numberDiff line change
@@ -454,24 +454,8 @@ ensure
454454
driver.quit
455455
end
456456
{{< /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">}}
475459
{{< /tab >}}
476460
{{< tab header="Kotlin" >}}
477461
import org.openqa.selenium.By

website_and_docs/content/documentation/webdriver/actions_api/mouse.pt-br.md

+2-18
Original file line numberDiff line numberDiff line change
@@ -454,24 +454,8 @@ ensure
454454
driver.quit
455455
end
456456
{{< /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">}}
475459
{{< /tab >}}
476460
{{< tab header="Kotlin" >}}
477461
import org.openqa.selenium.By

website_and_docs/content/documentation/webdriver/actions_api/mouse.zh-cn.md

+2-18
Original file line numberDiff line numberDiff line change
@@ -452,24 +452,8 @@ ensure
452452
driver.quit
453453
end
454454
{{< /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">}}
473457
{{< /tab >}}
474458
{{< tab header="Kotlin" >}}
475459
import org.openqa.selenium.By

0 commit comments

Comments
 (0)