mmarquee.automation.controls.MenuItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ui-automation Show documentation
Show all versions of ui-automation Show documentation
A Java library that wraps the MS UIAutomation library.
/*
* Copyright 2016-17 [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mmarquee.automation.controls;
import mmarquee.automation.AutomationException;
import mmarquee.automation.ControlType;
import mmarquee.automation.Element;
import mmarquee.automation.ElementNotFoundException;
import mmarquee.automation.pattern.PatternNotFoundException;
import mmarquee.uiautomation.TreeScope;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
/**
* Wrapper for the MenuItem element.
* @author Mark Humphreys
* Date 10/02/2016.
*/
public class MenuItem
extends AutomationBase
implements ImplementsClick, ImplementsExpand {
/** The parent element. */
public Element mainMenuParentElement;
/** Name of the parent. */
public String parentMenuName;
/**
* Construct the MenuItem.
* @param builder The builder
*/
public MenuItem(final ElementBuilder builder){
super(builder);
}
/**
* The Control type.
*/
public static ControlType controlType = ControlType.MenuItem;
/**
* Invoke the click pattern for the menu item.
* @throws AutomationException Something has gone wrong
* @throws PatternNotFoundException Expected pattern not found
*/
public void click() throws AutomationException, PatternNotFoundException {
this.invoke();
}
/**
* Gets the list of items associated with this menu item.
* If the current item is known as member of an MainMenu,
* the request is automatically redirected to the correspondent
* Menu, when such a menu can be found
* (i.e. this item is expanded)
*
* @return List of menu items
* @throws AutomationException Something has gone wrong
*/
public List