MenuBar issue

Jan 13, 2010 at 2:20 AM

Hi All,

I am automating Notepad as an example.

Currently, I can fire up Notepad. I want to click "File" then click "open". I am stuck on how to implement this.

I have tried the following code from documentation.

MenuBar menuBar = window.MenuBar;
Menu level2Menu =  menuBar.MenuItem("Root", "Level1", "Level2");

However, it throws an error. When I put the breakpoint in the first line, I found it's failed.

Error msg is:

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.

 

Can anyone help me please? Thanks in advance.

 

Cheers,

Coordinator
Jan 17, 2010 at 7:51 AM

can you send the test code that you are using the complete stack trace with message.

Jan 17, 2010 at 10:11 AM

Quick and dirty (and probably not advisable):

 

Window window = app.GetWindows()[0];

window.Get<White.Core.UIItems.MenuItems.Menu>(SearchCriteria.ByText("File")).Click();

window.Get<White.Core.UIItems.MenuItems.Menu>(SearchCriteria.ByText("Open...")).Click();

 

Jan 19, 2010 at 1:07 AM
Keth wrote:

Quick and dirty (and probably not advisable):

 

Window window = app.GetWindows()[0];

window.Get<White.Core.UIItems.MenuItems.Menu>(SearchCriteria.ByText("File")).Click();

window.Get<White.Core.UIItems.MenuItems.Menu>(SearchCriteria.ByText("Open...")).Click();

 

Thanks, it throws the following error with your second line of code

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.

 

I am try 

May 25, 2010 at 9:45 PM

Found some relevant information on this exception at http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/27c3bae8-41fe-4db4-8022-e27d333f714e

In short, the exception it throws is not really a problem and you set the debugger to ignore it.

repost of svb70's solution:

You can turn off the managed Debugging Assistant for the "NonComVisibleBaseClass" exception. In Visual Studio,
1. Navigate to Debug->Exceptions...

2. Expand "Managed Debugging Assistants"

3. Uncheck the NonComVisibleBaseClass Thrown option.

4. Click [Ok]