TestStack / White

DEPRECATED - no longer actively maintained
Other
1.02k stars 487 forks source link

Obtaining Word\Excel MenuBar #95

Closed ant-howell closed 11 years ago

ant-howell commented 11 years ago

Hi

Having a little trouble obtaining the Excel or Word MenuBar control.

Using VisualUIA the location of the MenuBar is deep through a few "pane" controls which might be the issue. The "Options" (from File->Options) menu for Excel 2010 is a "NavBarMenu" control entitled "File" 4 levels deep.

MenuBar menuBar = mainWin.GetMenuBar(SearchCriteria.ByText("File"))

Does not detect it and I'm wondering if the depth of the search is insufficient. The older White library had a global configuration file which could be set to X levels search depth. Is there a equivalent for TestStack.White?

Or.....

an override search level whilst searching for Menu Items?

Any help will be appreciated.

Ant

Additional

Setting CoreAppXmlConfiguration.Instance.MaxElementSearchDepth = 10 does not make any difference in this instance.

ant-howell commented 11 years ago

Hi

Stand down, I've managed to sort it. For future reference, for Excel 2010 the File tab needs to be activated prior to accessing the Menu items. I sort of kicked myself with this as its common knowledge. Anyway, once that is activated, the Options (and others) menu can be accessed.

White.Core.UIItems.Button fileButton = mainWin.Get(SearchCriteria.ByText("File Tab")); fileButton.Click();

White.Core.UIItems.MenuItems.Menu menuItem = mainWin.Get(SearchCriteria.ByText("Options")); menuItem.Click();

Ant

YossiCohen commented 6 years ago

Hi, Sorry for the somehow nonrelated question, can you select cells or activate addins with White?