尝试使用 WinAppDriver 模拟(自动)通过 Outlook 发送电子邮件,“新电子邮件”元素被识别并打开新窗口,但在新窗口中“收件人”、“抄送”等控件无法识别。
我怀疑驱动程序无法使用新的 Windows 会话。
try {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setPlatform(Platform.WIN10);
//capabilities.setCapability("appTopLevelWindow", "0xBB880A");
capabilities.setCapability("app", "C:\\Program Files\\Microsoft Office\\Office14\\OUTLOOK.exe");
outlookSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities);
outlookSession.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
} catch (MalformedURLException e) {
e.printStackTrace();
}
newEmail = outlookSession.findElementByName("New E-mail");
System.out.println("newEmail:::::: " + newEmail);
newEmail.click();
outlookSession.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
outlookSession.findElementByName("To").sendKeys("<email>"); (the 'To' element is not recognized.