PageRenderTime 50ms CodeModel.GetById 47ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/sitebricks-acceptance-tests/src/test/java/com/google/sitebricks/acceptance/page/SelectRoutingPage.java

http://github.com/dhanji/sitebricks
Java | 44 lines | 33 code | 11 blank | 0 comment | 1 complexity | 19b0e877e94fefba66e036b4fafd7d18 MD5 | raw file
 1package com.google.sitebricks.acceptance.page;
 2
 3import com.google.sitebricks.acceptance.util.AcceptanceTest;
 4import com.google.sitebricks.example.HelloWorld;
 5
 6import org.openqa.selenium.By;
 7import org.openqa.selenium.WebDriver;
 8import org.openqa.selenium.WebElement;
 9import org.openqa.selenium.support.PageFactory;
10
11import java.util.List;
12
13public class SelectRoutingPage {
14
15  private WebDriver driver;
16
17  public SelectRoutingPage(WebDriver driver) {
18    this.driver = driver;
19  }
20
21  public boolean hasExpectedDiv(String className) {
22    try {
23      WebElement element = driver.findElement(By.className(className));
24    } catch (Exception e) {
25      return false;
26    }
27
28    return true;
29  }
30
31  public boolean hasExpectedDivCount(int i) {
32    List<WebElement> elements = driver.findElements(By.className("result"));
33    return elements.size() == i;
34  }
35
36  public static SelectRoutingPage open(WebDriver driver) {
37    driver.get(AcceptanceTest.baseUrl() + "/select");
38    return PageFactory.initElements(driver, SelectRoutingPage.class);
39  }
40
41  public void submit(String s) {
42    driver.findElement(By.id(s + "Submit")).submit();    
43  }
44}