1 package com.atlassian.webdriver;
2
3 import com.atlassian.pageobjects.browser.BrowserAware;
4 import com.atlassian.webdriver.debug.WebDriverDebug;
5 import com.atlassian.webdriver.utils.Check;
6 import com.google.common.base.Function;
7 import org.openqa.selenium.By;
8 import org.openqa.selenium.JavascriptExecutor;
9 import org.openqa.selenium.SearchContext;
10 import org.openqa.selenium.WebDriver;
11 import org.openqa.selenium.interactions.HasInputDevices;
12 import org.openqa.selenium.internal.WrapsDriver;
13
14 import java.io.File;
15
16 /**
17 * Represents the web browser, adds common helper methods on top of <tt>WebDriver</tt>.
18 *
19 * @deprecated scheduled for removal in 3.0. See particular methods for references to replacing functionality.
20 */
21 @Deprecated
22 public interface AtlassianWebDriver extends WebDriver, JavascriptExecutor, HasInputDevices, BrowserAware, WrapsDriver
23 {
24 /**
25 * Gets the underlying <tt>WebDriver</tt>.
26 * @return WebDriver
27 */
28 WebDriver getDriver();
29
30 /**
31 * Quits this driver, closing every associated window.
32 */
33 void quit();
34
35 /**
36 * Waits for condition to evaluate to true until default timeout.
37 *
38 * <p>
39 * If the condition does not become true within default timeout, this method will throw a TimeoutException.
40 * </p>
41 * @param isTrue Function that evaluates true if waiting is complete.
42 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
43 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
44 */
45 void waitUntil(Function<WebDriver, Boolean> isTrue);
46
47 /**
48 * Waits for condition to evaluate to true until given timeout.
49 *
50 * <p>
51 * If the condition does not become true within given timeout, this method will throw a TimeoutException.
52 * </p>
53 * @param isTrue Function that evaluates true if waiting is complete.
54 * @param timeoutInSeconds Timeout in seconds to wait for condition to return true.
55 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
56 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
57 */
58 void waitUntil(Function<WebDriver, Boolean> isTrue, int timeoutInSeconds);
59
60 /**
61 * Writes the source of the last loaded page to the specified file.
62 * @param dumpFile File to write the source to.
63 * @deprecated use {@link WebDriverDebug#dumpSourceTo(File)}
64 */
65 void dumpSourceTo(File dumpFile);
66
67 /**
68 * Saves screen shot of the browser to the specified file.
69 * @param destFile File to save screen shot.
70 * @deprecated use {@link WebDriverDebug#takeScreenshotTo(File)}
71 */
72 void takeScreenshotTo(File destFile);
73
74 /**
75 * Wait until element is visible within search context.
76 *
77 * @param elementLocator Locator strategy for the element.
78 * @param context SearchContext to use when locating.
79 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
80 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
81 */
82 void waitUntilElementIsVisibleAt(By elementLocator, SearchContext context);
83
84 /**
85 * Wait until element is visible on the page.
86 *
87 * @param elementLocator Locator strategy for the element.
88 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
89 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
90 */
91 void waitUntilElementIsVisible(By elementLocator);
92
93 /**
94 * Wait until element is not visible within a search context.
95 *
96 * @param elementLocator Locator strategy for the element.
97 * @param context SearchContext to use when locating.
98 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
99 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
100 */
101 void waitUntilElementIsNotVisibleAt(By elementLocator, SearchContext context);
102
103 /**
104 * Wait until element is not visible on the page.
105 *
106 * @param elementLocator Locator strategy for the element.
107 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
108 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
109 */
110 void waitUntilElementIsNotVisible(By elementLocator);
111
112 /**
113 * Wait until element is present within a search context.
114 *
115 * @param elementLocator Locator strategy for the element.
116 * @param context SearchContext to use when locating.
117 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
118 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
119 */
120 void waitUntilElementIsLocatedAt(By elementLocator, SearchContext context);
121
122 /**
123 * Wait until element is present on the page.
124 *
125 * @param elementLocator Locator strategy for the element.
126 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
127 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
128 */
129 void waitUntilElementIsLocated(By elementLocator);
130
131 /**
132 * Wait until element is not present within a search context.
133 *
134 * @param elementLocator Locator strategy for the element.
135 * @param context Parent element to use when locating.
136 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
137 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
138 */
139 void waitUntilElementIsNotLocatedAt(By elementLocator, SearchContext context);
140
141 /**
142 * Wait until element is not present on the page.
143 *
144 * @param elementLocator Locator strategy for the element.
145 * @deprecated use {@link com.atlassian.webdriver.utils.element.WebDriverPoller} instead. For more sophisticated
146 * polling/waiting toolkit, check the {@code PageElement} API in the atlassian-pageobjects-elements module.
147 */
148 void waitUntilElementIsNotLocated(By elementLocator);
149
150 /**
151 * Whether an element is present on the page.
152 *
153 * @param locator Locator strategy for the element.
154 * @return True if the element is present, false otherwise.
155 * @deprecated use {@link Check#elementExists(By, SearchContext)} instead
156 */
157 boolean elementExists(By locator);
158
159 /**
160 * Whether an element is present within a search context.
161 *
162 * @param locator Locator strategy for the element.
163 * @param context SearchContext to use when locating.
164 * @return True if element is present, false otherwise.
165 * @deprecated use {@link Check#elementExists(By, SearchContext)} instead
166 */
167 boolean elementExistsAt(By locator, SearchContext context);
168
169 /**
170 * Whether an element is visible on the page.
171 *
172 * @param locator Locator strategy for the element.
173 * @return True if element is visible, false otherwise
174 * @deprecated use {@link Check#elementIsVisible(By, SearchContext)} instead
175 */
176 boolean elementIsVisible(By locator);
177
178 /**
179 * Whether an element is visible within a given search context.
180 *
181 * @param locator Locator strategy for the element.
182 * @param context SearchContext to use when locating.
183 * @return True if element is visible, false otherwise
184 * @deprecated use {@link Check#elementIsVisible(By, SearchContext)} instead
185 */
186 boolean elementIsVisibleAt(By locator, SearchContext context);
187 }