标签: ui-automation

使用System.Windows.Automation和Microsoft.VisualStudio.TestTools.UITesting进行WPF UI测试自动化有什么区别?

使用System.Windows.Automation(通常称为UIA)API和Microsoft.VisualStudio.TestTools.UITesting(在场景后面的Coded UI Test中使用的API)以编程方式实现WPF应用程序的UI测试自动化有什么区别?

是否有任何特定的场景,限制或优点/缺点?

wpf ui-automation coded-ui-tests

9
推荐指数
2
解决办法
3614
查看次数

使用自动化框架在textfield/textbox上设置文本并获取更改事件

我想在文本字段/文本框元素上使用Mircosoft UI自动化框架设置文本,这意味着AutomationElement来自ControlType.EditControlType.Document.

目前我正在使用TextPattern以从其中一个获取文本AutomationElements:

TextPattern tp = (TextPattern)element.GetCurrentPattern(TextPattern.Pattern);
string text = tp.DocumentRange.GetText(-1).Trim();
Run Code Online (Sandbox Code Playgroud)

但现在我想在中设置一个新文本AutomationElement.我在TextPattern课堂上找不到这方法.所以我试图使用ValuePattern但我不确定这是否是正确的方法:

ValuePattern value = element.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;
value.SetValue(insertText);
Run Code Online (Sandbox Code Playgroud)

还有其他方法来设置文本值吗?

另一个问题是如何在Edit/ Document元素上更改文本时获取事件?我尝试使用TextChangedEvent但是在更改文本时我没有触发任何事件:

AutomationEventHandler ehTextChanged = new AutomationEventHandler(text_event);
Automation.AddAutomationEventHandler(TextPattern.TextChangedEvent, element, TreeScope.Element, ehTextChanged);

private void text_event(object sender, AutomationEventArgs e)
{
    Console.WriteLine("Text changed");
}
Run Code Online (Sandbox Code Playgroud)

c# events user-interface input ui-automation

9
推荐指数
1
解决办法
1万
查看次数

UIAutomation内存问题

我有一个简单的WPF程序,只有一个没有事件处理逻辑的按钮.然后我使用UIAutomation框架连续多次单击该按钮.最后,我看一下WPF程序使用的内存,它似乎在不断发展壮大.

任何人都知道为什么会这样,我怎么能防止这种情况发生?

这是简单的WPF程序(后面的代码中没有任何内容):

<Window x:Class="SimpleApplication.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Simple Application"
        AutomationProperties.AutomationId="Simple Application"
        Height="350" Width="525">
    <Grid>
        <Button AutomationProperties.AutomationId="button" Height="50" Width="100">Click Me</Button>
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

这是UIAutomation测试程序:

class Program
{
    static void Main(string[] args)
    {
        string appPath = @"..\..\..\SimpleApplication\bin\Debug\SimpleApplication.exe";
        string winAutoId = "Simple Application";
        string buttonAutoId = "button";

        using (Process process = Process.Start(new ProcessStartInfo(appPath)))
        {
            Thread.Sleep(TimeSpan.FromSeconds(1));

            AutomationElement winElement = AutomationElement.RootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.AutomationIdProperty, winAutoId));

            for (int i = 0; i < 1001; i++)
            {
                AutomationElement buttonElement = winElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, buttonAutoId));

                InvokePattern invokePattern = (InvokePattern)buttonElement.GetCurrentPattern(InvokePattern.Pattern);
                invokePattern.Invoke(); …
Run Code Online (Sandbox Code Playgroud)

c# wpf memory-leaks ui-automation

9
推荐指数
1
解决办法
1712
查看次数

如何在WebDriverJS中等待元素可点击?

有人知道如何在WebDriverJS中等待WebElement可点击吗?我已经知道如何等待元素"可见",但我需要它是"可点击的"..类似于Python绑定中可预期的条件.我无法在Webdriver Js API中找到类似的东西.

javascript selenium ui-automation selenium-webdriver

9
推荐指数
1
解决办法
1万
查看次数

Android APK与Espresso的自动化

我试图自动化我的Android应用程序的一些UI(我没有源代码所以我使用的是APK文件).

我已经阅读了这里提供的教程以及Google 提供的一些教程,但所有教程都需要源代码.

如果有人知道如何在没有源代码的情况下使用Espresso自动化UI,请提供帮助.

我使用IntelliJ作为IDE和app android 5.0.2版.

automation android ui-automation android-espresso

9
推荐指数
2
解决办法
4808
查看次数

Uispy Return的价值为"?"

我使用UISpy来检测outlook TO Address Field但是uispy将值返回为"?"

检查一下

如果它是普通文本,那么Uispy会正确检测到它显示的是To Address.问题是当我们在To address字段中输入任何电子邮件地址时,它转换为超链接我们如何使用Ui间谍获取地址.

.net ui-automation inspect ui-spy

9
推荐指数
1
解决办法
187
查看次数

WPF UIAutomation让孩子控制用户控制

我是NordVPN的用户并且没有任何问题地使用它.现在,对于某些要求,我需要设置一些属性,如协议(复选框)和单击其他应用程序中的按钮.

但该应用程序的该区域看起来像一个自定义控件,UIAutomation无法向下钻取.

该自定义控件中的元素没有任何自动化ID.

因此,我需要知道如何使用UIAutomation和White Framework遍历wpf应用程序中的用户控件,例如应用程序窗口的其他部分.

到目前为止我尝试过的是

  1. 使用TreeWalker(无法读取所有元素)

  2. 并尝试从其位置AutomationElement.FromPoint()获取元素,但它再次提供了我无法遍历的整个自定义控件(从其边界确定).

关于如何从UIAutomation钻取自定义控件的任何建议.

在此输入图像描述

对于记录,snoop可以读取元素,但VisualUIAVerify.exe不是.

c# wpf ui-automation

9
推荐指数
1
解决办法
762
查看次数

在iOS中模拟方向更改以进行测试

我想测试我的应用程序处理方向更改(纵向/横向)的能力.我目前正在使用KIF,据我所知,它无法做到这一点.有没有办法以编程方式为iOS模拟器模拟旋转事件?

我不在乎它是否是一些未记录的私有API或黑客,因为这只会在测试期间运行,并且不会成为生产版本的一部分.

testing ui-automation ios kif-framework ios-ui-automation

8
推荐指数
1
解决办法
3283
查看次数

Selenium Webdriver测试期间Firefox的多个实例无法正确处理焦点.

我注意到,在网格上并行运行多个selenium firefox测试时焦点事件处理无法正常工作.我已经确认,当我的每个测试单独运行并且考虑到操作系统的重点时,测试会在100%的时间内通过.我还在Chrome网格上并行运行测试,但没有看到问题.

我在google groups上找到了以下主题,建议在xvfb的单独实例中启动每个浏览器可能是一个可行的解决方案. https://groups.google.com/forum/?fromgroups#!topic/selenium-developers/1cAmsYCp2ho%5B1-25%5D

测试的部分失败是由于项目中使用的jquery日期选择器.日期选择器在焦点事件上启动,并且由于有多个selenium测试同时执行webdriver测试执行.click()命令,但焦点不会保持足够长的时间以显示日期选择器小部件.

.focus(function(){$ input.trigger("focus");});

我的问题是,如果有人之前已经看过这个并通过一些firefox配置文件设置解决了它.我已经尝试加载以下对该问题没有影响的属性.

profile.setAlwaysLoadNoFocusLib(true);
Run Code Online (Sandbox Code Playgroud)

测试失败的方式与之前在远程驱动程序Firefox配置文件中启用并加载该属性的方式相同.

我需要一种方法确保在100%的时间内触发焦点事件或解决多个firefox浏览器竞争焦点的问题.考虑到Chrome没有显示这些问题,我想知道它是否也可能被认为是Firefox中的一个错误.

谢谢!

firefox selenium webdriver ui-automation selenium-webdriver

8
推荐指数
1
解决办法
3631
查看次数

如何用Android uiautomator填写密码EditText?

uiautomator可以选择密码EditText吗?通过他们的android:hint属性查找其他EditText视图没有问题,但是uiautomatorviewer将所有密码字段显示为NAF.我尝试设置密码字段内容描述,但也不起作用.

如果不可能,如何设置测试人员手动输入密码的超时?

android ui-automation android-testing android-uiautomator

8
推荐指数
1
解决办法
7819
查看次数