@@ -32,64 +32,114 @@ public class WebDriverListener implements WebDriverEventListener {
3232
3333 /**
3434 * Sets the wait for all of the ExpectedConditions calls that we make here
35- * @param webDriverWaitTimeout
35+ * @param webDriverWaitTimeout the timeout used for WebDriverWaits
3636 */
3737 public void setWebdriverWaitTimeout (long webDriverWaitTimeout ) {
3838 this .WEBDRIVER_WAIT_TIMEOUT = webDriverWaitTimeout ;
3939 }
4040
4141 /**
4242 * Sets the screenshot target directory that will be used for screenshots generated inside onException()
43- * @param screenshotDirectory
43+ * @param screenshotDirectory the path to the screenshot directory used in onException
4444 */
4545 public void setScreenshotDirectory (File screenshotDirectory ) {
4646 this .screenshotDirectory = screenshotDirectory ;
4747 }
4848
49+ /**
50+ *
51+ * @param webDriver active WebDriver instance
52+ */
4953 public void beforeAlertAccept (WebDriver webDriver ) {
5054 // nothing yet
5155 }
5256
57+ /**
58+ *
59+ * @param webDriver active WebDriver instance
60+ */
5361 public void afterAlertAccept (WebDriver webDriver ) {
5462 // nothing yet
5563 }
5664
65+ /**
66+ *
67+ * @param webDriver active WebDriver instance
68+ */
5769 public void afterAlertDismiss (WebDriver webDriver ) {
5870 // nothing yet
5971 }
6072
73+ /**
74+ *
75+ * @param webDriver active WebDriver instance
76+ */
6177 public void beforeAlertDismiss (WebDriver webDriver ) {
6278 // nothing yet
6379 }
6480
81+ /**
82+ *
83+ * @param s String
84+ * @param webDriver active WebDriver instance
85+ */
6586 public void beforeNavigateTo (String s , WebDriver webDriver ) {
6687 // nothing yet
6788 }
6889
90+ /**
91+ *
92+ * @param s String
93+ * @param webDriver active WebDriver instance
94+ */
6995 public void afterNavigateTo (String s , WebDriver webDriver ) {
7096 // nothing yet
7197 }
7298
99+ /**
100+ *
101+ * @param webDriver active WebDriver instance
102+ */
73103 public void beforeNavigateBack (WebDriver webDriver ) {
74104 // nothing yet
75105 }
76106
107+ /**
108+ *
109+ * @param webDriver active WebDriver instance
110+ */
77111 public void afterNavigateBack (WebDriver webDriver ) {
78112 // nothing yet
79113 }
80114
115+ /**
116+ *
117+ * @param webDriver active WebDriver instance
118+ */
81119 public void beforeNavigateForward (WebDriver webDriver ) {
82120 // nothing yet
83121 }
84122
123+ /**
124+ *
125+ * @param webDriver active WebDriver instance
126+ */
85127 public void afterNavigateForward (WebDriver webDriver ) {
86128 // nothing yet
87129 }
88130
131+ /**
132+ *
133+ * @param webDriver active WebDriver instance
134+ */
89135 public void beforeNavigateRefresh (WebDriver webDriver ) {
90136 // nothing yet
91137 }
92138
139+ /**
140+ *
141+ * @param webDriver active WebDriver instance
142+ */
93143 public void afterNavigateRefresh (WebDriver webDriver ) {
94144 // nothing yet
95145 }
@@ -98,14 +148,20 @@ public void afterNavigateRefresh(WebDriver webDriver) {
98148 * Before each webDriver.findBy or @FindBy we want to make sure that we are supply elements
99149 * that are present in the DOM. This ensures that we avoid, to some degree, StaleElementExceptions (although
100150 * this is generally not the best way to avoid those types of exceptions).
101- * @param by
102- * @param webElement
103- * @param webDriver
151+ * @param by locator
152+ * @param webElement active WebElement, already located
153+ * @param webDriver active WebDriver instance
104154 */
105155 public void beforeFindBy (By by , WebElement webElement , WebDriver webDriver ) {
106156 new WebDriverWait (webDriver , WEBDRIVER_WAIT_TIMEOUT ).until (ExpectedConditions .presenceOfElementLocated (by ));
107157 }
108158
159+ /**
160+ *
161+ * @param by locator
162+ * @param webElement active WebElement, already located
163+ * @param webDriver active WebDriver instance
164+ */
109165 public void afterFindBy (By by , WebElement webElement , WebDriver webDriver ) {
110166 // nothing yet
111167 }
@@ -116,45 +172,82 @@ public void afterFindBy(By by, WebElement webElement, WebDriver webDriver) {
116172 * given time (as little as they need) to be ready to be interacted with.
117173 *
118174 * A valid case for this is where a button may be disabled until form fields are automatically valid.
119- * @param webElement
120- * @param webDriver
175+ * @param webElement active WebElement, already located
176+ * @param webDriver active WebDriver instance
121177 */
122178 public void beforeClickOn (WebElement webElement , WebDriver webDriver ) {
123179 new WebDriverWait (webDriver , WEBDRIVER_WAIT_TIMEOUT ).until (ExpectedConditions .elementToBeClickable (webElement ));
124180 }
125181
182+ /**
183+ *
184+ * @param webElement active WebElement, already located
185+ * @param webDriver active WebDriver instance
186+ */
126187 public void afterClickOn (WebElement webElement , WebDriver webDriver ) {
127188 // nothing yet
128189 }
129190
191+ /**
192+ *
193+ * @param webElement active WebElement, already located
194+ * @param webDriver active WebDriver instance
195+ * @param charSequences character sequence
196+ */
130197 public void beforeChangeValueOf (WebElement webElement , WebDriver webDriver , CharSequence [] charSequences ) {
131198 // nothing yet
132199 }
133200
201+ /**
202+ *
203+ * @param webElement active WebElement, already located
204+ * @param webDriver active WebDriver instance
205+ * @param charSequences character sequence
206+ */
134207 public void afterChangeValueOf (WebElement webElement , WebDriver webDriver , CharSequence [] charSequences ) {
135208 // nothing yet
136209 }
137210
211+ /**
212+ *
213+ * @param s String
214+ * @param webDriver active WebDriver instance
215+ */
138216 public void beforeScript (String s , WebDriver webDriver ) {
139217 // nothing yet
140218 }
141219
220+ /**
221+ *
222+ * @param s String
223+ * @param webDriver active WebDriver instance
224+ */
142225 public void afterScript (String s , WebDriver webDriver ) {
143226 // nothing yet
144227 }
145228
229+ /**
230+ *
231+ * @param s String
232+ * @param webDriver active WebDriver instance
233+ */
146234 public void beforeSwitchToWindow (String s , WebDriver webDriver ) {
147235 // nothing yet
148236 }
149237
238+ /**
239+ *
240+ * @param s String
241+ * @param webDriver active WebDriver instance
242+ */
150243 public void afterSwitchToWindow (String s , WebDriver webDriver ) {
151244 // nothing yet
152245 }
153246
154247 /**
155248 * If we have an exception, lets create a screenshot so we can see the page as it happened.
156- * @param throwable
157- * @param webDriver
249+ * @param throwable the thrown exception that we are holding here
250+ * @param webDriver active WebDriver instance
158251 */
159252 public void onException (Throwable throwable , WebDriver webDriver ) {
160253 File scrFile = ((TakesScreenshot ) webDriver ).getScreenshotAs (OutputType .FILE );
@@ -171,18 +264,40 @@ public void onException(Throwable throwable, WebDriver webDriver) {
171264 }
172265 }
173266
267+ /**
268+ *
269+ * @param outputType output type
270+ * @param <X> x
271+ */
174272 public <X > void beforeGetScreenshotAs (OutputType <X > outputType ) {
175273 // nothing yet
176274 }
177275
276+ /**
277+ *
278+ * @param outputType output type
279+ * @param x x
280+ * @param <X> x
281+ */
178282 public <X > void afterGetScreenshotAs (OutputType <X > outputType , X x ) {
179283 // nothing yet
180284 }
181285
286+ /**
287+ *
288+ * @param webElement active WebElement, already located
289+ * @param webDriver active WebDriver instance
290+ */
182291 public void beforeGetText (WebElement webElement , WebDriver webDriver ) {
183292 // nothing yet
184293 }
185294
295+ /**
296+ *
297+ * @param webElement active WebElement, already located
298+ * @param webDriver active WebDriver instance
299+ * @param s String
300+ */
186301 public void afterGetText (WebElement webElement , WebDriver webDriver , String s ) {
187302 // nothing yet
188303 }
0 commit comments