public abstract class ManualNavigationWebTask extends BaseWebTask
LoadablePage.load(Class, org.openqa.selenium.WebDriver)
because the target URL requires some parameters (e.g. "/item?id=999"),
which are not known at compile-time.
Those parameters should be modeled as fields.
Concrete subclasses only need to define targetUrl()
and landingPage(). That's it.
If needed, they can also specialize run(WebPage).
For example, they may need to first validate the fields:
private String articleId;
public WebPage run(WebPage previousPage) {
if(articleId == null || articleId.equals(""))
throw new IllegalArgumentException();
return super.run(previousPage);
}
}
logger, user| Constructor and Description |
|---|
ManualNavigationWebTask() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract WebPage |
landingPage() |
WebPage |
run(WebPage previousPage)
Navigate to the relative URL
targetUrl()
and return the page landingPage(). |
protected abstract String |
targetUrl() |
browser, driver, getUser, setUserpublic WebPage run(WebPage previousPage)
targetUrl()
and return the page landingPage().previousPage - the page it is displayed before this task startslandingPage()protected abstract String targetUrl()
protected abstract WebPage landingPage()
targetUrl()Copyright © 2015. All rights reserved.