[4895] | 1 | package org.expressolivre.cte.pages.calendar; |
---|
| 2 | |
---|
| 3 | import org.expressolivre.cte.pages.common.Page; |
---|
[4902] | 4 | import org.openqa.selenium.By; |
---|
[4895] | 5 | import org.openqa.selenium.WebDriver; |
---|
| 6 | import org.openqa.selenium.WebElement; |
---|
| 7 | import org.openqa.selenium.support.FindBy; |
---|
[4902] | 8 | import org.openqa.selenium.support.PageFactory; |
---|
[4895] | 9 | |
---|
| 10 | /** |
---|
| 11 | * @author L.F.Estivalet (Serpro) |
---|
| 12 | * |
---|
| 13 | * Created on Aug 2, 2011 at 3:22:59 PM |
---|
| 14 | * |
---|
| 15 | */ |
---|
| 16 | public class AppointmentSearchResultPage extends Page { |
---|
| 17 | |
---|
| 18 | /** Texto contendo numero de resultados encontrados. */ |
---|
| 19 | @FindBy(xpath = "/html/body[1]/div[@id='divSubContainer']/table/tbody/tr/td[@id='tdAppbox']/div[@id='divAppbox']/table[@id='tableDivAppbox']/tbody/tr/td/table[@id='calendar_search_table']/tbody/tr[1]/td/b") |
---|
| 20 | private WebElement resultsNumber; |
---|
| 21 | |
---|
| 22 | /** |
---|
| 23 | * @param driver |
---|
| 24 | */ |
---|
| 25 | public AppointmentSearchResultPage(WebDriver driver) { |
---|
| 26 | super(driver); |
---|
| 27 | // TODO Auto-generated constructor stub |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | /** |
---|
| 31 | * @return Texto informando o numero de resultados encontrados. |
---|
| 32 | */ |
---|
| 33 | public String getResultsNumber() { |
---|
| 34 | return this.resultsNumber.getText(); |
---|
| 35 | } |
---|
| 36 | |
---|
[4902] | 37 | /** |
---|
| 38 | * O primeiro resultado comeca na linha 2 da tabela (por isso o +1). |
---|
| 39 | * |
---|
| 40 | * @param row |
---|
| 41 | * @return |
---|
| 42 | */ |
---|
| 43 | public String getAppointmentSchedule(int row) { |
---|
| 44 | return super.getDisplayedElementContent(By |
---|
| 45 | .xpath("//table[@id='calendar_search_table']/tbody/tr[" |
---|
| 46 | + (row + 1) + "]/td[1]")); |
---|
| 47 | |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | /** |
---|
| 51 | * O primeiro resultado comeca na linha 2 da tabela (por isso o +1). |
---|
| 52 | * |
---|
| 53 | * @param row |
---|
| 54 | * @return |
---|
| 55 | */ |
---|
| 56 | public String getAppointmentDescription(int row) { |
---|
| 57 | return super |
---|
| 58 | .getDisplayedElementContent(By |
---|
| 59 | .xpath("//table[@id='calendar_search_table']/tbody/tr[" |
---|
| 60 | + (row + 1) |
---|
| 61 | + "]/td[2]/div[@id='calendar_event_entry']")); |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * O primeiro resultado comeca na linha 2 da tabela (por isso o +1). |
---|
| 66 | * |
---|
| 67 | * @param row |
---|
| 68 | * @return |
---|
| 69 | */ |
---|
[4917] | 70 | public AppointmentViewPage viewAppointment(int row) { |
---|
[4902] | 71 | super.findAndClickElement(By |
---|
| 72 | .xpath("//table[@id='calendar_search_table']/tbody/tr[" |
---|
| 73 | + (row + 1) |
---|
| 74 | + "]/td[2]/div[@id='calendar_event_entry']/a")); |
---|
| 75 | |
---|
| 76 | return PageFactory.initElements(driver, AppointmentViewPage.class); |
---|
| 77 | |
---|
| 78 | } |
---|
[4895] | 79 | } |
---|