From 62da9a461a6d4fcf9865f9c48f056b9b03d15206 Mon Sep 17 00:00:00 2001 From: Simon Benzer Date: Tue, 24 Sep 2024 14:18:38 -0400 Subject: [PATCH] Added Javascript Example to Selenium Manager --- .../test/selenium_manager/usage.spec.js | 34 +++++++++++++++++++ .../documentation/selenium_manager.en.md | 7 ++-- .../documentation/selenium_manager.ja.md | 7 ++-- .../documentation/selenium_manager.pt-br.md | 7 ++-- .../documentation/selenium_manager.zh-cn.md | 7 ++-- 5 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 examples/javascript/test/selenium_manager/usage.spec.js diff --git a/examples/javascript/test/selenium_manager/usage.spec.js b/examples/javascript/test/selenium_manager/usage.spec.js new file mode 100644 index 000000000000..cb11e2001d8f --- /dev/null +++ b/examples/javascript/test/selenium_manager/usage.spec.js @@ -0,0 +1,34 @@ +const Chrome = require('selenium-webdriver/chrome'); +const {Browser, Builder} = require("selenium-webdriver"); +const {getBinaryPaths} = require("selenium-webdriver/common/driverFinder"); +const options = new Chrome.Options(); + +describe('Usage Test', function () { + it('After Selenium Manager', async function () { + + let driver = new Builder() + .forBrowser(Browser.CHROME) + .build(); + + await driver.get('https://www.selenium.dev/selenium/web/blank.html'); + await driver.quit(); + }); + + it('Before Selenium Manager', async function () { + let paths = getBinaryPaths(options) + let driverPath = paths.driverPath; + let browserPath = paths.browserPath; + + options.setChromeBinaryPath(browserPath) + + let service = new Chrome.ServiceBuilder().setPath(driverPath) + + let driver = new Builder() + .forBrowser(Browser.CHROME) + .setChromeService(service) + .build(); + + await driver.get('https://www.selenium.dev/selenium/web/blank.html'); + await driver.quit(); + }); +}); \ No newline at end of file diff --git a/website_and_docs/content/documentation/selenium_manager.en.md b/website_and_docs/content/documentation/selenium_manager.en.md index 86dea97d1806..fac44d989985 100644 --- a/website_and_docs/content/documentation/selenium_manager.en.md +++ b/website_and_docs/content/documentation/selenium_manager.en.md @@ -227,8 +227,11 @@ INFO Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5938.22\c {{< tab header="Ruby" >}} {{< badge-code >}} {{< /tab >}} -{{< tab header="JavaScript" >}} -{{< badge-code >}} +{{% tab header="JavaScript" %}} +**Previously** +{{< gh-codeblock path="examples/javascript/test/selenium_manager/usage.spec.js#L17-L33" >}} +**Selenium Manager** +{{< gh-codeblock path="examples/javascript/test/selenium_manager/usage.spec.js#L7-L15" >}} {{< /tab >}} {{< tab header="Kotlin" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/selenium_manager.ja.md b/website_and_docs/content/documentation/selenium_manager.ja.md index 463b984231e1..e5b66188040e 100644 --- a/website_and_docs/content/documentation/selenium_manager.ja.md +++ b/website_and_docs/content/documentation/selenium_manager.ja.md @@ -227,8 +227,11 @@ INFO Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5938.22\c {{< tab header="Ruby" >}} {{< badge-code >}} {{< /tab >}} -{{< tab header="JavaScript" >}} -{{< badge-code >}} +{{% tab header="JavaScript" %}} +**Previously** +{{< gh-codeblock path="examples/javascript/test/selenium_manager/usage.spec.js#L17-L33" >}} +**Selenium Manager** +{{< gh-codeblock path="examples/javascript/test/selenium_manager/usage.spec.js#L7-L15" >}} {{< /tab >}} {{< tab header="Kotlin" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/selenium_manager.pt-br.md b/website_and_docs/content/documentation/selenium_manager.pt-br.md index 463b984231e1..e5b66188040e 100644 --- a/website_and_docs/content/documentation/selenium_manager.pt-br.md +++ b/website_and_docs/content/documentation/selenium_manager.pt-br.md @@ -227,8 +227,11 @@ INFO Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5938.22\c {{< tab header="Ruby" >}} {{< badge-code >}} {{< /tab >}} -{{< tab header="JavaScript" >}} -{{< badge-code >}} +{{% tab header="JavaScript" %}} +**Previously** +{{< gh-codeblock path="examples/javascript/test/selenium_manager/usage.spec.js#L17-L33" >}} +**Selenium Manager** +{{< gh-codeblock path="examples/javascript/test/selenium_manager/usage.spec.js#L7-L15" >}} {{< /tab >}} {{< tab header="Kotlin" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/selenium_manager.zh-cn.md b/website_and_docs/content/documentation/selenium_manager.zh-cn.md index 463b984231e1..e5b66188040e 100644 --- a/website_and_docs/content/documentation/selenium_manager.zh-cn.md +++ b/website_and_docs/content/documentation/selenium_manager.zh-cn.md @@ -227,8 +227,11 @@ INFO Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5938.22\c {{< tab header="Ruby" >}} {{< badge-code >}} {{< /tab >}} -{{< tab header="JavaScript" >}} -{{< badge-code >}} +{{% tab header="JavaScript" %}} +**Previously** +{{< gh-codeblock path="examples/javascript/test/selenium_manager/usage.spec.js#L17-L33" >}} +**Selenium Manager** +{{< gh-codeblock path="examples/javascript/test/selenium_manager/usage.spec.js#L7-L15" >}} {{< /tab >}} {{< tab header="Kotlin" >}} {{< badge-code >}}