File tree Expand file tree Collapse file tree
javascript/node/selenium-webdriver
java/src/org/openqa/selenium/edge Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,8 +55,16 @@ public EdgeOptions() {
5555 super (CapabilityType .BROWSER_NAME , EDGE .browserName (), CAPABILITY );
5656 }
5757
58- public void useWebView (boolean webViewEnabled ) {
59- String browserName = webViewEnabled ? WEBVIEW2_BROWSER_NAME : EDGE .browserName ();
58+ /**
59+ * Changes the browser name to 'webview2' to enable
60+ * <a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/webdriver">
61+ * test automation of WebView2 apps with Microsoft Edge WebDriver
62+ * </a>
63+ *
64+ * @param enable boolean flag to enable or disable the 'webview2' usage
65+ */
66+ public void useWebView (boolean enable ) {
67+ String browserName = enable ? WEBVIEW2_BROWSER_NAME : EDGE .browserName ();
6068 setCapability (CapabilityType .BROWSER_NAME , browserName );
6169 }
6270
Original file line number Diff line number Diff line change @@ -127,6 +127,19 @@ class Options extends chromium.Options {
127127 setEdgeChromiumBinaryPath ( path ) {
128128 return this . setBinaryPath ( path )
129129 }
130+
131+ /**
132+ * Changes the browser name to 'webview2' to enable
133+ * <a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/webdriver">
134+ * test automation of WebView2 apps with Microsoft Edge WebDriver
135+ * </a>
136+ *
137+ * @param {boolean } enable flag to enable or disable the 'webview2' usage
138+ */
139+ useWebView ( enable ) {
140+ const browserName = enable ? 'webview2' : Browser . EDGE ;
141+ return this . setBrowserName ( browserName ) ;
142+ }
130143}
131144
132145/**
Original file line number Diff line number Diff line change @@ -61,6 +61,15 @@ describe('edge.Options', function () {
6161 } ,
6262 } )
6363 } )
64+
65+ it ( 'useWebView changes browser name' , function ( ) {
66+ let options = new edge . Options ( )
67+ assert . strictEqual ( options . getBrowserName ( ) , 'MicrosoftEdge' )
68+ options . useWebView ( true )
69+ assert . strictEqual ( options . getBrowserName ( ) , 'webview2' )
70+ options . useWebView ( false )
71+ assert . strictEqual ( options . getBrowserName ( ) , 'MicrosoftEdge' )
72+ } )
6473 } )
6574
6675 describe ( 'addExtensions' , function ( ) {
You can’t perform that action at this time.
0 commit comments