white學習6(官方網站的內容)

menu bar is part of a window, while a popup menu can be shown on a window. Other than this difference, the two types of menus behave in a consistent way, as far as a user is concerned. Both of them are composed of click-able menu items.

First, let's look at how menu bar items and popup menu items can be retrieved so White can click on them.

//POP UP MENU

window.Get<ListBox>("listBoxWithPopup").RightClick();

PopupMenu popupMenu = window.Popup;

Menu level2Menu = popupMenu.Item("Root""Level1""Level2");

level2Menu = popupMenu.ItemBy(SearchCriteria.ByText("Root"), SearchCriteria.ByText("Level1"), SearchCriteria.ByText("Level2")); //can use any other search criteria as well.

 

//MENU BAR

MenuBar menuBar = window.MenuBar;

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

level2Menu = menuBar.MenuItemBy(SearchCriteria.ByText("Root"), SearchCriteria.ByText("Level1"), SearchCriteria.ByText("Level2")); //can use any other search criteria as well.

 

level2Menu.Click();

 

"Root" is one of the menus in the first level, "Level1" is inside "Root" menu and "Level2" is inside "Level1". So on.
"Root", etc are text of the menu visible to user.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章