EdgeWebDriver
EdgeWebDriver copied to clipboard
Selenium Webview2 writing to inaccessible directory
When launching selenium webdriver with UseWebView however the application cannot start because WEBVIEW2_USER_DATA_FOLDER is set C:\WINDOWS\SystemTemp\scoped_dir*.
We tried to overwrite this location to a different location by passing in --user-data-dir= or setting our own environment variable.
When its environment variable is overwritten selenium doesn't know the correct location of the user data directory.
what we are using:
- selenium.webdriver 4.12.4
- edge 116.0.1938.69
- edge webdriver 116.0.1938.69
Hi @jar99 . As you found, --user-data-dir won't work to set the user data folder for the WebView2 runtime because Edge WebDriver is passed that arg to your host app, and not to the underlying WebView2 process.
To set the user data folder and other options seen by the WebView2 process, you need to use the webViewOptions object. Details here: https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options#webviewoptions-object