@@ -252,6 +252,8 @@ def testShouldHandleAlertOnPageLoad(self):
252
252
self .assertEquals ("onload" , value )
253
253
254
254
def testShouldHandleAlertOnPageLoadUsingGet (self ):
255
+ if self .driver .capabilities ['browserName' ] == 'phantomjs' :
256
+ pytest .xfail ("phantomjs driver does not support alerts" )
255
257
self .driver .get (self ._pageURL ("pageWithOnLoad" ))
256
258
257
259
alert = self ._waitForAlert ()
@@ -262,6 +264,8 @@ def testShouldHandleAlertOnPageLoadUsingGet(self):
262
264
WebDriverWait (self .driver , 3 ).until (EC .text_to_be_present_in_element ((By .TAG_NAME , "p" ), "Page with onload event handler" ))
263
265
264
266
def testShouldHandleAlertOnPageBeforeUnload (self ):
267
+ if self .driver .capabilities ['browserName' ] == 'phantomjs' :
268
+ pytest .xfail ("phantomjs driver does not support alerts" )
265
269
self .driver .get (self ._pageURL ("pageWithOnBeforeUnloadMessage" ))
266
270
267
271
element = self .driver .find_element (By .ID , "navigate" )
@@ -277,6 +281,8 @@ def testShouldHandleAlertOnPageBeforeUnload(self):
277
281
WebDriverWait (self .driver , 3 ).until (EC .title_is ("Testing Alerts" ))
278
282
279
283
def _testShouldHandleAlertOnPageBeforeUnloadAtQuit (self ):
284
+ if self .driver .capabilities ['browserName' ] == 'phantomjs' :
285
+ pytest .xfail ("phantomjs driver does not support alerts" )
280
286
# TODO: Add the ability to get a new session
281
287
self .driver .get (self ._pageURL ("pageWithOnBeforeUnloadMessage" ))
282
288
@@ -298,6 +304,8 @@ def testShouldAllowTheUserToGetTheTextOfAnAlert(self):
298
304
self .assertEqual ("cheese" , value )
299
305
300
306
def testShouldAllowTheUserToGetTheTextOfAPrompt (self ):
307
+ if self .driver .capabilities ['browserName' ] == 'phantomjs' :
308
+ pytest .xfail ("phantomjs driver does not support alerts" )
301
309
self ._loadPage ("alerts" )
302
310
self .driver .find_element (By .ID , "prompt" ).click ()
303
311
@@ -308,6 +316,8 @@ def testShouldAllowTheUserToGetTheTextOfAPrompt(self):
308
316
self .assertEquals ("Enter something" , value )
309
317
310
318
def testAlertShouldNotAllowAdditionalCommandsIfDismissed (self ):
319
+ if self .driver .capabilities ['browserName' ] == 'phantomjs' :
320
+ pytest .xfail ("phantomjs driver does not support alerts" )
311
321
self ._loadPage ("alerts" )
312
322
self .driver .find_element (By .ID , "alert" ).click ()
313
323
0 commit comments