1 package com.atlassian.pageobjects.elements.test.pageobjects.page;
2
3 import com.atlassian.pageobjects.Page;
4 import com.atlassian.pageobjects.binder.WaitUntil;
5 import com.atlassian.pageobjects.elements.ElementBy;
6 import com.atlassian.pageobjects.elements.PageElement;
7 import com.atlassian.pageobjects.elements.PageElements;
8 import com.atlassian.pageobjects.elements.query.Poller;
9 import org.openqa.selenium.By;
10
11 public class PageElementSearchPage implements Page
12 {
13 @ElementBy(tagName = PageElements.BODY)
14 protected PageElement body;
15
16 @ElementBy(id = "table-list")
17 private PageElement tableRoot;
18
19 @ElementBy(id = "async-update-parent")
20 private PageElement asyncRoot;
21
22 @Override
23 public String getUrl()
24 {
25 return "/html/page-element-search.html";
26 }
27
28 @WaitUntil
29 public void waitForPageLoad()
30 {
31 Poller.waitUntilTrue(body.timed().hasAttribute("id", "page-element-search-page"));
32 }
33
34 public PageElement getTableRoot()
35 {
36 return tableRoot;
37 }
38
39 public PageElement getAsyncRoot() {
40 return asyncRoot;
41 }
42
43 public PageElementSearchPage clickAsyncButton(int buttonNumber) {
44 findAsyncButton(buttonNumber).click();
45
46 return this;
47 }
48
49 protected PageElement findAsyncButton(int number) {
50 return asyncRoot.find(By.id("async-to-state-" + number));
51 }
52 }