File tree Expand file tree Collapse file tree 6 files changed +51
-57
lines changed
java/src/test/java/dev/selenium/browsers
website_and_docs/content/documentation/webdriver/browsers Expand file tree Collapse file tree 6 files changed +51
-57
lines changed Original file line number Diff line number Diff line change @@ -205,4 +205,16 @@ public void setContext() {
205205
206206 driver .quit ();
207207 }
208+
209+ @ Test
210+ public void firefoxProfile () {
211+ FirefoxProfile profile = new FirefoxProfile ();
212+ FirefoxOptions options = new FirefoxOptions ();
213+ profile .setPreference ("javascript.enabled" , "False" );
214+ options .setProfile (profile );
215+
216+ driver = new FirefoxDriver (options );
217+
218+ driver .quit ();
219+ }
208220}
Original file line number Diff line number Diff line change @@ -151,3 +151,17 @@ def test_set_context(firefox_driver):
151151
152152 # Check if the context is back to content
153153 assert driver .execute ("GET_CONTEXT" )["value" ] == "content"
154+
155+
156+ def test_firefox_profile ():
157+ from selenium .webdriver .firefox .options import Options
158+ from selenium .webdriver .firefox .firefox_profile import FirefoxProfile
159+
160+ options = Options ()
161+ firefox_profile = FirefoxProfile ()
162+ firefox_profile .set_preference ("javascript.enabled" , False )
163+ options .profile = firefox_profile
164+
165+ driver = webdriver .Firefox (options = options )
166+
167+ driver .quit ()
Original file line number Diff line number Diff line change @@ -102,20 +102,12 @@ There are several ways to work with Firefox profiles.
102102
103103{{< tabpane langEqualsHeader=true >}}
104104{{< badge-examples >}}
105- {{< tab header="Java" >}}
106- FirefoxProfile profile = new FirefoxProfile();
107- FirefoxOptions options = new FirefoxOptions();
108- options.setProfile(profile);
109- driver = new FirefoxDriver(options);
110- {{< /tab >}}
111- {{< tab header="Python" >}}
112- from selenium.webdriver.firefox.options import Options
113- from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
114- options=Options()
115- firefox_profile = FirefoxProfile()
116- firefox_profile.set_preference("javascript.enabled", False)
117- options.profile = firefox_profile
118- {{< /tab >}}
105+ {{< tab header="Java" >}}
106+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}}
107+ {{< /tab >}}
108+ {{< tab header="Python" >}}
109+ {{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}}
110+ {{< /tab >}}
119111 {{< tab header="CSharp" >}}
120112var options = new FirefoxOptions();
121113var profile = new FirefoxProfile();
Original file line number Diff line number Diff line change @@ -106,21 +106,13 @@ Firefoxプロファイルを操作するにはいくつかの方法がありま
106106
107107<div >
108108{{< tabpane langEqualsHeader=true >}}
109- {{< tab header="Java" >}}
110- FirefoxProfile profile = new FirefoxProfile();
111- FirefoxOptions options = new FirefoxOptions();
112- options.setProfile(profile);
113- driver = new RemoteWebDriver(options);
114- {{< /tab >}}
115- {{< tab header="Python" >}}
116- from selenium.webdriver.firefox.options import Options
117- from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
118- options=Options()
119- firefox_profile = FirefoxProfile()
120- firefox_profile.set_preference("javascript.enabled", False)
121- options.profile = firefox_profile
122- {{< /tab >}}
123- {{< tab header="CSharp" >}}
109+ {{< tab header="Java" >}}
110+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}}
111+ {{< /tab >}}
112+ {{< tab header="Python" >}}
113+ {{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}}
114+ {{< /tab >}}
115+ {{< tab header="CSharp" >}}
124116var options = new FirefoxOptions();
125117var profile = new FirefoxProfile();
126118options.Profile = profile;
Original file line number Diff line number Diff line change @@ -105,20 +105,12 @@ Existem várias formas de trabalhar com perfis Firefox
105105
106106<div >
107107{{< tabpane langEqualsHeader=true >}}
108- {{< tab header="Java" >}}
109- FirefoxProfile profile = new FirefoxProfile();
110- FirefoxOptions options = new FirefoxOptions();
111- options.setProfile(profile);
112- driver = new RemoteWebDriver(options);
113- {{< /tab >}}
114- {{< tab header="Python" >}}
115- from selenium.webdriver.firefox.options import Options
116- from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
117- options=Options()
118- firefox_profile = FirefoxProfile()
119- firefox_profile.set_preference("javascript.enabled", False)
120- options.profile = firefox_profile
121- {{< /tab >}}
108+ {{< tab header="Java" >}}
109+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}}
110+ {{< /tab >}}
111+ {{< tab header="Python" >}}
112+ {{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}}
113+ {{< /tab >}}
122114 {{< tab header="CSharp" >}}
123115var options = new FirefoxOptions();
124116var profile = new FirefoxProfile();
Original file line number Diff line number Diff line change @@ -104,20 +104,12 @@ There are several ways to work with Firefox profiles
104104
105105<div >
106106{{< tabpane langEqualsHeader=true >}}
107- {{< tab header="Java" >}}
108- FirefoxProfile profile = new FirefoxProfile();
109- FirefoxOptions options = new FirefoxOptions();
110- options.setProfile(profile);
111- driver = new RemoteWebDriver(options);
112- {{< /tab >}}
113- {{< tab header="Python" >}}
114- from selenium.webdriver.firefox.options import Options
115- from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
116- options=Options()
117- firefox_profile = FirefoxProfile()
118- firefox_profile.set_preference("javascript.enabled", False)
119- options.profile = firefox_profile
120- {{< /tab >}}
107+ {{< tab header="Java" >}}
108+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}}
109+ {{< /tab >}}
110+ {{< tab header="Python" >}}
111+ {{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}}
112+ {{< /tab >}}
121113 {{< tab header="CSharp" >}}
122114var options = new FirefoxOptions();
123115var profile = new FirefoxProfile();
You can’t perform that action at this time.
0 commit comments