From 839cb1a57978f523462efbb5a6c72aacfa2e321e Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Mon, 17 Feb 2020 19:17:15 +0530 Subject: [PATCH 1/3] Add: Adding intital document for pageLoadStrategy Signed-off-by: Sri Harsha --- .../webdriver/page_loading_strategy.en.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/docs_source_files/content/webdriver/page_loading_strategy.en.md b/docs_source_files/content/webdriver/page_loading_strategy.en.md index 749228b00c14..aac65a406afe 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.en.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.en.md @@ -3,3 +3,67 @@ title: "Page loading strategy" weight: 8 --- +Defines the current session's page loading strategy. +By default, when selenium loads a page, +it follows the _normal_ pageLoadStrategy. +It is always recommended to stop downloading additional +resources (like images, css, js) when the page loading takes lot of time. + +WebDriver _pageLoadStrategy_ supports the following values: + +## normal + +This will make selenium to wait for the entire page is loaded. +When set to **normal** the selenium waits until the +[load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +// Please raise a pr + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## eager + +This will make selenium to wait until the +initial HTML document has been completely loaded, +and discards loading of stylesheets, images and subframes. + +When set to **eager** selenium waits until +[DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +// Please raise a pr + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +// Please raise a PR + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} \ No newline at end of file From 26b268e44d3f363f207bd2ffae5551bd04c452d7 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Tue, 18 Feb 2020 22:15:28 +0530 Subject: [PATCH 2/3] Add: Adding initial doc for page load strategy --- .../webdriver/page_loading_strategy.de.md | 187 +++++++++++++++++ .../webdriver/page_loading_strategy.en.md | 131 +++++++++++- .../webdriver/page_loading_strategy.es.md | 190 +++++++++++++++++- .../webdriver/page_loading_strategy.fr.md | 190 +++++++++++++++++- .../webdriver/page_loading_strategy.ja.md | 188 +++++++++++++++++ .../webdriver/page_loading_strategy.ko.md | 188 +++++++++++++++++ .../webdriver/page_loading_strategy.nl.md | 188 +++++++++++++++++ .../webdriver/page_loading_strategy.zh-cn.md | 188 +++++++++++++++++ 8 files changed, 1444 insertions(+), 6 deletions(-) diff --git a/docs_source_files/content/webdriver/page_loading_strategy.de.md b/docs_source_files/content/webdriver/page_loading_strategy.de.md index 8c971c012ff9..825ebf64a9c1 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.de.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.de.md @@ -3,3 +3,190 @@ title: "Strategien beim Laden von Webseiten" weight: 8 --- +Defines the current session's page loading strategy. +By default, when selenium loads a page, +it follows the _normal_ pageLoadStrategy. +It is always recommended to stop downloading additional +resources (like images, css, js) when the page loading takes lot of time. + +WebDriver _pageLoadStrategy_ supports the following values: + +## normal + +This will make selenium to wait for the entire page is loaded. +When set to **normal** the selenium waits until the +[load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. + +By default **normal** is set to browser if none is provided. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("normal"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## eager + +This will make selenium to wait until the +initial HTML document has been completely loaded and parsed, +and discards loading of stylesheets, images and subframes. + +When set to **eager** selenium waits until +[DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("eager"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## none + +When set to **none** selenium only waits until the initial page is downloaded. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("none"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/page_loading_strategy.en.md b/docs_source_files/content/webdriver/page_loading_strategy.en.md index aac65a406afe..4fb7f599ffb2 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.en.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.en.md @@ -17,9 +17,28 @@ This will make selenium to wait for the entire page is loaded. When set to **normal** the selenium waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. +By default **normal** is set to browser if none is provided. + {{< code-tab >}} {{< code-panel language="java" >}} -// Please raise a pr +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} {{< / code-panel >}} {{< code-panel language="python" >}} # Please raise a PR @@ -31,7 +50,22 @@ When set to **normal** the selenium waits until the # Please raise a PR {{< / code-panel >}} {{< code-panel language="javascript" >}} -// Please raise a PR +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("normal"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); {{< / code-panel >}} {{< code-panel language="kotlin" >}} // Please raise a PR @@ -41,7 +75,7 @@ When set to **normal** the selenium waits until the ## eager This will make selenium to wait until the -initial HTML document has been completely loaded, +initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. When set to **eager** selenium waits until @@ -49,7 +83,24 @@ When set to **eager** selenium waits until {{< code-tab >}} {{< code-panel language="java" >}} -// Please raise a pr +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} {{< / code-panel >}} {{< code-panel language="python" >}} # Please raise a PR @@ -61,8 +112,80 @@ When set to **eager** selenium waits until # Please raise a PR {{< / code-panel >}} {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("eager"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} // Please raise a PR {{< / code-panel >}} +{{< / code-tab >}} + +## none + +When set to **none** selenium only waits until the initial page is downloaded. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("none"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} {{< code-panel language="kotlin" >}} // Please raise a PR {{< / code-panel >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.es.md b/docs_source_files/content/webdriver/page_loading_strategy.es.md index 91bf77fb44c4..67df0eee7665 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.es.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.es.md @@ -7,4 +7,192 @@ weight: 8 Page being translated from English to Spanish. Do you speak Spanish? Help us to translate it by sending us pull requests! -{{% /notice %}} \ No newline at end of file +{{% /notice %}} + +Defines the current session's page loading strategy. +By default, when selenium loads a page, +it follows the _normal_ pageLoadStrategy. +It is always recommended to stop downloading additional +resources (like images, css, js) when the page loading takes lot of time. + +WebDriver _pageLoadStrategy_ supports the following values: + +## normal + +This will make selenium to wait for the entire page is loaded. +When set to **normal** the selenium waits until the +[load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. + +By default **normal** is set to browser if none is provided. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("normal"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## eager + +This will make selenium to wait until the +initial HTML document has been completely loaded and parsed, +and discards loading of stylesheets, images and subframes. + +When set to **eager** selenium waits until +[DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("eager"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## none + +When set to **none** selenium only waits until the initial page is downloaded. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("none"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/page_loading_strategy.fr.md b/docs_source_files/content/webdriver/page_loading_strategy.fr.md index 859822148951..03943b6ba1d1 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.fr.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.fr.md @@ -7,4 +7,192 @@ weight: 8 Page being translated from English to French. Do you speak French? Help us to translate it by sending us pull requests! -{{% /notice %}} \ No newline at end of file +{{% /notice %}} + +Defines the current session's page loading strategy. +By default, when selenium loads a page, +it follows the _normal_ pageLoadStrategy. +It is always recommended to stop downloading additional +resources (like images, css, js) when the page loading takes lot of time. + +WebDriver _pageLoadStrategy_ supports the following values: + +## normal + +This will make selenium to wait for the entire page is loaded. +When set to **normal** the selenium waits until the +[load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. + +By default **normal** is set to browser if none is provided. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("normal"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## eager + +This will make selenium to wait until the +initial HTML document has been completely loaded and parsed, +and discards loading of stylesheets, images and subframes. + +When set to **eager** selenium waits until +[DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("eager"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## none + +When set to **none** selenium only waits until the initial page is downloaded. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("none"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} \ No newline at end of file diff --git a/docs_source_files/content/webdriver/page_loading_strategy.ja.md b/docs_source_files/content/webdriver/page_loading_strategy.ja.md index d5feb0200e13..623ebc2a2ccb 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.ja.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.ja.md @@ -7,3 +7,191 @@ weight: 8 ページは英語から日本語へ訳されています。 日本語は話せますか?プルリクエストをして翻訳を手伝ってください! {{% /notice %}} + +Defines the current session's page loading strategy. +By default, when selenium loads a page, +it follows the _normal_ pageLoadStrategy. +It is always recommended to stop downloading additional +resources (like images, css, js) when the page loading takes lot of time. + +WebDriver _pageLoadStrategy_ supports the following values: + +## normal + +This will make selenium to wait for the entire page is loaded. +When set to **normal** the selenium waits until the +[load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. + +By default **normal** is set to browser if none is provided. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("normal"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## eager + +This will make selenium to wait until the +initial HTML document has been completely loaded and parsed, +and discards loading of stylesheets, images and subframes. + +When set to **eager** selenium waits until +[DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("eager"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## none + +When set to **none** selenium only waits until the initial page is downloaded. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("none"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.ko.md b/docs_source_files/content/webdriver/page_loading_strategy.ko.md index 3044fd7621f3..06cb51a4a3f0 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.ko.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.ko.md @@ -9,3 +9,191 @@ English to Korean. Do you speak Korean? Help us to translate it by sending us pull requests! {{% /notice %}} +Defines the current session's page loading strategy. +By default, when selenium loads a page, +it follows the _normal_ pageLoadStrategy. +It is always recommended to stop downloading additional +resources (like images, css, js) when the page loading takes lot of time. + +WebDriver _pageLoadStrategy_ supports the following values: + +## normal + +This will make selenium to wait for the entire page is loaded. +When set to **normal** the selenium waits until the +[load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. + +By default **normal** is set to browser if none is provided. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("normal"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## eager + +This will make selenium to wait until the +initial HTML document has been completely loaded and parsed, +and discards loading of stylesheets, images and subframes. + +When set to **eager** selenium waits until +[DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("eager"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## none + +When set to **none** selenium only waits until the initial page is downloaded. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("none"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + diff --git a/docs_source_files/content/webdriver/page_loading_strategy.nl.md b/docs_source_files/content/webdriver/page_loading_strategy.nl.md index c2cd69ebd1bb..ed1d1989b81a 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.nl.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.nl.md @@ -8,3 +8,191 @@ weight: 8 English to Dutch. Do you speak Dutch? Help us to translate it by sending us pull requests! {{% /notice %}} + +Defines the current session's page loading strategy. +By default, when selenium loads a page, +it follows the _normal_ pageLoadStrategy. +It is always recommended to stop downloading additional +resources (like images, css, js) when the page loading takes lot of time. + +WebDriver _pageLoadStrategy_ supports the following values: + +## normal + +This will make selenium to wait for the entire page is loaded. +When set to **normal** the selenium waits until the +[load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. + +By default **normal** is set to browser if none is provided. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("normal"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## eager + +This will make selenium to wait until the +initial HTML document has been completely loaded and parsed, +and discards loading of stylesheets, images and subframes. + +When set to **eager** selenium waits until +[DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("eager"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## none + +When set to **none** selenium only waits until the initial page is downloaded. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("none"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.zh-cn.md b/docs_source_files/content/webdriver/page_loading_strategy.zh-cn.md index 749228b00c14..d5f878f15a12 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.zh-cn.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.zh-cn.md @@ -3,3 +3,191 @@ title: "Page loading strategy" weight: 8 --- +Defines the current session's page loading strategy. +By default, when selenium loads a page, +it follows the _normal_ pageLoadStrategy. +It is always recommended to stop downloading additional +resources (like images, css, js) when the page loading takes lot of time. + +WebDriver _pageLoadStrategy_ supports the following values: + +## normal + +This will make selenium to wait for the entire page is loaded. +When set to **normal** the selenium waits until the +[load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. + +By default **normal** is set to browser if none is provided. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("normal"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## eager + +This will make selenium to wait until the +initial HTML document has been completely loaded and parsed, +and discards loading of stylesheets, images and subframes. + +When set to **eager** selenium waits until +[DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("eager"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + +## none + +When set to **none** selenium only waits until the initial page is downloaded. + +{{< code-tab >}} + {{< code-panel language="java" >}} +import org.openqa.selenium.PageLoadStrategy; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.chrome.ChromeDriver; + +public class pageLoadStrategy { + public static void main(String[] args) { + ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE); + WebDriver driver = new ChromeDriver(chromeOptions); + try { + // Navigate to Url + driver.get("https://google.com"); + } finally { + driver.quit(); + } + } +} + {{< / code-panel >}} + {{< code-panel language="python" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="c#" >}} + // Please raise a PR + {{< / code-panel >}} + {{< code-panel language="ruby" >}} +# Please raise a PR + {{< / code-panel >}} + {{< code-panel language="javascript" >}} +const {Builder, Capabilities} = require('selenium-webdriver'); +const caps = new Capabilities(); +caps.setPageLoadStrategy("none"); +(async function example() { + let driver = await new Builder(). + withCapabilities(caps). + forBrowser('chrome'). + build(); + try { + // Navigate to Url + await driver.get('https://www.google.com'); + } + finally { + await driver.quit(); + } +})(); + {{< / code-panel >}} + {{< code-panel language="kotlin" >}} +// Please raise a PR + {{< / code-panel >}} +{{< / code-tab >}} + From 708cfc2e264c27518093f5f264ebbf71071e2f87 Mon Sep 17 00:00:00 2001 From: Sri Harsha Date: Wed, 19 Feb 2020 20:38:08 +0530 Subject: [PATCH 3/3] Modify: Updates according to the changes suggested by @diemol --- .../content/webdriver/page_loading_strategy.de.md | 14 +++++++------- .../content/webdriver/page_loading_strategy.en.md | 14 +++++++------- .../content/webdriver/page_loading_strategy.es.md | 14 +++++++------- .../content/webdriver/page_loading_strategy.fr.md | 14 +++++++------- .../content/webdriver/page_loading_strategy.ja.md | 12 ++++++------ .../content/webdriver/page_loading_strategy.ko.md | 12 ++++++------ .../content/webdriver/page_loading_strategy.nl.md | 12 ++++++------ .../webdriver/page_loading_strategy.zh-cn.md | 12 ++++++------ 8 files changed, 52 insertions(+), 52 deletions(-) diff --git a/docs_source_files/content/webdriver/page_loading_strategy.de.md b/docs_source_files/content/webdriver/page_loading_strategy.de.md index 825ebf64a9c1..bc07aae81df4 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.de.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.de.md @@ -4,7 +4,7 @@ weight: 8 --- Defines the current session's page loading strategy. -By default, when selenium loads a page, +By default, when Selenium WebDriver loads a page, it follows the _normal_ pageLoadStrategy. It is always recommended to stop downloading additional resources (like images, css, js) when the page loading takes lot of time. @@ -13,8 +13,8 @@ WebDriver _pageLoadStrategy_ supports the following values: ## normal -This will make selenium to wait for the entire page is loaded. -When set to **normal** the selenium waits until the +This will make Selenium WebDriver to wait for the entire page is loaded. +When set to **normal**, Selenium WebDriver waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. By default **normal** is set to browser if none is provided. @@ -74,11 +74,11 @@ caps.setPageLoadStrategy("normal"); ## eager -This will make selenium to wait until the +This will make Selenium WebDriver to wait until the initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. -When set to **eager** selenium waits until +When set to **eager**, Selenium WebDriver waits until [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. {{< code-tab >}} @@ -136,7 +136,7 @@ caps.setPageLoadStrategy("eager"); ## none -When set to **none** selenium only waits until the initial page is downloaded. +When set to **none** Selenium WebDriver only waits until the initial page is downloaded. {{< code-tab >}} {{< code-panel language="java" >}} @@ -189,4 +189,4 @@ caps.setPageLoadStrategy("none"); {{< code-panel language="kotlin" >}} // Please raise a PR {{< / code-panel >}} -{{< / code-tab >}} \ No newline at end of file +{{< / code-tab >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.en.md b/docs_source_files/content/webdriver/page_loading_strategy.en.md index 4fb7f599ffb2..1566d0aa695f 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.en.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.en.md @@ -4,7 +4,7 @@ weight: 8 --- Defines the current session's page loading strategy. -By default, when selenium loads a page, +By default, when Selenium WebDriver loads a page, it follows the _normal_ pageLoadStrategy. It is always recommended to stop downloading additional resources (like images, css, js) when the page loading takes lot of time. @@ -13,8 +13,8 @@ WebDriver _pageLoadStrategy_ supports the following values: ## normal -This will make selenium to wait for the entire page is loaded. -When set to **normal** the selenium waits until the +This will make Selenium WebDriver to wait for the entire page is loaded. +When set to **normal**, Selenium WebDriver waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. By default **normal** is set to browser if none is provided. @@ -74,11 +74,11 @@ caps.setPageLoadStrategy("normal"); ## eager -This will make selenium to wait until the +This will make Selenium WebDriver to wait until the initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. -When set to **eager** selenium waits until +When set to **eager**, Selenium WebDriver waits until [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. {{< code-tab >}} @@ -136,7 +136,7 @@ caps.setPageLoadStrategy("eager"); ## none -When set to **none** selenium only waits until the initial page is downloaded. +When set to **none** Selenium WebDriver only waits until the initial page is downloaded. {{< code-tab >}} {{< code-panel language="java" >}} @@ -189,4 +189,4 @@ caps.setPageLoadStrategy("none"); {{< code-panel language="kotlin" >}} // Please raise a PR {{< / code-panel >}} -{{< / code-tab >}} \ No newline at end of file +{{< / code-tab >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.es.md b/docs_source_files/content/webdriver/page_loading_strategy.es.md index 67df0eee7665..566a0810749c 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.es.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.es.md @@ -10,7 +10,7 @@ it by sending us pull requests! {{% /notice %}} Defines the current session's page loading strategy. -By default, when selenium loads a page, +By default, when Selenium WebDriver loads a page, it follows the _normal_ pageLoadStrategy. It is always recommended to stop downloading additional resources (like images, css, js) when the page loading takes lot of time. @@ -19,8 +19,8 @@ WebDriver _pageLoadStrategy_ supports the following values: ## normal -This will make selenium to wait for the entire page is loaded. -When set to **normal** the selenium waits until the +This will make Selenium WebDriver to wait for the entire page is loaded. +When set to **normal**, Selenium WebDriver waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. By default **normal** is set to browser if none is provided. @@ -80,11 +80,11 @@ caps.setPageLoadStrategy("normal"); ## eager -This will make selenium to wait until the +This will make Selenium WebDriver to wait until the initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. -When set to **eager** selenium waits until +When set to **eager**, Selenium WebDriver waits until [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. {{< code-tab >}} @@ -142,7 +142,7 @@ caps.setPageLoadStrategy("eager"); ## none -When set to **none** selenium only waits until the initial page is downloaded. +When set to **none** Selenium WebDriver only waits until the initial page is downloaded. {{< code-tab >}} {{< code-panel language="java" >}} @@ -195,4 +195,4 @@ caps.setPageLoadStrategy("none"); {{< code-panel language="kotlin" >}} // Please raise a PR {{< / code-panel >}} -{{< / code-tab >}} \ No newline at end of file +{{< / code-tab >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.fr.md b/docs_source_files/content/webdriver/page_loading_strategy.fr.md index 03943b6ba1d1..e980d903cbb0 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.fr.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.fr.md @@ -10,7 +10,7 @@ it by sending us pull requests! {{% /notice %}} Defines the current session's page loading strategy. -By default, when selenium loads a page, +By default, when Selenium WebDriver loads a page, it follows the _normal_ pageLoadStrategy. It is always recommended to stop downloading additional resources (like images, css, js) when the page loading takes lot of time. @@ -19,8 +19,8 @@ WebDriver _pageLoadStrategy_ supports the following values: ## normal -This will make selenium to wait for the entire page is loaded. -When set to **normal** the selenium waits until the +This will make Selenium WebDriver to wait for the entire page is loaded. +When set to **normal**, Selenium WebDriver waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. By default **normal** is set to browser if none is provided. @@ -80,11 +80,11 @@ caps.setPageLoadStrategy("normal"); ## eager -This will make selenium to wait until the +This will make Selenium WebDriver to wait until the initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. -When set to **eager** selenium waits until +When set to **eager**, Selenium WebDriver waits until [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. {{< code-tab >}} @@ -142,7 +142,7 @@ caps.setPageLoadStrategy("eager"); ## none -When set to **none** selenium only waits until the initial page is downloaded. +When set to **none** Selenium WebDriver only waits until the initial page is downloaded. {{< code-tab >}} {{< code-panel language="java" >}} @@ -195,4 +195,4 @@ caps.setPageLoadStrategy("none"); {{< code-panel language="kotlin" >}} // Please raise a PR {{< / code-panel >}} -{{< / code-tab >}} \ No newline at end of file +{{< / code-tab >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.ja.md b/docs_source_files/content/webdriver/page_loading_strategy.ja.md index 623ebc2a2ccb..86f1d927c48a 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.ja.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.ja.md @@ -9,7 +9,7 @@ weight: 8 {{% /notice %}} Defines the current session's page loading strategy. -By default, when selenium loads a page, +By default, when Selenium WebDriver loads a page, it follows the _normal_ pageLoadStrategy. It is always recommended to stop downloading additional resources (like images, css, js) when the page loading takes lot of time. @@ -18,8 +18,8 @@ WebDriver _pageLoadStrategy_ supports the following values: ## normal -This will make selenium to wait for the entire page is loaded. -When set to **normal** the selenium waits until the +This will make Selenium WebDriver to wait for the entire page is loaded. +When set to **normal**, Selenium WebDriver waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. By default **normal** is set to browser if none is provided. @@ -79,11 +79,11 @@ caps.setPageLoadStrategy("normal"); ## eager -This will make selenium to wait until the +This will make Selenium WebDriver to wait until the initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. -When set to **eager** selenium waits until +When set to **eager**, Selenium WebDriver waits until [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. {{< code-tab >}} @@ -141,7 +141,7 @@ caps.setPageLoadStrategy("eager"); ## none -When set to **none** selenium only waits until the initial page is downloaded. +When set to **none** Selenium WebDriver only waits until the initial page is downloaded. {{< code-tab >}} {{< code-panel language="java" >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.ko.md b/docs_source_files/content/webdriver/page_loading_strategy.ko.md index 06cb51a4a3f0..a908f54ce344 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.ko.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.ko.md @@ -10,7 +10,7 @@ it by sending us pull requests! {{% /notice %}} Defines the current session's page loading strategy. -By default, when selenium loads a page, +By default, when Selenium WebDriver loads a page, it follows the _normal_ pageLoadStrategy. It is always recommended to stop downloading additional resources (like images, css, js) when the page loading takes lot of time. @@ -19,8 +19,8 @@ WebDriver _pageLoadStrategy_ supports the following values: ## normal -This will make selenium to wait for the entire page is loaded. -When set to **normal** the selenium waits until the +This will make Selenium WebDriver to wait for the entire page is loaded. +When set to **normal**, Selenium WebDriver waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. By default **normal** is set to browser if none is provided. @@ -80,11 +80,11 @@ caps.setPageLoadStrategy("normal"); ## eager -This will make selenium to wait until the +This will make Selenium WebDriver to wait until the initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. -When set to **eager** selenium waits until +When set to **eager**, Selenium WebDriver waits until [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. {{< code-tab >}} @@ -142,7 +142,7 @@ caps.setPageLoadStrategy("eager"); ## none -When set to **none** selenium only waits until the initial page is downloaded. +When set to **none** Selenium WebDriver only waits until the initial page is downloaded. {{< code-tab >}} {{< code-panel language="java" >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.nl.md b/docs_source_files/content/webdriver/page_loading_strategy.nl.md index ed1d1989b81a..599e379d9494 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.nl.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.nl.md @@ -10,7 +10,7 @@ it by sending us pull requests! {{% /notice %}} Defines the current session's page loading strategy. -By default, when selenium loads a page, +By default, when Selenium WebDriver loads a page, it follows the _normal_ pageLoadStrategy. It is always recommended to stop downloading additional resources (like images, css, js) when the page loading takes lot of time. @@ -19,8 +19,8 @@ WebDriver _pageLoadStrategy_ supports the following values: ## normal -This will make selenium to wait for the entire page is loaded. -When set to **normal** the selenium waits until the +This will make Selenium WebDriver to wait for the entire page is loaded. +When set to **normal**, Selenium WebDriver waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. By default **normal** is set to browser if none is provided. @@ -80,11 +80,11 @@ caps.setPageLoadStrategy("normal"); ## eager -This will make selenium to wait until the +This will make Selenium WebDriver to wait until the initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. -When set to **eager** selenium waits until +When set to **eager**, Selenium WebDriver waits until [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. {{< code-tab >}} @@ -142,7 +142,7 @@ caps.setPageLoadStrategy("eager"); ## none -When set to **none** selenium only waits until the initial page is downloaded. +When set to **none** Selenium WebDriver only waits until the initial page is downloaded. {{< code-tab >}} {{< code-panel language="java" >}} diff --git a/docs_source_files/content/webdriver/page_loading_strategy.zh-cn.md b/docs_source_files/content/webdriver/page_loading_strategy.zh-cn.md index d5f878f15a12..211c63ac6433 100644 --- a/docs_source_files/content/webdriver/page_loading_strategy.zh-cn.md +++ b/docs_source_files/content/webdriver/page_loading_strategy.zh-cn.md @@ -4,7 +4,7 @@ weight: 8 --- Defines the current session's page loading strategy. -By default, when selenium loads a page, +By default, when Selenium WebDriver loads a page, it follows the _normal_ pageLoadStrategy. It is always recommended to stop downloading additional resources (like images, css, js) when the page loading takes lot of time. @@ -13,8 +13,8 @@ WebDriver _pageLoadStrategy_ supports the following values: ## normal -This will make selenium to wait for the entire page is loaded. -When set to **normal** the selenium waits until the +This will make Selenium WebDriver to wait for the entire page is loaded. +When set to **normal**, Selenium WebDriver waits until the [load](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) event fire is returned. By default **normal** is set to browser if none is provided. @@ -74,11 +74,11 @@ caps.setPageLoadStrategy("normal"); ## eager -This will make selenium to wait until the +This will make Selenium WebDriver to wait until the initial HTML document has been completely loaded and parsed, and discards loading of stylesheets, images and subframes. -When set to **eager** selenium waits until +When set to **eager**, Selenium WebDriver waits until [DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) event fire is returned. {{< code-tab >}} @@ -136,7 +136,7 @@ caps.setPageLoadStrategy("eager"); ## none -When set to **none** selenium only waits until the initial page is downloaded. +When set to **none** Selenium WebDriver only waits until the initial page is downloaded. {{< code-tab >}} {{< code-panel language="java" >}}