BasePage is the foundation of the Page Object Model in this framework. Every page class extends it to inherit a set of Selenium wrapper methods that apply a 10-second explicit wait before each interaction, eliminating timing-related flakiness without requiring any extra setup in your page objects.
Constructor
driver and creates a WebDriverWait with a 10-second timeout. PicoContainer injects the shared WebDriver instance when Cucumber instantiates a page object.
Methods
find
WebElement.
A Selenium
By locator that identifies the target element (e.g., By.id("username"), By.cssSelector(".btn-primary")).The first matching element that is visible on screen.
click
A Selenium
By locator for the element to click.type
find() first, so it also waits for the field to be visible before interacting.
A Selenium
By locator for the <input> or <textarea> element.The string to type into the field. The field is cleared before typing.
clear() is called before sendKeys(), so any pre-existing value is always replaced.getText
A Selenium
By locator for the element whose text you want to read.The trimmed visible text content of the element, as returned by
WebElement.getText().locatorText
getText. It exists as an alias for readability in certain step definitions.
A Selenium
By locator for the element whose text you want to read.The visible text of the element. Delegates directly to
getText(locator).isDisplayed
NoSuchElementException and TimeoutException) and returns false instead of throwing, making it safe to use in assertions and conditional logic.
A Selenium
By locator for the element to inspect.true if the element exists and is visible; false if it is absent, hidden, or the wait times out.isClickable
ExpectedConditions.elementToBeClickable internally. Returns false if the wait expires or any exception is raised.
A Selenium
By locator for the element to check.true if the element is clickable within the 10-second timeout; false otherwise.isChecked
false safely.
A Selenium
By locator for an <input type="checkbox"> or <input type="radio"> element.true if the input is selected; false if it is unchecked or not found.navigateTo
driver.get(url); no explicit wait is applied because page-load behavior is controlled by the browser’s implicit page-load timeout.
The full URL to navigate to, including the scheme (e.g.,
"https://www.riu.com/es").Protected fields
| Field | Type | Description |
|---|---|---|
driver | WebDriver | The active browser session injected by PicoContainer. |
wait | WebDriverWait | Explicit wait configured with a 10-second timeout. |
Both fields are
protected so that subclasses can access them directly when the public wrapper methods are not sufficient (for example, when building a Select object or performing JavaScript execution).