简体   繁体   English

UI 自动化无法控制嵌入式浏览器

[英]UI Automation cannot control embedded browser

This is about testing a desktop application.这是关于测试桌面应用程序。 I have been trying to click a hyperlink on an embedded browser of a Windows form.我一直在尝试单击 Windows 表单的嵌入式浏览器上的超链接。 I could move the mouse anywhere if the component (buttons, or whatever) is part of the form, but elements inside the browser, i can't seem to control at all....sigh.....yes, I could move the mouse if I use the screen coordinates but I plan to control the embedded browser using Watin, etc..without opening a new IE....Using Microsoft's UISpy tool (when I hover the cursor to the link..it shows a Pane ControlType)....the hyperlink is part of the tree structure but only the name property is available...some of the parent's properties are blank....如果组件(按钮或其他)是表单的一部分,我可以将鼠标移动到任何地方,但是浏览器中的元素,我似乎根本无法控制......叹息......是的,我可以如果我使用屏幕坐标移动鼠标,但我打算使用 Watin 等控制嵌入式浏览器。不打开新的 IE ......使用微软的 UISpy 工具(当我 hover cursor 到链接时。它显示了一个窗格 ControlType)....超链接是树结构的一部分,但只有 name 属性可用...一些父级的属性是空白的...。

I tried extending the example from the link below我尝试从下面的链接扩展示例

http://archive.msdn.microsoft.com/uiautomation http://archive.msdn.microsoft.com/uiautomation

and this is where i'm stuck (I have tried FindChildByName and other related methods too...sigh..no luck):这就是我被卡住的地方(我也尝试过 FindChildByName 和其他相关方法......叹息......没有运气):

var commontab=AutomationElement.RootElement.FindFirstChildHavingDescendantWhere(new[] { new PropertyCondition(AutomationElement.NameProperty, "Search")});
Mouse.MoveTo(menutab.GetClickablePoint().ToDrawingPoint()); 
Mouse.Click(MouseButton.Left);


Somehow the mouse cannot find the 'Search' hyperlink...sigh...please guys...any ideas??不知何故,鼠标找不到“搜索”超链接......叹息......请大家......有什么想法吗?

Would it not be a simpler idea to split this into 2 testing strategies?将其拆分为 2 个测试策略不是更简单的想法吗? The first is testing the desktop UI, buttons etc. as you are.首先是测试桌面用户界面、按钮等。 The second is to test the html which is to be placed within the embedded browser frame.第二个是测试要放置在嵌入式浏览器框架内的 html。

You shouldn't be testing that the embedded browser works, that's Microsofts job.你不应该测试嵌入式浏览器是否工作,这是微软的工作。 The only testing that you may want to do on the frame is to ensure that it's content is loaded, that the call is to the correct (internal) url etc.可能想要对框架进行的唯一测试是确保其内容已加载,调用正确的(内部)url 等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UI自动化和功能区控件 - UI Automation and Ribbon control UI自动化cmdlet找不到控件 - UI-Automation cmdlet not finding the control WPF UI自动化-在单击TabControl的区域之前,控制树不会出现问题 - WPF UI Automation - Control Tree not poluated till region is clicked for a TabControl 如何使用 UI 自动化从 ListView 或类似控件中获取文本? - How to get text out of a ListView or similar control using UI Automation? UI自动化控制桌面应用程序并单击菜单条 - UI Automation Control Desktop Application and Click on Menu Strip 在WP7浏览器控件中显示嵌入式视频-更新 - Displaying embedded video in WP7 browser control - Updated 从嵌入在C#中的浏览器控件获取HTML源代码 - Get HTML source code from browser control embedded in C# 无法使用CefSharp嵌入式Chromium浏览器控件加载网页? - Unable to load web page using the CefSharp embedded Chromium browser control? 启动浏览器时,如何在已编码的ui c#自动化中设置和获取浏览器语言以及区域设置? - How to set and get browser language and regional setting in coded ui c# automation, while launching browser? Web浏览器控件无法创建cookie? - Web browser control cannot create cookies?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM