1 | import { Alert, By, ByHash, Condition, Locator, WebDriver, WebElement, WebElementCondition } from "../";
|
2 |
|
3 | /**
|
4 | * Creates a condition that will wait until the input driver is able to switch
|
5 | * to the designated frame. The target frame may be specified as
|
6 | *
|
7 | * 1. a numeric index into
|
8 | * [window.frames](https://developer.mozilla.org/en-US/docs/Web/API/Window.frames)
|
9 | * for the currently selected frame.
|
10 | * 2. a {@link ./WebElement}, which must reference a FRAME or IFRAME
|
11 | * element on the current page.
|
12 | * 3. a locator which may be used to first locate a FRAME or IFRAME on the
|
13 | * current page before attempting to switch to it.
|
14 | *
|
15 | * Upon successful resolution of this condition, the driver will be left
|
16 | * focused on the new frame.
|
17 | *
|
18 | * @param {!(number|./WebElement|By|function(!./WebDriver): !./WebElement)} frame
|
19 | * The frame identifier.
|
20 | * @return {!Condition<boolean>} A new condition.
|
21 | */
|
22 | export function ableToSwitchToFrame(
|
23 | frame: number | WebElement | By | ((webdriver: WebDriver) => WebElement) | ByHash,
|
24 | ): Condition<boolean>;
|
25 |
|
26 | /**
|
27 | * Creates a condition that waits for an alert to be opened. Upon success, the
|
28 | * returned promise will be fulfilled with the handle for the opened alert.
|
29 | *
|
30 | * @return {!Condition<!./Alert>} The new condition.
|
31 | */
|
32 | export function alertIsPresent(): Condition<Alert>;
|
33 |
|
34 | /**
|
35 | * Creates a condition that will wait for the given element to be disabled.
|
36 | *
|
37 | * @param {!WebElement} element The element to test.
|
38 | * @return {!WebElementCondition} The new condition.
|
39 | * @see WebDriver#isEnabled
|
40 | */
|
41 | export function elementIsDisabled(element: WebElement): WebElementCondition;
|
42 |
|
43 | /**
|
44 | * Creates a condition that will wait for the given element to be enabled.
|
45 | *
|
46 | * @param {!WebElement} element The element to test.
|
47 | * @return {!WebElementCondition} The new condition.
|
48 | * @see WebDriver#isEnabled
|
49 | */
|
50 | export function elementIsEnabled(element: WebElement): WebElementCondition;
|
51 |
|
52 | /**
|
53 | * Creates a condition that will wait for the given element to be deselected.
|
54 | *
|
55 | * @param {!WebElement} element The element to test.
|
56 | * @return {!WebElementCondition} The new condition.
|
57 | * @see WebDriver#isSelected
|
58 | */
|
59 | export function elementIsNotSelected(element: WebElement): WebElementCondition;
|
60 |
|
61 | /**
|
62 | * Creates a condition that will wait for the given element to be in the DOM,
|
63 | * yet not visible to the user.
|
64 | *
|
65 | * @param {!WebElement} element The element to test.
|
66 | * @return {!WebElementCondition} The new condition.
|
67 | * @see WebDriver#isDisplayed
|
68 | */
|
69 | export function elementIsNotVisible(element: WebElement): WebElementCondition;
|
70 |
|
71 | /**
|
72 | * Creates a condition that will wait for the given element to be selected.
|
73 | * @param {!WebElement} element The element to test.
|
74 | * @return {!WebElementCondition} The new condition.
|
75 | * @see WebDriver#isSelected
|
76 | */
|
77 | export function elementIsSelected(element: WebElement): WebElementCondition;
|
78 |
|
79 | /**
|
80 | * Creates a condition that will wait for the given element to become visible.
|
81 | *
|
82 | * @param {!WebElement} element The element to test.
|
83 | * @return {!WebElementCondition} The new condition.
|
84 | * @see WebDriver#isDisplayed
|
85 | */
|
86 | export function elementIsVisible(element: WebElement): WebElementCondition;
|
87 |
|
88 | /**
|
89 | * Creates a condition that will loop until an element is
|
90 | * {@link ./WebDriver#findElement found} with the given locator.
|
91 | *
|
92 | * @param {!(By|Function)} locator The locator to use.
|
93 | * @return {!WebElementCondition} The new condition.
|
94 | */
|
95 | export function elementLocated(locator: Locator): WebElementCondition;
|
96 |
|
97 | /**
|
98 | * Creates a condition that will wait for the given element's
|
99 | * {@link WebDriver#getText visible text} to contain the given
|
100 | * substring.
|
101 | *
|
102 | * @param {!WebElement} element The element to test.
|
103 | * @param {string} substr The substring to search for.
|
104 | * @return {!WebElementCondition} The new condition.
|
105 | * @see WebDriver#getText
|
106 | */
|
107 | export function elementTextContains(element: WebElement, substr: string): WebElementCondition;
|
108 |
|
109 | /**
|
110 | * Creates a condition that will wait for the given element's
|
111 | * {@link WebDriver#getText visible text} to match the given
|
112 | * {@code text} exactly.
|
113 | *
|
114 | * @param {!WebElement} element The element to test.
|
115 | * @param {string} text The expected text.
|
116 | * @return {!WebElementCondition} The new condition.
|
117 | * @see WebDriver#getText
|
118 | */
|
119 | export function elementTextIs(element: WebElement, text: string): WebElementCondition;
|
120 |
|
121 | /**
|
122 | * Creates a condition that will wait for the given element's
|
123 | * {@link WebDriver#getText visible text} to match a regular
|
124 | * expression.
|
125 | *
|
126 | * @param {!WebElement} element The element to test.
|
127 | * @param {!RegExp} regex The regular expression to test against.
|
128 | * @return {!WebElementCondition} The new condition.
|
129 | * @see WebDriver#getText
|
130 | */
|
131 | export function elementTextMatches(element: WebElement, regex: RegExp): WebElementCondition;
|
132 |
|
133 | /**
|
134 | * Creates a condition that will loop until at least one element is
|
135 | * {@link WebDriver#findElement found} with the given locator.
|
136 | *
|
137 | * @param {!(Locator|By.Hash|Function)} locator The locator
|
138 | * to use.
|
139 | * @return {!Condition.<!Array.<!WebElement>>} The new
|
140 | * condition.
|
141 | */
|
142 | export function elementsLocated(locator: Locator): Condition<WebElement[]>;
|
143 |
|
144 | /**
|
145 | * Creates a condition that will wait for the given element to become stale.
|
146 | * An element is considered stale once it is removed from the DOM, or a new
|
147 | * page has loaded.
|
148 | *
|
149 | * @param {!WebElement} element The element that should become stale.
|
150 | * @return {!Condition<boolean>} The new condition.
|
151 | */
|
152 | export function stalenessOf(element: WebElement): Condition<boolean>;
|
153 |
|
154 | /**
|
155 | * Creates a condition that will wait for the current page's title to contain
|
156 | * the given substring.
|
157 | *
|
158 | * @param {string} substr The substring that should be present in the page
|
159 | * title.
|
160 | * @return {!Condition.<boolean>} The new condition.
|
161 | */
|
162 | export function titleContains(substr: string): Condition<boolean>;
|
163 |
|
164 | /**
|
165 | * Creates a condition that will wait for the current page's title to match
|
166 | * the given value.
|
167 | *
|
168 | * @param {string} title The expected page title.
|
169 | * @return {!Condition<boolean>} The new condition.
|
170 | */
|
171 | export function titleIs(title: string): Condition<boolean>;
|
172 |
|
173 | /**
|
174 | * Creates a condition that will wait for the current page's title to match
|
175 | * the given regular expression.
|
176 | *
|
177 | * @param {!RegExp} regex The regular expression to test against.
|
178 | * @return {!Condition.<boolean>} The new condition.
|
179 | */
|
180 | export function titleMatches(regex: RegExp): Condition<boolean>;
|
181 |
|
182 | /**
|
183 | * Creates a condition that will wait for the current page's url to contain
|
184 | * the given substring.
|
185 | *
|
186 | * @param {string} substrUrl The substring that should be present in the
|
187 | * current URL.
|
188 | * @return {!Condition<boolean>} The new condition.
|
189 | */
|
190 | export function urlContains(substrUrl: string): Condition<boolean>;
|
191 |
|
192 | /**
|
193 | * Creates a condition that will wait for the current page's url to match the
|
194 | * given value.
|
195 | *
|
196 | * @param {string} url The expected page url.
|
197 | * @return {!Condition<boolean>} The new condition.
|
198 | */
|
199 | export function urlIs(url: string): Condition<boolean>;
|
200 |
|
201 | /**
|
202 | * Creates a condition that will wait for the current page's url to match the
|
203 | * given regular expression.
|
204 | *
|
205 | * @param {!RegExp} regex The regular expression to test against.
|
206 | * @return {!Condition<boolean>} The new condition.
|
207 | */
|
208 | export function urlMatches(regex: RegExp): Condition<boolean>;
|