|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.team.fvt.tests.web.WebPageElement
com.ibm.team.fvt.tests.web.WebElementWrapper
com.ibm.team.fvt.tests.web.WebWindow
com.ibm.team.fvt.tests.web.WebMenu
public class WebMenu
Class to manage menus.
Menus can be considered like window as they are also opened by clicking on a web element, usually a menu item or drop-down button.
The open operation looks like a window one but have the peculiarity to check that items are loaded before returning.
Additionally, this generic level offers the following features:
clickItem(String)
: Click on item element found using the given label.clickItem(String, Class, String...)
: Open the given page by clicking
on the given menu item label.clickItem(String, By, Class, String...)
: Open the given page by
clicking on the link element found by using the given relative mechanism from
the given menu item element found by using the item label.getItemElement(String)
: Return the web element for the item
matching the given label.getItemElement(String, boolean)
: Return the web element for the item
matching the given label.getMenuOptions()
: Returns the list of Menu option elements within
this menu.Following actions are accessible or overridden in this page:
closeAction(boolean)
: The action to perform to close the menu.displayItemElement(String, WebBrowserElement)
: Display a non-visible
element from the menu.getCloseButton(boolean)
: Return the xpath of the button to close
the menu.getItemElement(String, int, boolean, boolean)
: Return the web
element for the item matching the given label.getItemLocator(String)
: Returns the locator for the given item.getLastItemElement()
: Get the last item element of the menu.waitForItemElement(String, boolean, int)
: Wait for the given item the given timeout.waitForLoadingEnd()
: Wait for the window content to be loaded.
Field Summary |
---|
Fields inherited from interface com.ibm.team.fvt.tests.web.WebConstants |
---|
DISABLED, ENABLED, FALSE, NAME, OK, TAG_NAME_H1, TITLE, TRUE |
Constructor Summary | |
---|---|
WebMenu(WebPage page)
|
|
WebMenu(WebPage page,
org.openqa.selenium.By findBy)
|
|
WebMenu(WebPage page,
org.openqa.selenium.By findBy,
java.lang.String frame)
|
|
WebMenu(WebPage page,
WebBrowserElement parentElement)
|
Method Summary | ||
---|---|---|
void |
clickItem(java.lang.String item)
Click on item element found using the given label. |
|
|
clickItem(java.lang.String itemLabel,
org.openqa.selenium.By linkBy,
java.lang.Class<P> pageClass,
java.lang.String... data)
Open the given page by clicking on the link element found by using the given relative xpath from the given menu item element found by using the item label. |
|
|
clickItem(java.lang.String item,
org.openqa.selenium.By windowBy,
java.lang.Class<W> windowClass)
Open the given menu by clicking on the given menu item. |
|
|
clickItem(java.lang.String itemLabel,
java.lang.Class<P> pageClass,
java.lang.String... data)
Open the given page by clicking on the given menu item label. |
|
|
clickItem(java.lang.String item,
java.lang.Class<W> windowClass)
Open the given window by clicking on the given menu item. |
|
WebBrowserElement |
getItemElement(java.lang.String itemLabel)
Return the web element for the item matching the given label. |
|
WebBrowserElement |
getItemElement(java.lang.String itemLabel,
boolean displayed)
Return the web element for the item matching the given label. |
|
java.util.List<WebBrowserElement> |
getMenuOptions()
Returns the list of Menu option elements within this menu. |
|
java.util.List<java.lang.String> |
getStringMenuOptions(boolean shouldClose)
Returns the list of Menu option strings within this popup menu. |
|
WebBrowserElement |
open(WebBrowserElement webElement)
Open the window by clicking on the given web element. |
Methods inherited from class com.ibm.team.fvt.tests.web.WebWindow |
---|
cancel, close |
Methods inherited from class com.ibm.team.fvt.tests.web.WebElementWrapper |
---|
getText |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WebMenu(WebPage page)
public WebMenu(WebPage page, org.openqa.selenium.By findBy)
public WebMenu(WebPage page, org.openqa.selenium.By findBy, java.lang.String frame)
public WebMenu(WebPage page, WebBrowserElement parentElement)
Method Detail |
---|
public void clickItem(java.lang.String item)
item
- The item text to click onpublic <P extends WebPage> P clickItem(java.lang.String itemLabel, org.openqa.selenium.By linkBy, java.lang.Class<P> pageClass, java.lang.String... data)
itemLabel
- The item label to click onlinkBy
- The relative path from the found item web element to the
web element on which it's necessary to click to have the real action.pageClass
- The class of the page to be opened by the item clickdata
- Additional data to store in the opened page
public <W extends WebWindow> W clickItem(java.lang.String item, org.openqa.selenium.By windowBy, java.lang.Class<W> windowClass)
item
- The item label to click onwindowBy
- The mechanism to find the window when openedwindowClass
- The class of the window which will be opened when
clicking on the item
public <P extends WebPage> P clickItem(java.lang.String itemLabel, java.lang.Class<P> pageClass, java.lang.String... data)
itemLabel
- The item label to click onpageClass
- The class of the page to be opened by the item clickdata
- Additional data to store in the opened page
public <W extends WebWindow> W clickItem(java.lang.String item, java.lang.Class<W> windowClass)
item
- The item label to click onwindowClass
- The class of the window which will be opened when
clicking on the item
public WebBrowserElement getItemElement(java.lang.String itemLabel) throws WaitElementTimeoutError
Note that the returned element has to be visible otherwise this method will
raise a WaitElementTimeoutError
.
If the element is not found after the timeout has expired, then a page refresh
is done and the menu opened again to make another try. If the element is still
not found after this workaround, then a WaitElementTimeoutError
is
raised.
itemLabel
- The label of the item to click on
WebBrowserElement
WaitElementTimeoutError
- If the item element is still not found after
having try to workaroundpublic WebBrowserElement getItemElement(java.lang.String itemLabel, boolean displayed) throws WaitElementTimeoutError
If the element is not found after the timeout has expired, then a page refresh
is done and the menu opened again to make another try. If the element is still
not found after this workaround, then a WaitElementTimeoutError
is
raised.
itemLabel
- The label of the item to click ondisplayed
- Tells whether the return item has to be displayed or can be
hidden.
WebBrowserElement
WaitElementTimeoutError
- If the item element is still not found after
having try to workaroundpublic java.util.List<WebBrowserElement> getMenuOptions()
Menu options are identified as tr
tag name web element having
ids starting with 'jazz_ui_menu_MenuItem'
or 'dijit_MenuItem'
.
WebElement
s representing the menu itemspublic java.util.List<java.lang.String> getStringMenuOptions(boolean shouldClose)
Menu options are identified as tr
tag name web element having
ids starting with 'jazz_ui_menu_MenuItem'
or 'dijit_MenuItem'
.
shouldClose
- Tells whether to close the menu after providing the list
String
s representing the menu itemspublic WebBrowserElement open(WebBrowserElement webElement)
Open the menu found with the given search mechanism and return the corresponding web element.
Note that the menu is opened by clicking on a link element found using the given search mechanism.
When possible, it also waits for all items to be loaded before returning.
open
in class WebWindow
webElement
- The element on which to perform the open action.
WebWindow
subclass.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |