@@ -148,89 +148,71 @@ public void testShouldScrollOverflowElementsIfClickPointIsOutOfViewButElementIsI
148
148
assertEquals ("clicked" , driver .findElement (By .id ("clicked" )).getText ());
149
149
}
150
150
151
+ @ NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
151
152
@ Test
152
153
@ Ignore (value = {SAFARI , MARIONETTE }, reason = "others: not tested" )
153
154
public void testShouldBeAbleToClickElementInAFrameThatIsOutOfView () {
154
- try {
155
- driver .get (appServer .whereIs ("scrolling_tests/page_with_frame_out_of_view.html" ));
156
- driver .switchTo ().frame ("frame" );
157
- WebElement element = driver .findElement (By .name ("checkbox" ));
158
- element .click ();
159
- assertTrue (element .isSelected ());
160
- } finally {
161
- driver .switchTo ().defaultContent ();
162
- }
155
+ driver .get (appServer .whereIs ("scrolling_tests/page_with_frame_out_of_view.html" ));
156
+ driver .switchTo ().frame ("frame" );
157
+ WebElement element = driver .findElement (By .name ("checkbox" ));
158
+ element .click ();
159
+ assertTrue (element .isSelected ());
163
160
}
164
161
162
+ @ NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
165
163
@ Test
166
164
@ Ignore (value = {SAFARI , MARIONETTE }, reason = "not tested" )
167
165
public void testShouldBeAbleToClickElementThatIsOutOfViewInAFrame () {
168
- try {
169
- driver .get (appServer .whereIs ("scrolling_tests/page_with_scrolling_frame.html" ));
170
- driver .switchTo ().frame ("scrolling_frame" );
171
- WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
172
- element .click ();
173
- assertTrue (element .isSelected ());
174
- } finally {
175
- driver .switchTo ().defaultContent ();
176
- }
166
+ driver .get (appServer .whereIs ("scrolling_tests/page_with_scrolling_frame.html" ));
167
+ driver .switchTo ().frame ("scrolling_frame" );
168
+ WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
169
+ element .click ();
170
+ assertTrue (element .isSelected ());
177
171
}
178
172
173
+ @ NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
179
174
@ Test (expected = MoveTargetOutOfBoundsException .class )
180
175
@ Ignore (reason = "All tested browses scroll non-scrollable frames" )
181
176
public void testShouldNotBeAbleToClickElementThatIsOutOfViewInANonScrollableFrame () {
182
- try {
183
- driver .get (appServer .whereIs ("scrolling_tests/page_with_non_scrolling_frame.html" ));
184
- driver .switchTo ().frame ("scrolling_frame" );
185
- WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
186
- element .click ();
187
- } finally {
188
- driver .switchTo ().defaultContent ();
189
- }
177
+ driver .get (appServer .whereIs ("scrolling_tests/page_with_non_scrolling_frame.html" ));
178
+ driver .switchTo ().frame ("scrolling_frame" );
179
+ WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
180
+ element .click ();
190
181
}
191
182
183
+ @ NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
192
184
@ Test
193
185
@ Ignore (value = {SAFARI , MARIONETTE }, reason = "not tested" )
194
186
public void testShouldBeAbleToClickElementThatIsOutOfViewInAFrameThatIsOutOfView () {
195
- try {
196
- driver .get (appServer .whereIs ("scrolling_tests/page_with_scrolling_frame_out_of_view.html" ));
197
- driver .switchTo ().frame ("scrolling_frame" );
198
- WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
199
- element .click ();
200
- assertTrue (element .isSelected ());
201
- } finally {
202
- driver .switchTo ().defaultContent ();
203
- }
187
+ driver .get (appServer .whereIs ("scrolling_tests/page_with_scrolling_frame_out_of_view.html" ));
188
+ driver .switchTo ().frame ("scrolling_frame" );
189
+ WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
190
+ element .click ();
191
+ assertTrue (element .isSelected ());
204
192
}
205
193
194
+ @ NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
206
195
@ Test
207
196
@ Ignore (value = {SAFARI , MARIONETTE }, reason = "not tested" )
208
197
public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrame () {
209
- try {
210
- driver .get (appServer .whereIs ("scrolling_tests/page_with_nested_scrolling_frames.html" ));
211
- driver .switchTo ().frame ("scrolling_frame" );
212
- driver .switchTo ().frame ("nested_scrolling_frame" );
213
- WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
214
- element .click ();
215
- assertTrue (element .isSelected ());
216
- } finally {
217
- driver .switchTo ().defaultContent ();
218
- }
198
+ driver .get (appServer .whereIs ("scrolling_tests/page_with_nested_scrolling_frames.html" ));
199
+ driver .switchTo ().frame ("scrolling_frame" );
200
+ driver .switchTo ().frame ("nested_scrolling_frame" );
201
+ WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
202
+ element .click ();
203
+ assertTrue (element .isSelected ());
219
204
}
220
205
206
+ @ NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
221
207
@ Test
222
208
@ Ignore (value = {SAFARI , MARIONETTE }, reason = "not tested" )
223
209
public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrameThatIsOutOfView () {
224
- try {
225
- driver .get (appServer .whereIs ("scrolling_tests/page_with_nested_scrolling_frames_out_of_view.html" ));
226
- driver .switchTo ().frame ("scrolling_frame" );
227
- driver .switchTo ().frame ("nested_scrolling_frame" );
228
- WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
229
- element .click ();
230
- assertTrue (element .isSelected ());
231
- } finally {
232
- driver .switchTo ().defaultContent ();
233
- }
210
+ driver .get (appServer .whereIs ("scrolling_tests/page_with_nested_scrolling_frames_out_of_view.html" ));
211
+ driver .switchTo ().frame ("scrolling_frame" );
212
+ driver .switchTo ().frame ("nested_scrolling_frame" );
213
+ WebElement element = driver .findElement (By .name ("scroll_checkbox" ));
214
+ element .click ();
215
+ assertTrue (element .isSelected ());
234
216
}
235
217
236
218
@ JavascriptEnabled
@@ -246,18 +228,15 @@ private long getScrollTop() {
246
228
return (Long )((JavascriptExecutor )driver ).executeScript ("return document.body.scrollTop;" );
247
229
}
248
230
231
+ @ NoDriverAfterTest // So that next test never starts with "inside a frame" base state.
249
232
@ Test
250
233
@ Ignore (value = {SAFARI , MARIONETTE }, reason = "Not tested" )
251
234
public void testShouldBeAbleToClickElementInATallFrame () {
252
- try {
253
- driver .get (appServer .whereIs ("scrolling_tests/page_with_tall_frame.html" ));
254
- driver .switchTo ().frame ("tall_frame" );
255
- WebElement element = driver .findElement (By .name ("checkbox" ));
256
- element .click ();
257
- assertTrue (element .isSelected ());
258
- } finally {
259
- driver .switchTo ().defaultContent ();
260
- }
235
+ driver .get (appServer .whereIs ("scrolling_tests/page_with_tall_frame.html" ));
236
+ driver .switchTo ().frame ("tall_frame" );
237
+ WebElement element = driver .findElement (By .name ("checkbox" ));
238
+ element .click ();
239
+ assertTrue (element .isSelected ());
261
240
}
262
241
263
242
}
0 commit comments