소스 검색

Fix #283: die in Selenium::Waiter if you want to

George S. Baugh 5 년 전
부모
커밋
6352a49528
2개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      Changes
  2. 7 0
      lib/Selenium/Waiter.pm

+ 1 - 0
Changes

@@ -3,6 +3,7 @@ Revision history for Selenium-Remote-Driver
 1.39  10-20-2020 TEODESIAN
         [NEW FEATURES]
         - Add execute_script and execute_async_script convenience methods to WebElements.
+        - Add die flag to Selenium::Waiter
         [BUG FIXES]
         - Fix a couple more documentation issues with driver specific problems
         [REMOVALS]

+ 7 - 0
lib/Selenium/Waiter.pm

@@ -65,6 +65,11 @@ to see the massacre:
     # carps: "kept from dying" once a second for thirty seconds
     wait_until { die 'kept from dying' } debug => 1;
 
+If you want to die anyways, just pass die => 1 to wait_until instead:
+
+    # Dies on the first failure, do your own error handling:
+    wait_until { die 'oops' } die => 1;
+
 =head4 Timeouts and Intervals
 
 You can also customize the timeout, and/or the retry interval between
@@ -81,6 +86,7 @@ sub wait_until (&%) {
         timeout  => 30,
         interval => 1,
         debug    => 0,
+        die      => 0,
         @_
     };
 
@@ -99,6 +105,7 @@ sub wait_until (&%) {
         }
         catch {
             $exception = $_;
+            die $_  if $args->{die};
             warn $_ if $args->{debug};
             return '';
         }