1   package com.atlassian.pageobjects.elements;
2   
3   import com.atlassian.pageobjects.elements.query.TimedCondition;
4   import com.atlassian.pageobjects.elements.query.TimedQuery;
5   
6   /**
7    * Represents an HTML element that is expected in the DOM of a page, all queries return TimedQueries.
8    * 
9    */
10  public interface TimedElement
11  {
12      /**
13       * Query representing the existence of this element on a page.
14       *
15       * @return TimedQuery that true if element is present on the page, false if element is not visible or timeout
16       * expires.
17       */
18      TimedCondition isPresent();
19  
20      /**
21       * Query representing visibility of this element on a page.
22       *
23       * @return TimedQuery that returns true if element is visible on the page, false if element is not visible 
24       * or timeout expires.
25       */
26      TimedCondition isVisible();
27  
28      /**
29       * Query representing whether this element is enabled on a page.
30       *
31       * @return TimedQuery that returns true if element is enabled on the page, false if element is disabled or
32       * timeout expires.
33       */
34      TimedCondition isEnabled();
35  
36      /**
37       * Query representing whether this element is selected on a page.
38       *
39       * @return TimedQuery that returns true if element is selected on the page, false if element is not selected or
40       * timeout expires.
41       */
42      TimedCondition isSelected();
43   
44      /**
45       * Query representing whether this element has the given classname set.
46       * @param className The name of the class to check
47       * @return TimedQuery that returns true if element has given classname set, false if element does not have the
48       * given classname set or timeout expires.
49       */
50      TimedCondition hasClass(String className);
51  
52      /**
53       * Query representing the element's given attribute.
54       *
55       * @param name Name of the attribute
56       *
57       * @return TimedQuery that returns the value of the given attribute, null if element does not have given attribute
58       * or timeout expires.
59       */
60      TimedQuery<String> getAttribute(String name);
61  
62      /**
63       * Query representing whether this element has the given attribute set
64       * @param name Name of the attribute
65       * @param value expected attribute value
66       * @return TimedQuery that returns true if element has given attribute set, false if element does not  have the
67       * given attribute set or timeout expires
68       */
69      TimedCondition hasAttribute(String name, String value);
70  
71      /**
72       * Query representing the element's inner text.
73       *
74       * @return TimedQuery that returns the inner text of the element, null if element does not have inner text
75       * or timeout expires.
76       */
77      TimedQuery<String> getText();
78  
79       /**
80       * Query representing whether this element's innerText is equals to the provided string
81       * @param text The expected innerText string
82       * @return TimedQuery that returns true if this element has given innerText set, false if element does not have the
83        * given attribute set or timeout expires
84       */
85      TimedCondition hasText(String text);
86  
87      /**
88       * Query representing the element's tag name
89       *
90       * @return TimedQuery that returns the tagname of the element
91       */
92      TimedQuery<String> getTagName();
93  
94      /**
95       * Query representing the element's 'value' attribute
96       *
97       * @return TimedQuery that returns the value of the 'value' attribute, null if element does not have a 'value'
98       * attribute or timeout expires.
99       */
100     TimedQuery<String> getValue();
101 }