像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;
}
答案 0 :(得分:0)
这里有一些示例代码: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,但是可以在测试之间运行它。