Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ appWorkingDir | Optional working directory path for the application.
prerun | An object containing either `script` or `command` key. The value of each key must be a valid PowerShell script or command to be executed prior to the WinAppDriver session startup. See [Power Shell commands execution](#power-shell-commands-execution) for more details. Example: `{script: 'Get-Process outlook -ErrorAction SilentlyContinue'}`
postrun | An object containing either `script` or `command` key. The value of each key must be a valid PowerShell script or command to be executed after WinAppDriver session is stopped. See [Power Shell commands execution](#power-shell-commands-execution) for more details.
isolatedScriptExecution | Whether PowerShell scripts are executed in an isolated session. Default is `false`.
webviewDevtoolsPort | The local port number to use for devtools communication. By default the first free port from 10900..11000 range is selected. Consider setting the custom value if you are running parallel tests.
enableWebView | Whether to enable WebView support. Set to true to allow switching into WebView contexts. Default is `false`.
webviewDevtoolsPort | The local port number to use for devtools communication. By default the first free port from 10900..11000 range is selected. Set a custom port if running parallel tests or when app is "none"/"root"/appTopLevelWindow is specified.

Please note that more capabilities will be added as the development of this driver progresses. Since it is still in its early stages, some features may be missing or subject to change. If you need a specific capability or encounter any issues, please feel free to open an issue.

Expand Down
8 changes: 7 additions & 1 deletion lib/commands/contexts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ export async function getWebViewDetails(this: NovaWindowsDriver, waitForWebviewM
}

const host = 'localhost';
const port = this.webviewDevtoolsPort;

if ((this.caps.app === 'none' || this.caps.app === 'root' || this.caps.appTopLevelWindow != null) && this.caps.webviewDevtoolsPort == null) {
throw new errors.InvalidArgumentError(`Capability "webviewDevtoolsPort" must be set when using "none", "root", or "appTopLevelWindow" with "enableWebView"`);
}

const port = this.webviewDevtoolsPort ??= this.caps.webviewDevtoolsPort ?? null;

const webViewDetails: WebViewDetails = {
info: await cdpRequest.call(this, ({ host, port, endpoint: '/json/version', timeout: 10000 })),
pages: await cdpRequest.call(this, ({ host, port, endpoint: '/json/list', timeout: 10000 })),
Expand Down