Click here to Skip to main content

TRicK asked:

Open original thread
Hi,
 
I'm learning the White UI automation framework. Windows 7 32-bit SP1, White v 0.2.1. The victim is well known notepad.exe..
The scenario is very simple:
1. find notepad's main window
2. find a multi-line edit box
===>
I cannot perform this action using White automation framework for some reasons..
 
Please look at the code snipped below..
 
string exeName = "notepad";
Process[] processes = Process.GetProcessesByName(exeName);
Application app = processes.Length == 0 ? Application.Launch(exeName) : Application.Attach(exeName);
Window window = app.GetWindow(SearchCriteria.ByNativeProperty(AutomationElement.ClassNameProperty, "Notepad"), InitializeOption.NoCache);
window.Focus();
Thread.Sleep(1000); // just in case..
// Exception below is thrown!
var edit = window.Get<MultilineTextBox>(SearchCriteria.ByAutomationId("15"));
/*
A QueryInterface call was made requesting the class interface of COM visible managed class 'MS.Internal.AutomationProxies.WindowsEditBox'. However since this class derives from non COM visible class 'MS.Internal.AutomationProxies.ProxyHwnd', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.
*/
 
// No exception, but edit is NULL!
var edit = window.Get<TextBox>(SearchCriteria.ByAutomationId("15"));
// Exception below is thrown!
AutomationElement edit = window.GetElement(SearchCriteria.ByAutomationId("15"));
/* A QueryInterface call was made requesting the class interface of COM visible managed class 'MS.Internal.AutomationProxies.WindowsEditBox'. However since this class derives from non COM visible class 'MS.Internal.AutomationProxies.ProxyHwnd', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.
*/
 
// OK.....
AutomationElement aeEdit= window.AutomationElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "15"));
 
Any ideas? I would like to use White, I have even implemented rather difficult scenario on MFC application, and almost decided to use White, but after that.. get stuck on NOTEPAD.EXE..
 

 
Thanks,
Aleksey
Tags: UI, Automation, White

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100