diff --git a/examples/javascript/package-lock.json b/examples/javascript/package-lock.json index 346d0626303d..7dd294c32969 100644 --- a/examples/javascript/package-lock.json +++ b/examples/javascript/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "assert": "^2.0.0", - "selenium-webdriver": "^4.12.0" + "selenium-webdriver": "^4.13.0" }, "devDependencies": { "mocha": "^10.2.0" @@ -1032,9 +1032,9 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "node_modules/selenium-webdriver": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.12.0.tgz", - "integrity": "sha512-zvPzmTsky6WfO6+BGMj2mCJsw7qKnfQONur2b+pGn8jeTiC+WAUOthZOnaK+HkX5wiU6L4uoMF+JIcOVstp25A==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.13.0.tgz", + "integrity": "sha512-8JS0h5E0Sq7gNfbGg8LVaQ+Eqek97tvOONn3Jmy+NiWfb12WYpftz4VTC4D2JT4wakdG6VUzGKpA8cFGg0IjkA==", "dependencies": { "jszip": "^3.10.1", "tmp": "^0.2.1", @@ -2021,9 +2021,9 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "selenium-webdriver": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.12.0.tgz", - "integrity": "sha512-zvPzmTsky6WfO6+BGMj2mCJsw7qKnfQONur2b+pGn8jeTiC+WAUOthZOnaK+HkX5wiU6L4uoMF+JIcOVstp25A==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.13.0.tgz", + "integrity": "sha512-8JS0h5E0Sq7gNfbGg8LVaQ+Eqek97tvOONn3Jmy+NiWfb12WYpftz4VTC4D2JT4wakdG6VUzGKpA8cFGg0IjkA==", "requires": { "jszip": "^3.10.1", "tmp": "^0.2.1", diff --git a/examples/javascript/test/elements/fileUpload.spec.js b/examples/javascript/test/elements/fileUpload.spec.js index 03d858e75677..cafa37e7f68d 100644 --- a/examples/javascript/test/elements/fileUpload.spec.js +++ b/examples/javascript/test/elements/fileUpload.spec.js @@ -1,6 +1,7 @@ const { suite } = require('selenium-webdriver/testing'); -const {Browser, By} = require("selenium-webdriver"); +const {Browser, By, until} = require("selenium-webdriver"); const path = require("path"); +const assert = require('node:assert'); suite(function(env) { describe('File Upload Test', function() { @@ -18,10 +19,16 @@ suite(function(env) { await driver.manage().setTimeouts({implicit: 5000}); // Navigate to URL - await driver.get('https://www.selenium.dev/selenium/web/upload.html'); + await driver.get('https://the-internet.herokuapp.com/upload'); // Upload snapshot - await driver.findElement(By.id("upload")).sendKeys(image); - await driver.findElement(By.id("go")).submit(); + await driver.findElement(By.id("file-upload")).sendKeys(image); + await driver.findElement(By.id("file-submit")).submit(); + + const revealed = await driver.findElement(By.id('uploaded-files')) + await driver.wait(until.elementIsVisible(revealed), 2000); + const data = await driver.findElement(By.css('h3')); + + assert.equal(await data.getText(), `File Uploaded!`); }); }); diff --git a/website_and_docs/content/documentation/webdriver/elements/file_upload.en.md b/website_and_docs/content/documentation/webdriver/elements/file_upload.en.md index 28dffd647305..86a45e2c507e 100644 --- a/website_and_docs/content/documentation/webdriver/elements/file_upload.en.md +++ b/website_and_docs/content/documentation/webdriver/elements/file_upload.en.md @@ -107,7 +107,7 @@ end {{< /tab >}} {{< tab header="JavaScript" text=true >}} -{{< gh-codeblock path="/examples/javascript/test/elements/fileUpload.spec.js#L21-L24">}} +{{< gh-codeblock path="/examples/javascript/test/elements/fileUpload.spec.js#L22-L25">}} {{< /tab >}} {{< tab header="Kotlin" >}} diff --git a/website_and_docs/content/documentation/webdriver/elements/file_upload.ja.md b/website_and_docs/content/documentation/webdriver/elements/file_upload.ja.md index d96c26cdf082..69538674f095 100644 --- a/website_and_docs/content/documentation/webdriver/elements/file_upload.ja.md +++ b/website_and_docs/content/documentation/webdriver/elements/file_upload.ja.md @@ -106,7 +106,7 @@ end {{< /tab >}} {{< tab header="JavaScript" text=true >}} -{{< gh-codeblock path="/examples/javascript/test/elements/fileUpload.spec.js#L21-L24">}} +{{< gh-codeblock path="/examples/javascript/test/elements/fileUpload.spec.js#L22-L25">}} {{< /tab >}} {{< tab header="Kotlin" >}} diff --git a/website_and_docs/content/documentation/webdriver/elements/file_upload.pt-br.md b/website_and_docs/content/documentation/webdriver/elements/file_upload.pt-br.md index 5e8574c7d5d5..c8421a6f159e 100644 --- a/website_and_docs/content/documentation/webdriver/elements/file_upload.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/elements/file_upload.pt-br.md @@ -106,7 +106,7 @@ end {{< /tab >}} {{< tab header="JavaScript" text=true >}} -{{< gh-codeblock path="/examples/javascript/test/elements/fileUpload.spec.js#L21-L24">}} +{{< gh-codeblock path="/examples/javascript/test/elements/fileUpload.spec.js#L22-L25">}} {{< /tab >}} {{< tab header="Kotlin" >}} diff --git a/website_and_docs/content/documentation/webdriver/elements/file_upload.zh-cn.md b/website_and_docs/content/documentation/webdriver/elements/file_upload.zh-cn.md index aab07d8bbcbb..e918512b4b28 100644 --- a/website_and_docs/content/documentation/webdriver/elements/file_upload.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/elements/file_upload.zh-cn.md @@ -104,7 +104,7 @@ end {{< /tab >}} {{< tab header="JavaScript" text=true >}} -{{< gh-codeblock path="/examples/javascript/test/elements/fileUpload.spec.js#L21-L24">}} +{{< gh-codeblock path="/examples/javascript/test/elements/fileUpload.spec.js#L22-L25">}} {{< /tab >}} {{< tab header="Kotlin" >}}