diff --git a/examples/python/tests/drivers/test_options.py b/examples/python/tests/drivers/test_options.py index 68bf99d5ec39..e45895911566 100644 --- a/examples/python/tests/drivers/test_options.py +++ b/examples/python/tests/drivers/test_options.py @@ -1,4 +1,6 @@ from selenium import webdriver +from selenium.webdriver.common.proxy import Proxy +from selenium.webdriver.common.proxy import ProxyType def test_page_load_strategy_normal(): @@ -7,7 +9,7 @@ def test_page_load_strategy_normal(): options.page_load_strategy = 'normal' driver = webdriver.Chrome(options=options) - driver.get("http://www.google.com") + driver.get("https://www.selenium.dev/") driver.quit() @@ -17,7 +19,7 @@ def test_page_load_strategy_eager(): options.page_load_strategy = 'eager' driver = webdriver.Chrome(options=options) - driver.get("http://www.google.com") + driver.get("https://www.selenium.dev/") driver.quit() @@ -27,5 +29,71 @@ def test_page_load_strategy_none(): options.page_load_strategy = 'none' driver = webdriver.Chrome(options=options) - driver.get("http://www.google.com") + driver.get("https://www.selenium.dev/") driver.quit() + +def test_capabilities(): + options = webdriver.ChromeOptions() + options.browser_version = 'stable' + options.platform_name = 'any' + options.accept_insecure_certs = True + driver = webdriver.Chrome(options=options) + + driver.get("https://www.selenium.dev/") + driver.quit() + +def test_timeouts_script(): + options = webdriver.ChromeOptions() + options.timeouts = { 'script': 5000 } + driver = webdriver.Chrome(options=options) + + driver.get("https://www.selenium.dev/") + driver.quit() + +def test_timeouts_page_load(): + options = webdriver.ChromeOptions() + options.timeouts = { 'pageLoad': 5000 } + driver = webdriver.Chrome(options=options) + + driver.get("https://www.selenium.dev/") + driver.quit() + +def test_timeouts_implicit_wait(): + options = webdriver.ChromeOptions() + options.timeouts = { 'implicit': 5000 } + driver = webdriver.Chrome(options=options) + + driver.get("https://www.selenium.dev/") + driver.quit() + +def test_unhandled_prompt(): + options = webdriver.ChromeOptions() + options.unhandled_prompt_behavior = 'accept' + driver = webdriver.Chrome(options=options) + + driver.get("https://www.selenium.dev/") + driver.quit() + +def test_set_window_rect(): + options = webdriver.FirefoxOptions() + options.set_window_rect = True # Full support in Firefox + driver = webdriver.Firefox(options=options) + + driver.get("https://www.selenium.dev/") + driver.quit() + +def test_strict_file_interactability(): + options = webdriver.ChromeOptions() + options.strict_file_interactability = True + driver = webdriver.Chrome(options=options) + + driver.get("https://www.selenium.dev/") + driver.quit() + +def test_proxy(): + options = webdriver.ChromeOptions() + options.proxy = Proxy({ 'proxyType': ProxyType.MANUAL, 'httpProxy' : 'http.proxy:1234'}) + driver = webdriver.Chrome(options=options) + + driver.get("https://www.selenium.dev/") + driver.quit() \ No newline at end of file diff --git a/website_and_docs/content/documentation/webdriver/drivers/_index.en.md b/website_and_docs/content/documentation/webdriver/drivers/_index.en.md index 7b39c11f1dce..797a010aba7c 100644 --- a/website_and_docs/content/documentation/webdriver/drivers/_index.en.md +++ b/website_and_docs/content/documentation/webdriver/drivers/_index.en.md @@ -30,7 +30,7 @@ on the local machine. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L10" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -64,13 +64,13 @@ and it is recommended to always use `quit` to end the session {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L13" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L15" >}} +{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L16" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/drivers/_index.ja.md b/website_and_docs/content/documentation/webdriver/drivers/_index.ja.md index 39c2880c24d1..8dee6ebaaf89 100644 --- a/website_and_docs/content/documentation/webdriver/drivers/_index.ja.md +++ b/website_and_docs/content/documentation/webdriver/drivers/_index.ja.md @@ -30,7 +30,7 @@ weight: 3 {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L10" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -63,13 +63,13 @@ weight: 3 {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L13" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L15" >}} +{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L16" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/drivers/_index.pt-br.md b/website_and_docs/content/documentation/webdriver/drivers/_index.pt-br.md index b76b49b7535f..2e335ce8673f 100644 --- a/website_and_docs/content/documentation/webdriver/drivers/_index.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/drivers/_index.pt-br.md @@ -30,7 +30,7 @@ on the local machine. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L10" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -64,13 +64,13 @@ and it is recommended to always use `quit` to end the session {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L13" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L15" >}} +{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L16" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/drivers/_index.zh-cn.md b/website_and_docs/content/documentation/webdriver/drivers/_index.zh-cn.md index 29d293539b6c..430c7f34b67e 100644 --- a/website_and_docs/content/documentation/webdriver/drivers/_index.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/drivers/_index.zh-cn.md @@ -30,7 +30,7 @@ weight: 3 {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L10" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -64,13 +64,13 @@ weight: 3 {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L13" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} {{< /tab >}} {{< tab header="Ruby" >}} -{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L15" >}} +{{< gh-codeblock path="examples/ruby/spec/drivers/options_spec.rb#L16" >}} {{< /tab >}} {{< tab header="JavaScript" >}} {{< badge-code >}} diff --git a/website_and_docs/content/documentation/webdriver/drivers/options.en.md b/website_and_docs/content/documentation/webdriver/drivers/options.en.md index d1277c6c25b6..14ffc923a1a6 100644 --- a/website_and_docs/content/documentation/webdriver/drivers/options.en.md +++ b/website_and_docs/content/documentation/webdriver/drivers/options.en.md @@ -34,7 +34,7 @@ Browser name is set by default when using an Options class instance. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L36" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -61,7 +61,7 @@ it will be automatically downloaded by [Selenium Manager]({{< ref "../../seleniu {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L37" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -117,7 +117,7 @@ event fire is returned. {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L14-L16">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L7-L9">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L9-L10">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -174,7 +174,7 @@ event fire is returned. {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L27-L29">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L17-L18">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L19-L20">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -230,7 +230,7 @@ WebDriver only waits until the initial page is downloaded. {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L40-L42">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L27-L28">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L29-L30">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -290,7 +290,7 @@ setting `platformName` sets the OS at the remote-end. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L38">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -328,7 +328,7 @@ effect for the entire session. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L39-40">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -363,7 +363,7 @@ is imposed when a new session is created by WebDriver. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L47-48">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -392,7 +392,7 @@ _TimeoutException_. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L55-56">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -419,7 +419,7 @@ is imposed when a new session is created by WebDriver. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L63-64">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -457,7 +457,7 @@ user prompt encounters at the remote-end. This is defined by {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L71-72">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -482,7 +482,7 @@ Indicates whether the remote end supports all of the [resizing and repositioning {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L79-80">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -510,7 +510,7 @@ when using _Element Send Keys_ with hidden file upload controls. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L87-88">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -571,21 +571,7 @@ public class ProxyTest { ``` {{% /tab %}} {{% tab header="Python" %}} -```python -from selenium import webdriver - -PROXY = "" -webdriver.DesiredCapabilities.FIREFOX['proxy'] = { -"httpProxy": PROXY, -"ftpProxy": PROXY, -"sslProxy": PROXY, -"proxyType": "MANUAL", - -} - -with webdriver.Firefox() as driver: - driver.get("https://selenium.dev") -``` +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L95-96">}} {{% /tab %}} {{% tab header="CSharp" %}} ```CSharp diff --git a/website_and_docs/content/documentation/webdriver/drivers/options.ja.md b/website_and_docs/content/documentation/webdriver/drivers/options.ja.md index 432c69225b79..0895b84fc365 100644 --- a/website_and_docs/content/documentation/webdriver/drivers/options.ja.md +++ b/website_and_docs/content/documentation/webdriver/drivers/options.ja.md @@ -34,7 +34,7 @@ Browser name is set by default when using an Options class instance. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L36" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -62,7 +62,7 @@ it will be automatically downloaded by [Selenium Manager]({{< ref "../../seleniu {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L37" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -115,7 +115,7 @@ WebDriver は [load](https://developer.mozilla.org/ja/docs/Web/API/Window/load_e {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L14-L16">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L7-L9">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L9-L10">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -171,7 +171,7 @@ WebDriver は、[DOMContentLoaded](https://developer.mozilla.org/ja/docs/Web/API {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L27-L29">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L17-L18">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L19-L20">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -226,7 +226,7 @@ WebDriver は、最初のページがダウンロードされるまで待機し {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L40-L42">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L27-L28">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L29-L30">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -284,7 +284,7 @@ fun main() { {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L38">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -316,7 +316,7 @@ fun main() { {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L39-40">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -348,7 +348,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L47-48">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -374,7 +374,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L55-56">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -399,7 +399,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L63-64">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -436,7 +436,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L71-72">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -462,7 +462,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L79-80">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -489,7 +489,7 @@ WebDriverの `セッション` には特定の `セッションタイムアウ {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L87-88">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -545,21 +545,7 @@ public class ProxyTest { ``` {{% /tab %}} {{% tab header="Python" %}} -```python -from selenium import webdriver - -PROXY = "" -webdriver.DesiredCapabilities.FIREFOX['proxy'] = { -"httpProxy": PROXY, -"ftpProxy": PROXY, -"sslProxy": PROXY, -"proxyType": "MANUAL", - -} - -with webdriver.Firefox() as driver: - driver.get("https://selenium.dev") -``` +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L95-96">}} {{% /tab %}} {{% tab header="CSharp" %}} ```CSharp diff --git a/website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md b/website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md index 3be6978d62bc..4325eb4d612a 100644 --- a/website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/drivers/options.pt-br.md @@ -46,7 +46,7 @@ extremidade remota, a criação da sessão falhará. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L36" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -74,7 +74,7 @@ tiver apenas 80 instalados, a criação da sessão falhará. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L37" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -130,7 +130,7 @@ event fire is returned. {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L14-L16">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L7-L9">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L9-L10">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -186,7 +186,7 @@ event fire is returned. {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L27-L29">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L17-L18">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L19-L20">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -241,7 +241,7 @@ WebDriver only waits until the initial page is downloaded. {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L40-L42">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L27-L28">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L29-L30">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -301,7 +301,7 @@ setting `platformName` sets the OS at the remote-end. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L38">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -339,7 +339,7 @@ effect for the entire session. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L39-40">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -375,7 +375,7 @@ is imposed when a new session is created by WebDriver. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L47-48">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -404,7 +404,7 @@ _TimeoutException_. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L55-56">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -431,7 +431,7 @@ is imposed when a new session is created by WebDriver. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L63-64">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -470,7 +470,7 @@ user prompt encounters at the remote-end. This is defined by {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L71-72">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -496,7 +496,7 @@ Indicates whether the remote end supports all of the [resizing and repositioning {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L79-80">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -525,7 +525,7 @@ when using _Element Send Keys_ with hidden file upload controls. {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L87-88">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -587,21 +587,7 @@ public class ProxyTest { ``` {{% /tab %}} {{% tab header="Python" %}} -```python -from selenium import webdriver - -PROXY = "" -webdriver.DesiredCapabilities.FIREFOX['proxy'] = { -"httpProxy": PROXY, -"ftpProxy": PROXY, -"sslProxy": PROXY, -"proxyType": "MANUAL", - -} - -with webdriver.Firefox() as driver: - driver.get("https://selenium.dev") -``` +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L95-96">}} {{% /tab %}} {{% tab header="CSharp" %}} ```CSharp diff --git a/website_and_docs/content/documentation/webdriver/drivers/options.zh-cn.md b/website_and_docs/content/documentation/webdriver/drivers/options.zh-cn.md index 24a2ec75ff20..979ee5244e86 100644 --- a/website_and_docs/content/documentation/webdriver/drivers/options.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/drivers/options.zh-cn.md @@ -37,7 +37,7 @@ aliases: [ {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L36" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -66,7 +66,7 @@ aliases: [ {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="examples/python/tests/drivers/test_options.py#L37" >}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -126,7 +126,7 @@ WebDriver一直等到 [load](https://developer.mozilla.org/en-US/docs/Web/API/Wi {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L14-L16">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L7-L9">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L9-L10">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -182,7 +182,7 @@ WebDriver一直等到 [DOMContentLoaded](https://developer.mozilla.org/en-US/doc {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L27-L29">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L17-L18">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L19-L20">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -237,7 +237,7 @@ WebDriver 仅等待初始页面已下载. {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/drivers/OptionsTest.java#L40-L42">}} {{< /tab >}} {{< tab header="Python" text=true >}} -{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L27-L28">}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L29-L30">}} {{< /tab >}} {{< tab header="CSharp" >}} using OpenQA.Selenium; @@ -297,7 +297,7 @@ fun main() { {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L38">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -332,7 +332,7 @@ fun main() { {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L39-40">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -367,7 +367,7 @@ WebDriver创建新会话时, {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L47-48">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -395,7 +395,7 @@ WebDriver创建新会话时, {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L55-56">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -421,7 +421,7 @@ WebDriver创建新会话时, {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L63-64">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -460,7 +460,7 @@ WebDriver创建新会话时, {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L71-72">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -487,7 +487,7 @@ WebDriver创建新会话时, {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L79-80">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -516,7 +516,7 @@ WebDriver创建新会话时, {{< badge-code >}} {{< /tab >}} {{% tab header="Python" %}} -{{< badge-code >}} +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L87-88">}} {{% /tab %}} {{< tab header="CSharp" >}} {{< badge-code >}} @@ -575,21 +575,7 @@ public class ProxyTest { ``` {{% /tab %}} {{% tab header="Python" %}} -```python -from selenium import webdriver - -PROXY = "" -webdriver.DesiredCapabilities.FIREFOX['proxy'] = { -"httpProxy": PROXY, -"ftpProxy": PROXY, -"sslProxy": PROXY, -"proxyType": "MANUAL", - -} - -with webdriver.Firefox() as driver: - driver.get("https://selenium.dev") -``` +{{< gh-codeblock path="/examples/python/tests/drivers/test_options.py#L95-96">}} {{% /tab %}} {{% tab header="CSharp" %}} ```CSharp