[英]C# How to initiate the winium driver
like in java we have the following code.I need the same code in c#.就像在 Java 中一样,我们有以下代码。我需要在 C# 中使用相同的代码。
To initiate the winium driver启动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;
}
There's some sample code here: https://github.com/2gis/Winium.Desktop/wiki/Magic-Samples The relevant section is:这里有一些示例代码: 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);
It assumes you start Winium.Desktop.Driver.exe manually, but you can leave that running between tests.它假定您手动启动 Winium.Desktop.Driver.exe,但您可以在测试之间保持运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.