Skip to content

Instantly share code, notes, and snippets.

@jsdevel
Last active August 29, 2015 14:19
Show Gist options
  • Save jsdevel/576aa8000fbbced3a09f to your computer and use it in GitHub Desktop.
Save jsdevel/576aa8000fbbced3a09f to your computer and use it in GitHub Desktop.
page-class
public abstract class Page<T extends Page>
implements HasDriver, HasPage<T> {
protected WebDriver driver;
private String endpoint;
protected String getPagePath();
@Override
public WebDriver getDriver() {
return driver;
}
@Override
public T getPage() {
return (T) this;
}
public T get() {
driver.get(endpoint + getPagePath());
return getPage();
}
// package private. Our custom PageFactory sets this.
void set driver(WebDriver driver) {
this.driver = driver;
}
void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment