Created
August 27, 2016 13:58
-
-
Save ova2/195052593389271a5d534c4d56164c4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TimetablePage extends LoadablePage<TimetablePage> { | |
@FindBy(id = "...") | |
private Autocomplete from; | |
@FindBy(id = "...") | |
private Autocomplete to; | |
@FindBy(id = "...") | |
private Datepicker date; | |
@FindBy(id = "...") | |
private TimeInput time; | |
@FindBy(id = "...") | |
private Button search; | |
@Override | |
protected String getUrlPath() { | |
return "pages/fahrplan/fahrplan.xhtml"; | |
} | |
@Override | |
protected void isPageLoaded() throws Error { | |
try { | |
assertTrue(findElement(By.id("shopForm_searchfields")).isDisplayed()); | |
} catch (NoSuchElementException ex) { | |
throw new AssertionError(); | |
} | |
} | |
public TimetablePage typeFrom(String text) { | |
from.setValue(text); | |
return this; | |
} | |
public TimetablePage typeTo(String text) { | |
to.setValue(text); | |
return this; | |
} | |
public TimetablePage typeTime(Date date) { | |
time.setValue(date); | |
return this; | |
} | |
public TimetablePage typeDate(Date date) { | |
date.setValue(date); | |
return this; | |
} | |
public TimetablePage search() { | |
search.clickAndWaitUntil().ajaxCompleted().elementVisible(By.cssSelector("...")); | |
return this; | |
} | |
public TimetableTable getTimetableTable() { | |
List<WebElement> element = findElements(By.id("...")); | |
if (element.size() == 1) { | |
return TimetableTable.create(element.get(0)); | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment