All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pojosontheweb.selenium.AbstractPageObject Maven / Gradle / Ivy

There is a newer version: 3.0.1
Show newest version
package com.pojosontheweb.selenium;

import org.openqa.selenium.WebDriver;

/**
 * Utility for creating "page object" helper classes.
 * Page objects are used to model pages (or page fragments)
 * and encapsulate the underlying findrs, exposing a clean,
 * explicit API for writing the tests.
 */
public abstract class AbstractPageObject {

	/**
	 * The "root" Findr for the page
	 */
	private final Findr findr;

	/**
	 * Create a page object with passed Findr as "root"
	 * @param findr the "root" findr
	 */
	public AbstractPageObject(Findr findr) {
		this.findr = findr;
	}

	/**
	 * Return the "root" findr
	 * @return the root findr
	 */
	public Findr getFindr() {
		return findr;
	}

	/**
	 * Return the WebDriver
	 * @return the WebDriver
	 */
	public WebDriver getDriver() {
		return findr.getDriver();
	}

	/**
	 * Finds from root findr : alias for this.findr.$
	 * @param selector the selector
	 * @return a findr for passed selector
	 */
	public Findr $(String selector) {
		return findr.$(selector);
	}

	/**
	 * Finds from root findr : alias for this.findr.$
	 * @param selector the selector
	 * @return a list findr for passed selector
	 */
	public Findr.ListFindr $$(String selector) {
		return findr.$$(selector);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy