白色UIAutomation click()停止在其他平台上工作 [英] White UIAutomation click() stops working on different platform

查看:213
本文介绍了白色UIAutomation click()停止在其他平台上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 White 来自动化C#WPF UI的BDD测试.

I'm using White to automate the BDD testing of our C# WPF UI.

我的前几次测试在我的开发计算机(运行Windows 7)上运行良好.但是,当我尝试在构建服务器(运行Windows Server 2003 R2的虚拟机)上运行相同的代码时,它无法正常工作.在这两种情况下,测试都是从命令行运行的,并且测试使用的是Cuke4Nuke框架.对于服务器,我正在通过远程桌面连接访问服务器.

My first couple of tests are working well on my development machine (running Windows 7). However, when I try and run the same code on the build server (virtual machine running Windows server 2003 R2) it doesn't work correctly. In both cases the tests are run from the command line and the tests are using the Cuke4Nuke framework. In the case of the server I am accessing the server via Remote Desktop Connection.

代码如下:

var application = Application.Launch("whiteApp.exe");
var initializeOption = InitializeOption.NoCache;
var windowCriteria = SearchCriteria.ByText("whiteApp");
var window = application.GetWindow(criteria, initializeOption);
var criteria = SearchCriteria.ByAutomationId("rightButton");
var button = (Button) window.Get(criteria);
button.click();

问题在于,在服务器上运行按钮单击事件时不会触发它.如果在White完成执行后将UI保持打开状态,则可以单击(使用鼠标)该按钮.有趣的一点是,运行click方法后,按钮确实显示出被单击的迹象,如下图所示,在其他按钮的情况下,显示了鼠标悬停效果.

The problem is that the buttons click event is not fired when it is run on the server. The button can be clicked (using the mouse) if the UI is left open after White has finished executing. One interesting point is that after the click method is run that the button does show evidence of being clicked as in the picture below, in the case of other buttons the mouse over effect is shown.

推荐答案

我不确定这是否是您的问题,但是我注意到White在使用AnyCPU平台,并在64位系统上运行.由于某种原因,在这种情况下,只要它尝试移动鼠标,它就会自动将鼠标推到屏幕底部而不是所请求的位置.这意味着单击命令会丢失被告知要单击的按钮.

I'm not sure if this is your problem or not, but I've noticed that White has a few issues when it is used by applications built using the AnyCPU platform and run on an 64-bit system. For some reason, anytime it attempts to move the mouse under these conditions, it automatically pushes the mouse to the bottom of the screen instead of the requested location. This means a click command misses the button it was told to click on.

如果将自动化应用程序构建为x86应用程序,则White会正确地自动使鼠标自动化.

If you build the automation application as an x86 application, White automates the mouse properly.

这篇关于白色UIAutomation click()停止在其他平台上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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