File tree Expand file tree Collapse file tree 5 files changed +25
-9
lines changed
examples/java/src/test/java/dev/selenium/browsers
website_and_docs/content/documentation/webdriver/browsers Expand file tree Collapse file tree 5 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 1515import org .openqa .selenium .By ;
1616import org .openqa .selenium .OutputType ;
1717import 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 .*;
2319import org .openqa .selenium .remote .service .DriverFinder ;
2420
21+
22+
23+
24+
2525public class FirefoxTest extends BaseTest {
2626 private FirefoxDriver driver ;
2727
@@ -189,4 +189,20 @@ public void fullPageScreenshot() throws Exception {
189189
190190 driver .quit ();
191191 }
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+ }
192208}
Original file line number Diff line number Diff line change @@ -441,7 +441,7 @@ please refer to the
441441
442442{{< tabpane text=true >}}
443443{{< tab header="Java" >}}
444- {{< badge-code >}}
444+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L197-L198" >}}
445445{{< /tab >}}
446446{{< tab header="Python" >}}
447447{{< 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はアドオンインストール時の戻り値から取得できます。
437437
438438{{< tabpane text=true >}}
439439{{< tab header="Java" >}}
440- {{< badge-code >}}
440+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L197-L198" >}}
441441{{< /tab >}}
442442{{< tab header="Python" >}}
443443{{< 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
446446
447447{{< tabpane text=true >}}
448448{{< tab header="Java" >}}
449- {{< badge-code >}}
449+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L197-L198" >}}
450450{{< /tab >}}
451451{{< tab header="Python" >}}
452452{{< 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
443443
444444{{< tabpane text=true >}}
445445{{< tab header="Java" >}}
446- {{< badge-code >}}
446+ {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L197-L198" >}}
447447{{< /tab >}}
448448{{< tab header="Python" >}}
449449{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L149-L150" >}}
You can’t perform that action at this time.
0 commit comments