1 package com.atlassian.pageobjects.elements;
2
3 import com.atlassian.pageobjects.elements.query.TimedCondition;
4 import com.atlassian.pageobjects.elements.query.TimedQuery;
5 import org.openqa.selenium.Dimension;
6 import org.openqa.selenium.Point;
7
8 /**
9 * Represents an HTML element that is expected in the DOM of a page, all queries return TimedQueries.
10 *
11 */
12 public interface TimedElement
13 {
14 /**
15 * Query representing the existence of this element on a page.
16 *
17 * @return TimedQuery that true if element is present on the page, false if element is not visible or timeout
18 * expires.
19 */
20 TimedCondition isPresent();
21
22 /**
23 * Query representing visibility of this element on a page.
24 *
25 * @return TimedQuery that returns true if element is visible on the page, false if element is not visible
26 * or timeout expires.
27 */
28 TimedCondition isVisible();
29
30 /**
31 * Query representing whether this element is enabled on a page.
32 *
33 * @return TimedQuery that returns true if element is enabled on the page, false if element is disabled or
34 * timeout expires.
35 */
36 TimedCondition isEnabled();
37
38 /**
39 * Query representing whether this element is selected on a page.
40 *
41 * @return TimedQuery that returns true if element is selected on the page, false if element is not selected or
42 * timeout expires.
43 */
44 TimedCondition isSelected();
45
46 /**
47 * Query representing whether this element has the given classname set.
48 * @param className The name of the class to check
49 * @return TimedQuery that returns true if element has given classname set, false if element does not have the
50 * given classname set or timeout expires.
51 */
52 TimedCondition hasClass(String className);
53
54 /**
55 * Query representing the element's given attribute.
56 *
57 * @param name Name of the attribute
58 *
59 * @return TimedQuery that returns the value of the given attribute, null if element does not have given attribute
60 * or timeout expires.
61 */
62 TimedQuery<String> getAttribute(String name);
63
64 /**
65 * Query representing whether this element has the given attribute set
66 * @param name Name of the attribute
67 * @param value expected attribute value
68 * @return TimedQuery that returns true if element has given attribute set, false if element does not have the
69 * given attribute set or timeout expires
70 */
71 TimedCondition hasAttribute(String name, String value);
72
73 /**
74 * Query representing the element's inner text.
75 *
76 * @return TimedQuery that returns the inner text of the element, null if element does not have inner text
77 * or timeout expires.
78 */
79 TimedQuery<String> getText();
80
81 /**
82 * Query representing whether this element's innerText is equal to the provided string.
83 *
84 * @param text The expected innerText string
85 * @return timed condition that returns <code>true</code> if this element has given innerText equal to expected,
86 * <code>false</code> otherwise
87 */
88 TimedCondition hasText(String text);
89
90 /**
91 * Query representing the element's tag name
92 *
93 * @return TimedQuery that returns the tagname of the element
94 */
95 TimedQuery<String> getTagName();
96
97 /**
98 * Query representing the element's 'value' attribute
99 *
100 * @return TimedQuery that returns the value of the 'value' attribute, null if element does not have a 'value'
101 * attribute or timeout expires.
102 */
103 TimedQuery<String> getValue();
104
105 /**
106 * Query representing whether this element's value attribute is equal to the provided string.
107 *
108 * @param value The expected value attribute
109 * @return timed condition that returns <code>true</code> if this element has given value attribute equal to
110 * expected, <code>false</code> otherwise
111 */
112 TimedCondition hasValue(String value);
113
114 /**
115 * Timed query representing the location of the element on the page.
116 *
117 * @return query for location of the element on the page. Returns <code>null</code>, if the element cannot be located
118 * by given timeout
119 */
120 TimedQuery<Point> getLocation();
121
122 /**
123 * Timed query representing the dimension of the element.
124 *
125 * @return query for dimension of the element on the page. Returns <code>null</code>, if the element cannot be located
126 * by given timeout
127 */
128 TimedQuery<Dimension> getSize();
129 }