Selenium Library

I have a code written in other language which helps in writing Automation Test cases for and exe application. However this desktop app displays any webpage you have passed as an arguement to it. (This is a feature provided and is called as Webview2 component)

In the automation documentation they have mentioned that it can be done via Selenium and Edge drivers (Because it uses Microsoft Edge for driving the web page in the desktop container)

I want to do with Robot Framework, can someone guide how can we write below code using robot framework.

     EdgeOptions edgeOptions = new EdgeOptions(false, "webview2");
edgeOptions.BinaryLocation = @"C:\path\to\your\webview2\project.exe";
string msedgedriverDir = @"C:\path\to\your\msededriver.exe's\directory";
string msedgedriverExe = @"msedgedriver.exe";
EdgeDriverService service = EdgeDriverService.CreateDefaultService(msedgedriverDir, 
    msedgedriverExe, false);

EdgeDriver e = new EdgeDriver(service, edgeOptions);
e.Url = @"https://www.microsoft.com";
e.Quit();

@admins This should probably been put in the SeleniumLibrary subcategory rather than the Browser subcategory

Hi @Bhavnasewani,

As Edge is a relatively new browser it doesn’t seem to get included in any of the documentation for seleniumlibrary, but I believe it should be similar to the chrome examples in Open Browser

if you scroll down to the section about passing options to the webdriver you see an example python code to return some custom chrome options, I would expect you need to do the same type of thing, though there is also a string format and as you only need to pass one option (BinaryLocation) I would try the string format first.

From reading over all the documentation I think what you need is something like this:

Open Browser	https://www.microsoft.com	Edge	options=binary_location="C:/path/to/your/webview2/project.exe"

If you really want to use the windows style backslash you’ll need to escape them:

Open Browser	https://www.microsoft.com	Edge	options=binary_location="C:\\path\\to\\your\\webview2\\project.exe"

unix style forward slashes do work in windows and make life easier as you don’t need to escape the escape characters when passing them through, not sure if that will be needed here.

If this doesn’t work then you’ll probably need to try the python method, let us know if you need help with that.

Hopefully this helps,

Dave.

@Bhavnasewani I think I have a solution for you to try. I was able to use @damies13 's example with a bit of modification to make this all work in selenium 3 (Seems Appium library isn’t fully compatible in selenium 4 yet in my testing).

This has been merged to master and can be installed with:

pip install robotframework-zoomba --upgrade

I have a demo script using the sample application provided by microsoft located in ~/samples/WebView-DesktopTest.robot. This script shows how to open the application, control the webview layer, and also control the application layer.

Let me know if that works for your app or any other thoughts / suggestions.