找不到WinAppDriver OutLook新电子邮件元素 [英] WinAppDriver OutLook New Email Elements not found

查看:177
本文介绍了找不到WinAppDriver OutLook新电子邮件元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用WinAppDriver模拟(自动)通过Outlook发送的电子邮件,可以识别新电子邮件"元素,并会打开新窗口,但是在新窗口中,无法识别收件人",抄送"等控件.

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.

我怀疑新的Windows会话不适用于驱动程序.

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.

希望这会有所帮助.

〜吉尔斯

这篇关于找不到WinAppDriver OutLook新电子邮件元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆