1

就像在 java 中一样,我们有以下代码。我在 c# 中需要相同的代码。

启动 winium 驱动程序

public WiniumDriver setupEnvironment() throws IOException {

String outlookApplicationPath = "C:\\ProgramfileS|\...\..\outlook.exe";
String winiumDriverPath = "C:\Progra...\..\winium.desktop.exe";

options = new DesktopOptions(); //Initiate Winium Desktop Options
options.setApplicationPath(outlookApplicationPath); //Set outlook application path

File drivePath = new File(winiumDriverPath); //Set winium driver path

service = new WiniumDriverService.Builder().usingDriverExecutable(drivePath).usingPort(9999).withVerbose(true).withSilent(false).buildDesktopService();
service.start(); //Build and Start a Winium Driver service
driver = new WiniumDriver(service, options); //Start a winium driver

return driver;

}
4

1 回答 1

1

这里有一些示例代码:https ://github.com/2gis/Winium.Desktop/wiki/Magic-Samples 相关部分是:

        var dc = new DesiredCapabilities();
        dc.SetCapability("app", @"C:/windows/system32/calc.exe");
        var driver = new RemoteWebDriver(new Uri("http://localhost:9999"), dc);

它假定您手动启动 Winium.Desktop.Driver.exe,但您可以在测试之间保持运行。

于 2018-09-10T11:22:32.500 回答