WinAppDriver OutLook找不到新的电子邮件元素(WinAppDriver OutLook New Email Elements not found)

编程入门 行业动态 更新时间:2024-10-26 19:35:51
WinAppDriver OutLook找不到新的电子邮件元素(WinAppDriver OutLook New Email Elements not found)

尝试使用WinAppDriver模拟(自动化)通过outlook发送的电子邮件,识别“新电子邮件”元素并打开新窗口但在新窗口中无法识别“收件人”,“CC”等控件。

我怀疑新的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.

Trying to mimic (automate) email sending through outlook using WinAppDriver, the "New E-mail" element is recognized and new window opens but on the new Window the "To","CC" etc controls are not recognized.

I suspect the new windows session is not available for the driver.

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.

最满意答案

我认为您面临的问题是因为Outlook将为您的新电子邮件创建一个新的Windows。 这将导致窗口不属于您当前的会话。 解决此问题的最佳方法是创建桌面会话,找到新窗口,然后附加新会话,然后从那里控制新窗口。

希望这可以帮助。

吉尔斯·〜

I think that the problem you are facing is cause by the fact that Outlook will create a new Windows for your new email. That will result in the window not being part of your current session. The best way to address this, is probably creating a desktop session, finding your new window and then attaching a new session and then controlling your new window from there.

Hope this helps.

~Gilles

更多推荐

本文发布于:2023-08-02 17:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1378307.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   元素   电子邮件   OutLook   WinAppDriver

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!