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:
Control
is late binding, and the underlyingWebElement
is resolved only when an interaction with control happens. This allowsControl
s to be instantiated earlier (typically when aPageObject
subtype is instantiated.)Control
offers 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 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, time
Fields inherited from interface org.jenkinsci.test.acceptance.po.CapybaraPortingLayer
by
-
Constructor Summary
ConstructorDescriptionControl
(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 TypeMethodDescriptionvoid
check()
void
check
(boolean state) void
void
click()
sends a click on the underlying element.boolean
exists()
Determines whether an object is existing on the current pageget()
Returns the value of the input field.org.openqa.selenium.WebElement
resolve()
void
void
Select an option.void
selectDropdownMenu
(Class<?> type) Clicks a menu button, and selects the matching item from the drop down.void
selectDropdownMenu
(String displayName) void
selectDropdownMenuAlt
(Class<?> type) For alternative use when the 'yui-menu-button' doesn't exist.void
void
void
Sets the value of the input field to the specified text.void
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.text()
void
uncheck()
void
Methods 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, 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 withDescribable
annotation.
-
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
-