File tree 5 files changed +25
-9
lines changed
examples/java/src/test/java/dev/selenium/browsers
website_and_docs/content/documentation/webdriver/browsers
5 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 15
15
import org .openqa .selenium .By ;
16
16
import org .openqa .selenium .OutputType ;
17
17
import org .openqa .selenium .WebElement ;
18
- import org .openqa .selenium .firefox .FirefoxDriver ;
19
- import org .openqa .selenium .firefox .FirefoxDriverLogLevel ;
20
- import org .openqa .selenium .firefox .FirefoxDriverService ;
21
- import org .openqa .selenium .firefox .FirefoxOptions ;
22
- import org .openqa .selenium .firefox .GeckoDriverService ;
18
+ import org .openqa .selenium .firefox .*;
23
19
import org .openqa .selenium .remote .service .DriverFinder ;
24
20
21
+
22
+
23
+
24
+
25
25
public class FirefoxTest extends BaseTest {
26
26
private FirefoxDriver driver ;
27
27
@@ -189,4 +189,20 @@ public void fullPageScreenshot() throws Exception {
189
189
190
190
driver .quit ();
191
191
}
192
+
193
+ @ Test
194
+ public void setContext () {
195
+ driver = startFirefoxDriver ();
196
+
197
+ ((HasContext ) driver ).setContext (FirefoxCommandContext .CHROME );
198
+ driver .executeScript ("console.log('Inside Chrome context');" );
199
+
200
+ // Verify the context is back to "content"
201
+ Assertions .assertEquals (
202
+ FirefoxCommandContext .CHROME , ((HasContext ) driver ).getContext (),
203
+ "The context should be 'chrome'"
204
+ );
205
+
206
+ driver .quit ();
207
+ }
192
208
}
Original file line number Diff line number Diff line change @@ -441,7 +441,7 @@ please refer to the
441
441
442
442
{{< tabpane text=true >}}
443
443
{{< tab header="Java" >}}
444
- {{< badge-code >}}
444
+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L197-L198" >}}
445
445
{{< /tab >}}
446
446
{{< tab header="Python" >}}
447
447
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
Original file line number Diff line number Diff line change @@ -437,7 +437,7 @@ IDはアドオンインストール時の戻り値から取得できます。
437
437
438
438
{{< tabpane text=true >}}
439
439
{{< tab header="Java" >}}
440
- {{< badge-code >}}
440
+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L197-L198" >}}
441
441
{{< /tab >}}
442
442
{{< tab header="Python" >}}
443
443
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
Original file line number Diff line number Diff line change @@ -446,7 +446,7 @@ please refer to the
446
446
447
447
{{< tabpane text=true >}}
448
448
{{< tab header="Java" >}}
449
- {{< badge-code >}}
449
+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L197-L198" >}}
450
450
{{< /tab >}}
451
451
{{< tab header="Python" >}}
452
452
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
Original file line number Diff line number Diff line change @@ -443,7 +443,7 @@ please refer to the
443
443
444
444
{{< tabpane text=true >}}
445
445
{{< tab header="Java" >}}
446
- {{< badge-code >}}
446
+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L197-L198" >}}
447
447
{{< /tab >}}
448
448
{{< tab header="Python" >}}
449
449
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
You can’t perform that action at this time.
0 commit comments