diff --git a/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java b/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java index 70ea5c18240..28166e12480 100644 --- a/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java +++ b/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java @@ -205,4 +205,16 @@ public void setContext() { driver.quit(); } + + @Test + public void firefoxProfile() { + FirefoxProfile profile = new FirefoxProfile(); + FirefoxOptions options = new FirefoxOptions(); + profile.setPreference("javascript.enabled", "False"); + options.setProfile(profile); + + driver = new FirefoxDriver(options); + + driver.quit(); + } } diff --git a/examples/python/tests/browsers/test_firefox.py b/examples/python/tests/browsers/test_firefox.py index 82ebc47abf3..5780e16106f 100644 --- a/examples/python/tests/browsers/test_firefox.py +++ b/examples/python/tests/browsers/test_firefox.py @@ -151,3 +151,17 @@ def test_set_context(firefox_driver): # Check if the context is back to content assert driver.execute("GET_CONTEXT")["value"] == "content" + + +def test_firefox_profile(): + from selenium.webdriver.firefox.options import Options + from selenium.webdriver.firefox.firefox_profile import FirefoxProfile + + options = Options() + firefox_profile = FirefoxProfile() + firefox_profile.set_preference("javascript.enabled", False) + options.profile = firefox_profile + + driver = webdriver.Firefox(options=options) + + driver.quit() diff --git a/website_and_docs/content/documentation/webdriver/browsers/firefox.en.md b/website_and_docs/content/documentation/webdriver/browsers/firefox.en.md index f2eac7c6b54..6d7f2c150cf 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/firefox.en.md +++ b/website_and_docs/content/documentation/webdriver/browsers/firefox.en.md @@ -102,20 +102,12 @@ There are several ways to work with Firefox profiles. {{< tabpane langEqualsHeader=true >}} {{< badge-examples >}} - {{< tab header="Java" >}} -FirefoxProfile profile = new FirefoxProfile(); -FirefoxOptions options = new FirefoxOptions(); -options.setProfile(profile); -driver = new FirefoxDriver(options); - {{< /tab >}} - {{< tab header="Python" >}} -from selenium.webdriver.firefox.options import Options -from selenium.webdriver.firefox.firefox_profile import FirefoxProfile -options=Options() -firefox_profile = FirefoxProfile() -firefox_profile.set_preference("javascript.enabled", False) -options.profile = firefox_profile - {{< /tab >}} +{{< tab header="Java" >}} +{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}} +{{< /tab >}} {{< tab header="CSharp" >}} var options = new FirefoxOptions(); var profile = new FirefoxProfile(); diff --git a/website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md b/website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md index 126638d5acb..8b565f4c4ee 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md +++ b/website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md @@ -106,21 +106,13 @@ Firefoxプロファイルを操作するにはいくつかの方法がありま
{{< tabpane langEqualsHeader=true >}} - {{< tab header="Java" >}} -FirefoxProfile profile = new FirefoxProfile(); -FirefoxOptions options = new FirefoxOptions(); -options.setProfile(profile); -driver = new RemoteWebDriver(options); - {{< /tab >}} - {{< tab header="Python" >}} -from selenium.webdriver.firefox.options import Options -from selenium.webdriver.firefox.firefox_profile import FirefoxProfile -options=Options() -firefox_profile = FirefoxProfile() -firefox_profile.set_preference("javascript.enabled", False) -options.profile = firefox_profile - {{< /tab >}} - {{< tab header="CSharp" >}} +{{< tab header="Java" >}} +{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}} +{{< /tab >}} +{{< tab header="CSharp" >}} var options = new FirefoxOptions(); var profile = new FirefoxProfile(); options.Profile = profile; diff --git a/website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md b/website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md index f36890f487d..e0f02a2bc95 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md @@ -105,20 +105,12 @@ Existem várias formas de trabalhar com perfis Firefox
{{< tabpane langEqualsHeader=true >}} - {{< tab header="Java" >}} -FirefoxProfile profile = new FirefoxProfile(); -FirefoxOptions options = new FirefoxOptions(); -options.setProfile(profile); -driver = new RemoteWebDriver(options); - {{< /tab >}} - {{< tab header="Python" >}} -from selenium.webdriver.firefox.options import Options -from selenium.webdriver.firefox.firefox_profile import FirefoxProfile -options=Options() -firefox_profile = FirefoxProfile() -firefox_profile.set_preference("javascript.enabled", False) -options.profile = firefox_profile - {{< /tab >}} +{{< tab header="Java" >}} +{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}} +{{< /tab >}} {{< tab header="CSharp" >}} var options = new FirefoxOptions(); var profile = new FirefoxProfile(); diff --git a/website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md b/website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md index b56e5f62b74..ed1794f23e3 100644 --- a/website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md @@ -104,20 +104,12 @@ There are several ways to work with Firefox profiles
{{< tabpane langEqualsHeader=true >}} - {{< tab header="Java" >}} -FirefoxProfile profile = new FirefoxProfile(); -FirefoxOptions options = new FirefoxOptions(); -options.setProfile(profile); -driver = new RemoteWebDriver(options); - {{< /tab >}} - {{< tab header="Python" >}} -from selenium.webdriver.firefox.options import Options -from selenium.webdriver.firefox.firefox_profile import FirefoxProfile -options=Options() -firefox_profile = FirefoxProfile() -firefox_profile.set_preference("javascript.enabled", False) -options.profile = firefox_profile - {{< /tab >}} +{{< tab header="Java" >}} +{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}} +{{< /tab >}} +{{< tab header="Python" >}} +{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}} +{{< /tab >}} {{< tab header="CSharp" >}} var options = new FirefoxOptions(); var profile = new FirefoxProfile();