Error selecting menu items on Windows 7

Aug 9, 2011 at 3:31 PM
Hello!

I recently tried to get our test framework running on a Windows 7 environment. I wasn't able to select menu items anymore ...
I am using the following code for invoking a click-event on a menu item:

...
    // Hardcoded path for testing purposes
    aCompletePathToTheMenu = "?,Info..."
    String[] menuElements = aCompletePathToTheMenu.Split(',');
    SearchCriteria[] menuPath = new SearchCriteria[menuElements.Length];
    for (int i = 0; i < menuElements.Length; i++)
    {
        menuPath[i] = SearchCriteria.ByText(menuElements[i]);
    }
    // Panel containing the main menu
    Panel xtpBar = GetItem<Panel>(aMenuId, _selectedWindow);
    // Open the menu item
    MenuBar menuBar = xtpBar.MenuBar;
    Menu level2Menu = level2Menu = menuBar.MenuItemBy(menuPath);
    if (level2Menu == null)
    {
        WarnLogger("Could not find menu item with path " + aCompletePathToTheMenu + "!");
        return false;
    }
    // Invoking click on the item
    level2Menu.Click();
...

Using RunnerW to debug the code I found that the following exception was thrown while calling MenuItemBy() on menuBar:

[ERROR] Error when invoking MenuItemBy, on MenuBar with parameters: White.Core.UIItems.Finders.SearchCriteria[]

Exception:
[WARN ] Error invoking MenuBar.MenuItemBy
[WARN ]    at Bricks.RuntimeFramework.ReflectedObject.Invoke(MethodInfo methodInfo, Object[] arguments) in D:\projects\bricks-toolkit\Bricks.RuntimeFramework\ReflectedObject.cs:Zeile 71.
   bei Bricks.DynamicProxy.DynamicProxyInterceptors.Process(IInvocation invocation, InterceptContext interceptedContext) in D:\projects\bricks-toolkit\Bricks\DynamicProxy\DynamicProxyInterceptors.cs:Zeile 20.
   bei White.Core.Interceptors.CoreInterceptor.Intercept(IInvocation invocation) in c:\Projects\git\white\Components\Core\Source\Interceptors\CoreInterceptor.cs:Zeile 32.
   bei Castle.DynamicProxy.AbstractInvocation.Proceed()
   bei Castle.Proxies.MenuBarProxy.MenuItemBy(SearchCriteria[] path)
   bei GUITest.FitnesseConnector.ClickItemOnMenu(String aCompletePathToTheMenu, String aMenuId) in C:\AccuRev\preiml.ingo\Tornado\Tornado_Work8\Tests\UITests\FitnesseConnector\MouseConnector.cs:Zeile 427.

Inner Exception:
[WARN ] Could not find Menu Name=Info...
[WARN ]    bei White.Core.UIItems.MenuItems.Menus.Find(SearchCriteria[] path) in c:\Projects\git\white\Components\Core\Source\UIItems\MenuItems\Menus.cs:Zeile 71.
   bei White.Core.UIItems.WindowStripControls.MenuBar.MenuItemBy(SearchCriteria[] path) in c:\Projects\git\white\Components\Core\Source\UIItems\WindowStripControls\MenuBar.cs:Zeile 25.

I tried to the 64 bit version and the 32 bit version (compiled from source) of 0.2.1 as well as 0.2.0 with the same behaviour ...
On Windows XP it is working like a charm with all versions ...

Any ideas or suggestions? Could it be a problem with the menu bar, since we are using the menu class of XTreme ToolkitPro with a rather old version?

Cheers
Aug 11, 2011 at 6:33 AM

Have you looked at these discussions? http://white.codeplex.com/discussions/58104 , http://white.codeplex.com/discussions/34292

Aug 11, 2011 at 1:22 PM

Thanks!

I'll have a look a them as soon as possible.

Cheers

Oct 12, 2011 at 10:41 AM
Edited Oct 12, 2011 at 10:43 AM

Hello,

no luck with the above mentioned discussions ... I am not starting my tests via NUnit and have already the latest version of the UIAuotmation-Library installed :(

I tried to run the white testcases and got the following failures. Failure 6 seems to be the related to my menu issues:

1) White.Core.UITests.InputDevices.KeyboardTest.ShouldSetTheValueOfATextBox :   String lengths are both 9. Strings differ at index 1.
  Expected: "`[];',./-"
  But was:  "`89;',./-"
  ------------^
   bei White.Core.UITests.InputDevices.KeyboardTest.EnterAndAssertValueOfTextEntered(String stringToType) in d:\Git\white\Components\Core\Tests\UITests\InputDevices\KeyboardTest.cs:Zeile 81.
   bei White.Core.UITests.InputDevices.KeyboardTest.ShouldSetTheValueOfATextBox() in d:\Git\white\Components\Core\Tests\UITests\InputDevices\KeyboardTest.cs:Zeile 40.
2) White.Core.UITests.UIA.AutomationElementXTest.TestToString :   Expected string length 67 but was 73. Strings differ at index 44.
  Expected: "...:buton, Name:Buton, ControlType:button, FrameworkId:WPF"
  But was:  "...:buton, Name:Buton, ControlType:Schaltfläche, FrameworkId:WPF"
  ----------------------------------------------^
   bei White.Core.UITests.UIA.AutomationElementXTest.TestToString() in d:\Git\white\Components\Core\Tests\UITests\UIA\AutomationElementXTest.cs:Zeile 16.
3) White.Core.UITests.UIItems.ListBoxItems.WPFDataBoundComboBoxTest.SelectItemInEditableComboBox :   Expected string length 8 but was 0. Strings differ at index 0.
  Expected: "whatever"
  But was:  <string.Empty>
  -----------^
   bei White.Core.UITests.UIItems.ListBoxItems.WPFDataBoundComboBoxTest.SelectItemInEditableComboBox() in d:\Git\white\Components\Core\Tests\UITests\UIItems\ListBoxItems\WPFDataBoundComboBoxTest.cs:Zeile 45.
4) White.Core.UITests.UIItems.MenuItems.MenuTest.Click :   Expected string length 16 but was 12. Strings differ at index 0.
  Expected: "Click Me Clicked"
  But was:  "Text changed"
  -----------^
   bei White.Core.UITests.Testing.ControlsActionTest.AssertResultLabelText(String text) in d:\Git\white\Components\Core\Tests\UITests\Testing\ControlsActionTest.cs:Zeile 55.
   bei White.Core.UITests.UIItems.MenuItems.MenuTest.Click() in d:\Git\white\Components\Core\Tests\UITests\UIItems\MenuItems\MenuTest.cs:Zeile 40.
5) White.Core.UITests.UIItems.MenuItems.MenuTest.RaiseClickEvent :   Expected string length 16 but was 12. Strings differ at index 0.
  Expected: "Click Me Clicked"
  But was:  "Text changed"
  -----------^
   bei White.Core.UITests.Testing.ControlsActionTest.AssertResultLabelText(String text) in d:\Git\white\Components\Core\Tests\UITests\Testing\ControlsActionTest.cs:Zeile 55.
   bei White.Core.UITests.UIItems.MenuItems.MenuTest.RaiseClickEvent() in d:\Git\white\Components\Core\Tests\UITests\UIItems\MenuItems\MenuTest.cs:Zeile 48.

6) White.Core.UITests.UIItems.MenuItems.PopUpMenuTest.ClickOnNestedMenu : White.Core.Factory.UIItemSearchException : Could not find Menu Name=Level1
   bei White.Core.UIItems.MenuItems.Menus.Find(SearchCriteria[] path) in d:\Git\white\Components\Core\Source\UIItems\MenuItems\Menus.cs:Zeile 70.
   bei White.Core.UIItems.MenuItems.Menus.Find(String[] path) in d:\Git\white\Components\Core\Source\UIItems\MenuItems\Menus.cs:Zeile 48.
   bei White.Core.UIItems.MenuItems.PopUpMenu.Item(String[] text) in d:\Git\white\Components\Core\Source\UIItems\MenuItems\PopUpMenu.cs:Zeile 25.
   bei White.Core.UIItems.WindowItems.Window.PopupMenu(String[] path) in d:\Git\white\Components\Core\Source\UIItems\WindowItems\Window.cs:Zeile 374.
   bei White.Core.UITests.UIItems.MenuItems.PopUpMenuTest.ClickOnNestedMenu() in d:\Git\white\Components\Core\Tests\UITests\UIItems\MenuItems\PopUpMenuTest.cs:Zeile 33.

7) White.Core.UITests.UIItems.MenuItems.PopUpMenuTest.ClickOnPopupMenu :   Expected string length 14 but was 12. Strings differ at index 0.
  Expected: "All good films"
  But was:  "Text changed"
  -----------^
   bei White.Core.UITests.Testing.ControlsActionTest.AssertResultLabelText(String text) in d:\Git\white\Components\Core\Tests\UITests\Testing\ControlsActionTest.cs:Zeile 55.
   bei White.Core.UITests.UIItems.MenuItems.PopUpMenuTest.ClickOnPopupMenu() in d:\Git\white\Components\Core\Tests\UITests\UIItems\MenuItems\PopUpMenuTest.cs:Zeile 26.
8) White.Core.UITests.UIItems.TreeItems.TreeNodeTest.DoubleClick :   Expected: not False
  But was:  False
   bei White.Core.UITests.UIItems.TreeItems.TreeNodeTest.DoubleClick() in d:\Git\white\Components\Core\Tests\UITests\UIItems\TreeItems\TreeNodeTest.cs:Zeile 64.
9) White.Core.UITests.UIItems.TreeItems.TreeNodeTest.UnSelect : System.NullReferenceException : Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei White.Core.UITests.UIItems.TreeItems.TreeNodeTest.UnSelect() in d:\Git\white\Components\Core\Tests\UITests\UIItems\TreeItems\TreeNodeTest.cs:Zeile 74.
10) White.Core.UITests.UIItems.TreeItems.TreeTest.SelectNode : System.NullReferenceException : Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei White.Core.UITests.UIItems.TreeItems.TreeTest.SelectNode() in d:\Git\white\Components\Core\Tests\UITests\UIItems\TreeItems\TreeTest.cs:Zeile 61.
11) White.Core.UITests.UIItems.TreeItems.TreeTest.SelectNodeWhichNeedsScrolling : System.NullReferenceException : Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei White.Core.UITests.UIItems.TreeItems.TreeTest.SelectNodeWhichNeedsScrolling() in d:\Git\white\Components\Core\Tests\UITests\UIItems\TreeItems\TreeTest.cs:Zeile 47.

I using white on a German Windows 7. Might there possibly be problems with that?

Ingo