-
Notifications
You must be signed in to change notification settings - Fork 17
SeleniumWComponentsWebDriver
SeleniumWComponentsWebDriver extends org.openqa.selenium.WebDriver
to provide hooks for testing WComponents UIs.
- Getting components
- Ready state
- Session handling
- Other functionality
- Related components
- Further information
SeleniumWComponentsWebDriver provides a means to access specific extensions of rg.openqa.selenium.WebElement
which provide testing hooks for specific components. For example findWCheckBox(By)
provides a means to get a WCheckBox's WebElement
extension. As of v1.3 there are a few of these methods as there are few extensions. These are being extensively revised and v1.4 contains many more.
In addition to the component specific means to find elements there are overrides of findElement(By)
and findElements(By)
which return SeleniumWComponentWebElement.
SeleniumWComponentsWebDriver provides a means to determine if a page is "ready" for testing. This means that all WAjaxControl and WSubordinateControl interactions have completed and the full UI is loaded.
// given SeleniumWComponentsWebDriver driver:
// to force a test to wait until the page is ready:
driver.waitForPageReady();
Note, though, that some overridden methods may have an in-built wait for page ready. An example of this is the SeleniumWComponentWebElement override of click()
. In these cases adding an extra wait will merely slow down your test run with no actual benefit.
SeleniumWComponentsWebDriver provides means to access or manipulate application sessions during tests.
-
void newSession()
creates a new session; -
void newSession(final String url)
clears all current cookies and gets a new session at the provided URL then waits for page ready; -
boolean hasSession()
indicates if a session is available; -
String getSessionId()
provides a handle to the current session.
-
getDriver()
returns the backing WebDriver instance; -
isOpenDialog()
indicates if a WDialog is open on screen.
From v1.4 the following methods are available to help with writing tests of labelled components. These are in addition to ByLabel and apply when the required component is a WLabel rather than the interactive control itself; they operate in a manner similar to
-
SeleniumWLabelWebElement findWLabelWithPartialText(String)
will find the first WLabel which contains the string; and -
SeleniumWLabelWebElement findWLabelWithPartialText(String, int)
will find thenth
WLabel which contains the string.
from v1.5.3 the following methods are available to help access WButtons:
-
SeleniumWButtonWebElement findWButtonByText(String)
will find the first WButton containing the given text as visible text or in the button element'stitle
andaria-label
attributes. -
SeleniumWButtonWebElement findWButtonByText(String, boolean)
will find the first WButton containing the given text with the option to also hunt in the button element'stitle
andaria-label
attributes for the text. -
SeleniumWButtonWebElement findWButtonByText(String, boolean, int)
will find thenth
WButton containing the given text with the option to also hunt in the button element'stitle
andaria-label
attributes for the text.
Also new in 1.5.3 is a helper to get the first button, regardless of source component:
-
WebElement findButton(String, boolean)
will attempt to find a button element which contains the given text with the option to also hunt in the button element'stitle
andaria-label
attributes for the text.