java - 使用 Winiumdriver 的 WebDriver 异常
问题描述
我已经开始学习 Winium 工具了。使用以下代码运行时:
public class CalcDemo {
public static void main(String[] args) throws MalformedURLException {
DesktopOptions options=new DesktopOptions();
options.setApplicationPath("C:\\Windows\\System32\\notepad.exe");
WiniumDriver driver=new WiniumDriver(new URL("http://localhost:9999"), options);
driver.findElementByClassName("Edit").sendKeys("This is sample test");
driver.close();
}
}
我收到以下错误:
"org.openqa.selenium.WebDriverException: The given path's format is not supported"
谁能帮我吗。
谢谢。
解决方案
我认为您需要在尝试访问 Edit 类之前找到该窗口。
这是我的 C# 示例:
var dc = new DesiredCapabilities();
dc.SetCapability("app", @"C:/windows/system32/Notepad.exe");
var driver = new RemoteWebDriver(new Uri("http://localhost:9999"), dc);
var window = driver.FindElementByClassName("Notepad");
var edit = window.FindElement(By.Name("Text Editor"));
推荐阅读
- angular - Angular 6 动态模板引用变量
- excel - Exist function in dictionary doesn't work for an object as Key created in a class module
- c# - 为系统循环创建高性能组件池
- python - 为什么某些网站出现 urllib 错误
- mysql - 如何减少查询的执行时间
- laravel - 如何在 Laravel 中导入具有各种模型(和子数据/模型)的单个 excel 文件/工作表?
- python - Numpy:从熊猫数据帧创建可变长度序列
- java - 从 Jhipster 中的 URL 中删除哈希 (#) (java 和 angular 6)
- css - 使用 scss 执行包含通用部分和特定部分的最小 css 规则集?
- amazon-web-services - docker 输出中的 AWS 会话管理器 ^@ 无限期