我正在使用 System.Windows.Automation 从组框中的标签中获取一些 UI 控件文本值。我正在尝试使用 spy++ 来获取我正在寻找的控件名称。

AutomationElement Root = AutomationElement.RootElement;
AutomationElement MainForm = Root.FindFirst(TreeScope.Descendants,new PropertyCondition(AutomationElement.AutomationIdProperty,"control name im looking for"));
Run Code Online (Sandbox Code Playgroud)
什么值代表我要搜索的内容?例如,我会将其更改为... ...AutomationIdProperty,"Window 00031BB0"));
我不确定 spy++ 提供的所有信息实际上代表什么。
感谢您的任何帮助!
我正在尝试自动点击按钮以在加载html页面时启动功能.我已经尝试过document.getElementById('watchButton').click它似乎不起作用,按钮没有被点击.有什么建议?
<div class="content">
<div class="action-area ch30">
<button class="button dh" id="watchButton">Start Geolocation Watch</button>
<button class="button dh" id="refreshButton" >Refresh Geolocation</button>
</div>
Run Code Online (Sandbox Code Playgroud)
javascript:
run:function() {
var that = this;
document.getElementById("watchButton").addEventListener("click", function() {
that._handleWatch.apply(that, arguments);
}, false);
document.getElementById("refreshButton").addEventListener("click", function() {
that._handleRefresh.apply(that, arguments);
}, false);
},
Run Code Online (Sandbox Code Playgroud)
谢谢!
我想做 UI 自动化以在真正的 android 设备中打开一个 url。为此我想在我的linux系统上安装和运行appium,请指导我怎么做?还建议我使用eclipse在chrome浏览器中打开一个url吗?
System.Windows.Automation非常慢.
我执行:
element.FindAll(TreeScope.Children, Condition.TrueCondition);
Run Code Online (Sandbox Code Playgroud)
在非常快的计算机上获得仅30个子元素可能需要1000ms.
我甚至看到它在QT应用程序中获取Tree的子元素时永远挂起.
这是一个已知的问题吗?谷歌搜索后我找不到任何有用的答案.
我正在使用 RIDE robotsframework,我想在应用程序崩溃时处理异常,我关闭它然后打开它的新实例。
*** Settings ***
Library SikuliLibrary
*** Variables ***
${openProject} sikuli_captured\\Emna\\openProject.png
${DataBaseSTProject} sikuli_captured\\Emna\\DataBaseSTProject.png
${testSession} sikuli_captured\\Emna\\testSession.png
${menu} sikuli_captured\\menu.png
${fileName} sikuli_captured\\Emna\\fileName.png
${save} sikuli_captured\\Emna\\save.png
*** Test Cases ***
createNewProject
Click ${menu}
Click ${testSession}
Input Text ${fileName} FirstProjecT3
Click ${save}
openTestProject
Click ${openProject}
Double Click ${DataBaseSTProject}
Run Code Online (Sandbox Code Playgroud)
任何建议将不胜感激。
感谢您的帮助 :)
user-interface automated-tests ui-automation sikuli robotframework
我需要从forMATLAB中的循环运行C ++可执行文件。我为此编写了以下代码,
EqNumbers = [17 18 20 21 22 23];
for i = 1:length(EqNumbers)
EqNumber = EqNumbers(i);
WriteRunE_File(EqNumber);
filename=['RunE_1.tcl'];
system(['OpenSees.exe<',filename]);
end
Run Code Online (Sandbox Code Playgroud)
在大多数情况下,它运行良好,但是有时会出现调试错误(如下图所示)。它提示我采取措施,如果我按“中止”按钮,则程序将继续进行下一次迭代。我只想使此过程自动化,对我来说,每次都无法手动按“中止”按钮,因为该程序中有1000多次迭代。
我尝试使用try-catch end以下方法,但没有达到目的。
EqNumbers = [17 18 20 21 22 23];
for i = 1:length(EqNumbers)
try
% Code to be executed goes here.
EqNumber = EqNumbers(i);
WriteRunE_File(EqNumber);
filename=['RunE_1.tcl'];
system(['OpenSees.exe<',filename]);
catch
disp('An error occurred in Equke');
disp('Execution will continue.');
end
end
Run Code Online (Sandbox Code Playgroud)
我正在寻找一种方法来绕过错误消息或自动按“中止”按钮。这样程序将自动移至下一个迭代。
注意:
我无权访问C ++源代码(我所拥有的都是可执行文件),因此无法更新的值citaR。这就是为什么我要在MATLAB中寻找解决方法。
我想这真的很长很短,我怎么能设法通过Xcode UIAutomation将我的应用程序从后台状态带到前台状态?
任何人的想法......?
我有这个代码可以通过编程方式按下按钮,但我希望有一个版本适用于ToggleButton.
public static void PushButton(Button b)
{
ButtonAutomationPeer peer = new ButtonAutomationPeer(b);
System.Windows.Automation.Provider.IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as System.Windows.Automation.Provider.IInvokeProvider;
invokeProv.Invoke();
}
Run Code Online (Sandbox Code Playgroud)
所以我尝试了ToggleButtonAutomationPeer ......
public static void PushButton(ToggleButton b)
{
ToggleButtonAutomationPeer peer = new ToggleButtonAutomationPeer(b);
System.Windows.Automation.Provider.IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as System.Windows.Automation.Provider.IInvokeProvider;
//But invokeProv is null. Peer is ok.
}
Run Code Online (Sandbox Code Playgroud) 我想更改外部应用程序的编辑控件的文本.该应用程序是用Delphi编写的.它有几种形式.我开始用Python库pywinauto+ sendkeys测试第一种形式TLoginForm.它完美地运作.这是伪代码:
helper = pywinauto.application.Application()
hwnd = pywinauto.findwindows.find_windows(class_name='TLoginForm')[0]
window = helper.window_(handle=hwnd)
ctrl = window[2] # the second control is the edit control I want to access
ctrl.ClickInput() # focus the control
ctrl.SetEditText('Hello world') # text can be changed expectedly
Run Code Online (Sandbox Code Playgroud)
作为第二步,我想为自动化工具制作UI.但由于缺乏Python UI知识并考虑到在Python中分发二进制文件的复杂性,我想做Delphi.但奇怪的是我无法使用Windows apis在Delphi中读/写编辑控件.以下是一些尝试:
SetForegroundWindow(EditControlHandle); // Works, the application will be brought to front, the edit control will be focused
// Attempt 1: Nothing happens
SetFocus(AnotherEditControlHandle);
// Attempt 2: Nothing happens
SetWindowText(EditControlHandle, 'Hello world');
// Attempt 3: …Run Code Online (Sandbox Code Playgroud) 在执行此代码以使用appium python客户端自动执行android应用程序时,
el = self.driver.find_element_by_accessibility_id('Hello')
action = TouchAction(self.driver)
action.tap(el).perform()
Run Code Online (Sandbox Code Playgroud)
其给出的错误信息为“ NameError:未定义全局名称'TouchAction'”。我想念什么?