public class WicketSelenium extends Object
Selenium that adds some handy
functions for Wicket-generated HTML pages. In particular, it allows you to
wait for Ajax processing to be completed. This way, you don't need to use
WebDriverWait which is more complicated and error-prone.| Modifier and Type | Field and Description |
|---|---|
protected static int |
WAIT_TIMEOUT_IN_SECONDS |
| Constructor and Description |
|---|
WicketSelenium(Configuration cfg,
org.openqa.selenium.WebDriver selenium) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear(org.openqa.selenium.By elementLocator)
Clear the value of the text input element located by the specified
locator.
|
void |
click(org.openqa.selenium.By elementLocator)
Click the element located by the specified locator.
|
org.openqa.selenium.WebElement |
findElement(org.openqa.selenium.By locator)
Get the
WebElement located by the specified locator. |
org.openqa.selenium.WebElement |
findWicketElement(String path)
Locate the HTML slot of a Wicket component using the specified path.
|
org.openqa.selenium.WebDriver |
getSelenium()
Get the underlying Selenium
WebDriver. |
String |
getText(org.openqa.selenium.By elementLocator)
Get the body text of the element located by the specified locator.
|
String |
getValue(org.openqa.selenium.By elementLocator)
Get the value of the "value" attribute of the element located by the
specified locator.
|
void |
openBookmarkablePage(Class<? extends org.apache.wicket.Page> pageClass)
Open a bookmarkable Wicket page.
|
void |
openBreadCrumbPanel(org.apache.wicket.extensions.breadcrumb.panel.IBreadCrumbPanelFactory factory)
Open a BreadCrumbPanel created by the IBreadCrumbPanelFactory in a page
|
void |
openComponent(ComponentFactory factory)
Open a page containing ONLY the Component created by the specified
ComponentFactory.
|
void |
openHomePage()
Open the home page of the Wicket application.
|
void |
openMountedPage(String mountPoint,
org.apache.wicket.request.mapper.parameter.PageParameters parameters)
Open a mounted Wicket page.
|
void |
openNonBookmarkablePage(Class<? extends org.apache.wicket.Page> pageClass,
Object... constructorArgs)
Open a non-bookmarkable Wicket page.
|
void |
sendKeys(org.openqa.selenium.By elementLocator,
CharSequence... keysToSend)
Send the keys to the element located by the specified locator.
|
void |
setPreferredLocale(Locale locale) |
void |
setResponsePageMarker()
It tells the server side to include a random string as the marker (a
cookie) in the response page.
|
void |
setResponsePageMarker(String marker)
It tells the server side to include a page marker as a cookie in the next
response page, so that you can then call
waitForMarkedPage() to
wait for it. |
void |
subscribeAjaxDoneHandler() |
void |
switchDefaultLocale() |
void |
waitForMarkedPage()
It waits until the browser sees a page with the page marker.
|
void |
waitUntilAjaxDone()
It waits until the Wicket Ajax processing has completed.
|
protected static final int WAIT_TIMEOUT_IN_SECONDS
public WicketSelenium(Configuration cfg, org.openqa.selenium.WebDriver selenium)
public void subscribeAjaxDoneHandler()
public void waitUntilAjaxDone()
public void setResponsePageMarker()
setResponsePageMarker(String).public void setResponsePageMarker(String marker)
waitForMarkedPage() to
wait for it. This way you can be sure that it is a new page and won't
suffer from the StaleElementReferenceException.marker - the marker to be usedpublic void waitForMarkedPage()
setResponsePageMarker(String) and then call this method.public void openBookmarkablePage(Class<? extends org.apache.wicket.Page> pageClass)
pageClass - the class of the pagepublic void openMountedPage(String mountPoint, org.apache.wicket.request.mapper.parameter.PageParameters parameters)
mountPoint - the mount point of the pageparameters - the page parameterspublic void openHomePage()
public void openNonBookmarkablePage(Class<? extends org.apache.wicket.Page> pageClass, Object... constructorArgs)
pageClass - the class of the pageconstructorArgs - the constructor argumentspublic void openComponent(ComponentFactory factory)
factory - the ComponentFactory creating the testing componentpublic void openBreadCrumbPanel(org.apache.wicket.extensions.breadcrumb.panel.IBreadCrumbPanelFactory factory)
factory - the IBreadCrumbPanelFactory creating the testing panelpublic org.openqa.selenium.WebElement findWicketElement(String path)
ByWicketIdPath.path - The path to the Wicket componentpublic org.openqa.selenium.WebElement findElement(org.openqa.selenium.By locator)
WebElement located by the specified locator.locator - locate the element using this locatorpublic org.openqa.selenium.WebDriver getSelenium()
WebDriver.public String getText(org.openqa.selenium.By elementLocator)
elementLocator - locate the element using this locatorpublic String getValue(org.openqa.selenium.By elementLocator)
elementLocator - locate the element using this locatorpublic void click(org.openqa.selenium.By elementLocator)
elementLocator - locate the element using this locatorpublic void sendKeys(org.openqa.selenium.By elementLocator,
CharSequence... keysToSend)
elementLocator - locate the element using this locatorkeysToSend - the keys to be sent to that elementpublic void clear(org.openqa.selenium.By elementLocator)
elementLocator - locate the element using this locatorpublic void setPreferredLocale(Locale locale)
public void switchDefaultLocale()
Copyright © 2009–2018. All rights reserved.