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
public class Control extends CapybaraPortingLayerImpl
Wraps a specific form element inPageAreaImpl
to provide operations.Control
is like aWebElement
, 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:
PageAreaImpl.control(String...)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Control.Owner
-
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
Constructors Constructor Description Control(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
check()
void
check(boolean state)
void
choose(Class<?> describable)
void
click()
sends a click on the underlying element.boolean
exists()
Determines whether an object is existing on the current pageString
get()
Returns the value of the input field.FormValidation
getFormValidation()
FormValidation
getSilentFormValidation()
org.openqa.selenium.WebElement
resolve()
void
select(Class<?> describable)
void
select(String option)
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
sendKeys(String t)
void
set(Object text)
void
set(String text)
Sets the value of the input field to the specified text.void
setAtOnce(String text)
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.String
text()
void
uncheck()
void
upload(Resource res)
-
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, isStale, last, lastIfNotVisible, newInstance, resource, runThenConfirmAlert, runThenConfirmAlert, runThenHandleAlert, runThenHandleAlert, sleep, visit, waitFor, waitFor, waitFor, waitFor, waitFor, waitForCond, waitForCond
-
-
-
-
Constructor Detail
-
Control
public Control(PageAreaImpl parent, String... relativePaths)
-
Control
public Control(PageObject parent, String... paths)
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 Detail
-
resolve
public org.openqa.selenium.WebElement resolve()
-
sendKeys
public void sendKeys(String t)
-
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.
-
setAtOnce
public void setAtOnce(String text)
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
public String get()
Returns the value of the input field.- Returns:
- the value of the input field.
-
set
public void set(@Nullable String text)
Sets the value of the input field to the specified text.Any existing value gets cleared.
-
set
public void set(Object text)
-
selectDropdownMenu
public void selectDropdownMenu(Class<?> type)
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
public void selectDropdownMenu(String displayName)
-
selectDropdownMenuAlt
public void selectDropdownMenuAlt(Class<?> type)
For alternative use when the 'yui-menu-button' doesn't exist.
-
select
public void select(String option)
Select an option.
-
select
public void select(Class<?> describable)
-
choose
public void choose(Class<?> describable)
-
upload
public void upload(Resource res)
-
text
public String text()
-
getFormValidation
public FormValidation getFormValidation()
-
getSilentFormValidation
public FormValidation getSilentFormValidation()
-
exists
public boolean exists()
Determines whether an object is existing on the current page- Returns:
- TRUE if it exists
-
-