问题描述
我正在尝试使用 C# 在 SAP GUI 中实现自动化,当子类型为树或工具栏时,我能够在 GUIShell 中获取按钮/节点的 ID。 我想要的是如何获取按钮/节点或 GUIShell 中的任何其他元素的 x/y 坐标和高度/宽度。 我尝试使用 id 获取组件,但它抛出异常。
GuiComponent compFound = session.FindById(elementId);
GuiToolbarControl tb = (GuiToolbarControl)compFound;
String buttonID = tb.GetButtonId(i); //getting button id based on index. This returns correct id
//trying to get the Button Component based on id,but every approach throws exception
Approach 1: GuiComponent testButton = tb.FindById(".../" + buttonID);
Approach 2: GuiComponent testButton = tb.FindById(buttonID);
Approach 3: GuiComponent testButton = tb.FindById(elementId+"/"+buttonID);
Approach 4: GuiComponent testButton = session.FindById(elementId+"/"+buttonID); //tried on session
我们还有什么方法可以在鼠标下获取组件(在 GuiShell 中)。我可以使用下面的 API 为 GuiShell 之外的元素获取它
GuiCollection x = session.FindByPosition(xpos,ypos,false);
提前致谢!!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)