Package org.jenkinsci.test.acceptance.po
Class Control
java.lang.Object
org.jenkinsci.test.acceptance.po.CapybaraPortingLayerImpl
org.jenkinsci.test.acceptance.po.Control
- All Implemented Interfaces:
CapybaraPortingLayer
Wraps a specific form element in
PageAreaImpl to provide operations.
Control is like a WebElement, but with the following key differences:
Controlis late binding, and the underlyingWebElementis resolved only when an interaction with control happens. This allowsControls to be instantiated earlier (typically when aPageObjectsubtype is instantiated.)Controloffers richer methods to interact with a form element, making the right code easier to write.
See PageAreaImpl subtypes for typical usage.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jenkinsci.test.acceptance.po.CapybaraPortingLayerImpl
CapybaraPortingLayerImpl.Finder<R>, CapybaraPortingLayerImpl.Resolver -
Field Summary
Fields inherited from class org.jenkinsci.test.acceptance.po.CapybaraPortingLayerImpl
driver, injector, LABEL_TO_INPUT_XPATH, timeFields inherited from interface org.jenkinsci.test.acceptance.po.CapybaraPortingLayer
by -
Constructor Summary
ConstructorsConstructorDescriptionControl(com.google.inject.Injector injector, org.openqa.selenium.By selector) Control(PageAreaImpl parent, String... relativePaths) Control(PageObject parent, String... paths) Creates a control by giving their full path in the page -
Method Summary
Modifier and TypeMethodDescriptionvoidcheck()voidcheck(boolean state) voidvoidclick()sends a click on the underlying element.booleanexists()Determines whether an object is existing on the current pageget()Returns the value of the input field.org.openqa.selenium.WebElementresolve()voidvoidSelect an option.voidselectDropdownMenu(Class<?> type) Clicks a menu button, and selects the matching item from the drop down.voidselectDropdownMenu(String displayName) voidselectDropdownMenuAlt(Class<?> type) For alternative use when the 'yui-menu-button' doesn't exist.voidvoidvoidSets the value of the input field to the specified text.voidThe existingset(String)method has shortcomings regarding large strings because it utilizes the sendKeys mechanism to enter the string which takes a significant amount of time, i.e.text()voiduncheck()voidMethods inherited from class org.jenkinsci.test.acceptance.po.CapybaraPortingLayerImpl
all, blur, check, check, check, choose, clickButton, clickLink, confirmAlert, elasticSleep, executeScript, fillIn, find, findCaption, findCaption, findIfNotVisible, getCurrentUrl, getCurrentUrlWithFragment, getElement, getPageContent, getPageSource, getPageSource, getPath, handleAlert, isHiddenOrStale, isStale, last, lastIfNotVisible, newInstance, resource, runThenConfirmAlert, runThenConfirmAlert, runThenHandleAlert, runThenHandleAlert, runThenHandleDialog, runThenHandleInputDialog, runThenHandleUserPrompt, sleep, visit, waitFor, waitFor, waitFor, waitFor, waitFor, waitForCond, waitForCond
-
Constructor Details
-
Control
-
Control
Creates a control by giving their full path in the page -
Control
public Control(com.google.inject.Injector injector, org.openqa.selenium.By selector)
-
-
Method Details
-
resolve
public org.openqa.selenium.WebElement resolve() -
sendKeys
-
uncheck
public void uncheck() -
check
public void check() -
check
public void check(boolean state) -
click
public void click()sends a click on the underlying element. You should not use this on any page where the click will cause another page to be loaded as it will not gaurantee that the new page has been loaded.- See Also:
-
clickAndWaitToBecomeStale()clickAndWaitToBecomeStale(Duration)
-
setAtOnce
The existingset(String)method has shortcomings regarding large strings because it utilizes the sendKeys mechanism to enter the string which takes a significant amount of time, i.e. the browser may consider the script to be unresponsive.This method method shall provide a high throughput mechanism which puts the whole string at once into the text field instead of char by char.
This is a solution / workaround published for Selenium Issue 4496: #4496
- Parameters:
text- the large string to be entered
-
get
Returns the value of the input field.- Returns:
- the value of the input field.
-
set
Sets the value of the input field to the specified text.Any existing value gets cleared.
-
set
-
selectDropdownMenu
Clicks a menu button, and selects the matching item from the drop down. TODO using a class name as theDescribable.value()does not seem to work.- Parameters:
type- Class withDescribableannotation.
-
selectDropdownMenu
-
selectDropdownMenuAlt
For alternative use when the 'yui-menu-button' doesn't exist. -
select
Select an option. -
select
-
choose
-
upload
-
text
-
getFormValidation
-
getSilentFormValidation
-
exists
public boolean exists()Determines whether an object is existing on the current page- Returns:
- TRUE if it exists
-