Skip to content

Commit 9dbf31b

Browse files
committed
Better error handling
1 parent bfe8375 commit 9dbf31b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,20 @@ def add_text(self, selector, new_value, by=By.CSS_SELECTOR,
499499
element.send_keys(Keys.RETURN)
500500
if settings.WAIT_FOR_RSC_ON_PAGE_LOADS:
501501
self.wait_for_ready_state_complete()
502+
except Exception:
503+
exc_message = self._get_exception_message()
504+
update = ("Your version of ChromeDriver may be out-of-date! "
505+
"Please go to "
506+
"https://sites.google.com/a/chromium.org/chromedriver/ "
507+
"and download the latest version to your system PATH! "
508+
"Original Exception Message: %s" % exc_message)
509+
using_old_chromedriver = False
510+
if "unknown error: call function result missing" in exc_message:
511+
using_old_chromedriver = True
512+
if self.browser == 'chrome' and using_old_chromedriver:
513+
raise Exception(update)
514+
else:
515+
raise Exception(exc_message)
502516
if self.demo_mode:
503517
if self.driver.current_url != pre_action_url:
504518
self._demo_mode_pause_if_active()
@@ -541,6 +555,8 @@ def update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
541555
element = self.wait_for_element_visible(
542556
selector, by=by, timeout=timeout)
543557
element.clear()
558+
except Exception:
559+
pass # Clearing the text field first isn't critical
544560
self._demo_mode_pause_if_active(tiny=True)
545561
pre_action_url = self.driver.current_url
546562
try:

0 commit comments

Comments
 (0)