@@ -339,10 +339,10 @@ def get_image_url(self, selector, by=By.CSS_SELECTOR,
339
339
attribute = 'src' , by = by , timeout = timeout )
340
340
341
341
def add_text (self , selector , new_value , by = By .CSS_SELECTOR ,
342
- timeout = settings .SMALL_TIMEOUT ):
342
+ timeout = settings .LARGE_TIMEOUT ):
343
343
""" The more-reliable version of driver.send_keys()
344
344
Similar to update_text(), but won't clear the text field first. """
345
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
345
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
346
346
timeout = self ._get_new_timeout (timeout )
347
347
if page_utils .is_xpath_selector (selector ):
348
348
by = By .XPATH
@@ -382,16 +382,16 @@ def add_text(self, selector, new_value, by=By.CSS_SELECTOR,
382
382
self ._demo_mode_pause_if_active (tiny = True )
383
383
384
384
def send_keys (self , selector , new_value , by = By .CSS_SELECTOR ,
385
- timeout = settings .SMALL_TIMEOUT ):
385
+ timeout = settings .LARGE_TIMEOUT ):
386
386
""" Same as add_text() -> more reliable, but less name confusion. """
387
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
387
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
388
388
timeout = self ._get_new_timeout (timeout )
389
389
if page_utils .is_xpath_selector (selector ):
390
390
by = By .XPATH
391
391
self .add_text (selector , new_value , by = by , timeout = timeout )
392
392
393
393
def update_text_value (self , selector , new_value , by = By .CSS_SELECTOR ,
394
- timeout = settings .SMALL_TIMEOUT , retry = False ):
394
+ timeout = settings .LARGE_TIMEOUT , retry = False ):
395
395
""" This method updates an element's text value with a new value.
396
396
@Params
397
397
selector - the selector with the value to update
@@ -400,7 +400,7 @@ def update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
400
400
timeout - how long to wait for the selector to be visible
401
401
retry - if True, use jquery if the selenium text update fails
402
402
"""
403
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
403
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
404
404
timeout = self ._get_new_timeout (timeout )
405
405
if page_utils .is_xpath_selector (selector ):
406
406
by = By .XPATH
@@ -456,11 +456,11 @@ def update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
456
456
self ._demo_mode_pause_if_active (tiny = True )
457
457
458
458
def update_text (self , selector , new_value , by = By .CSS_SELECTOR ,
459
- timeout = settings .SMALL_TIMEOUT , retry = False ):
459
+ timeout = settings .LARGE_TIMEOUT , retry = False ):
460
460
""" The shorter version of update_text_value(), which
461
461
clears existing text and adds new text into the text field.
462
462
We want to keep the old version for backward compatibility. """
463
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
463
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
464
464
timeout = self ._get_new_timeout (timeout )
465
465
if page_utils .is_xpath_selector (selector ):
466
466
by = By .XPATH
@@ -746,9 +746,9 @@ def convert_to_css_selector(self, selector, by):
746
746
selector , by ))
747
747
748
748
def set_value (self , selector , new_value , by = By .CSS_SELECTOR ,
749
- timeout = settings .SMALL_TIMEOUT ):
749
+ timeout = settings .LARGE_TIMEOUT ):
750
750
""" This method uses jQuery to update a text field. """
751
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
751
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
752
752
timeout = self ._get_new_timeout (timeout )
753
753
if page_utils .is_xpath_selector (selector ):
754
754
by = By .XPATH
@@ -772,12 +772,12 @@ def set_value(self, selector, new_value, by=By.CSS_SELECTOR,
772
772
self ._demo_mode_pause_if_active ()
773
773
774
774
def jquery_update_text_value (self , selector , new_value , by = By .CSS_SELECTOR ,
775
- timeout = settings .SMALL_TIMEOUT ):
775
+ timeout = settings .LARGE_TIMEOUT ):
776
776
""" This method uses jQuery to update a text field.
777
777
If the new_value string ends with the newline character,
778
778
WebDriver will finish the call, which simulates pressing
779
779
{Enter/Return} after the text is entered. """
780
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
780
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
781
781
timeout = self ._get_new_timeout (timeout )
782
782
if page_utils .is_xpath_selector (selector ):
783
783
by = By .XPATH
@@ -805,10 +805,10 @@ def jquery_update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
805
805
self ._demo_mode_pause_if_active ()
806
806
807
807
def jquery_update_text (self , selector , new_value , by = By .CSS_SELECTOR ,
808
- timeout = settings .SMALL_TIMEOUT ):
808
+ timeout = settings .LARGE_TIMEOUT ):
809
809
""" The shorter version of jquery_update_text_value()
810
810
(The longer version remains for backwards compatibility.) """
811
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
811
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
812
812
timeout = self ._get_new_timeout (timeout )
813
813
self .jquery_update_text_value (
814
814
selector , new_value , by = by , timeout = timeout )
@@ -847,29 +847,29 @@ def hover_and_click(self, hover_selector, click_selector,
847
847
848
848
def pick_select_option_by_text (self , dropdown_selector , option ,
849
849
dropdown_by = By .CSS_SELECTOR ,
850
- timeout = settings .SMALL_TIMEOUT ):
850
+ timeout = settings .LARGE_TIMEOUT ):
851
851
""" Picks an HTML <select> option by option text. """
852
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
852
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
853
853
timeout = self ._get_new_timeout (timeout )
854
854
self ._pick_select_option (dropdown_selector , option ,
855
855
dropdown_by = dropdown_by , option_by = "text" ,
856
856
timeout = timeout )
857
857
858
858
def pick_select_option_by_index (self , dropdown_selector , option ,
859
859
dropdown_by = By .CSS_SELECTOR ,
860
- timeout = settings .SMALL_TIMEOUT ):
860
+ timeout = settings .LARGE_TIMEOUT ):
861
861
""" Picks an HTML <select> option by option index. """
862
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
862
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
863
863
timeout = self ._get_new_timeout (timeout )
864
864
self ._pick_select_option (dropdown_selector , option ,
865
865
dropdown_by = dropdown_by , option_by = "index" ,
866
866
timeout = timeout )
867
867
868
868
def pick_select_option_by_value (self , dropdown_selector , option ,
869
869
dropdown_by = By .CSS_SELECTOR ,
870
- timeout = settings .SMALL_TIMEOUT ):
870
+ timeout = settings .LARGE_TIMEOUT ):
871
871
""" Picks an HTML <select> option by option value. """
872
- if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
872
+ if self .timeout_multiplier and timeout == settings .LARGE_TIMEOUT :
873
873
timeout = self ._get_new_timeout (timeout )
874
874
self ._pick_select_option (dropdown_selector , option ,
875
875
dropdown_by = dropdown_by , option_by = "value" ,
@@ -1170,7 +1170,7 @@ def _get_new_timeout(self, timeout):
1170
1170
timeout_multiplier = 0.5
1171
1171
timeout = int (math .ceil (timeout_multiplier * timeout ))
1172
1172
return timeout
1173
- except :
1173
+ except Exception :
1174
1174
# Wrong data type for timeout_multiplier (expecting int or float)
1175
1175
return timeout
1176
1176
@@ -1185,7 +1185,7 @@ def _get_exception_message(self):
1185
1185
if exception_info :
1186
1186
try :
1187
1187
exc_message = exception_info [0 ][1 ][1 ]
1188
- except :
1188
+ except Exception :
1189
1189
exc_message = "(Unknown Exception)"
1190
1190
else :
1191
1191
exc_message = "(Unknown Exception)"
@@ -1474,7 +1474,7 @@ def _add_pytest_html_extra(self):
1474
1474
name = 'Screenshot' )
1475
1475
self ._html_report_extra .append (extra_url )
1476
1476
self ._html_report_extra .append (extra_image )
1477
- except :
1477
+ except Exception :
1478
1478
pass
1479
1479
1480
1480
def tearDown (self ):
@@ -1541,8 +1541,8 @@ def tearDown(self):
1541
1541
self .driver .quit ()
1542
1542
except AttributeError :
1543
1543
pass
1544
- except :
1545
- print ( "No driver to quit." )
1544
+ except Exception :
1545
+ pass
1546
1546
self .driver = None
1547
1547
if self .headless :
1548
1548
if self .headless_active :
@@ -1587,6 +1587,6 @@ def tearDown(self):
1587
1587
self .driver .quit ()
1588
1588
except AttributeError :
1589
1589
pass
1590
- except :
1591
- print ( "No driver to quit." )
1590
+ except Exception :
1591
+ pass
1592
1592
self .driver = None
0 commit comments