ソースを参照

Fix #408: add debug flag to constructor

George S. Baugh 5 年 前
コミット
91b7833446
1 ファイル変更10 行追加0 行削除
  1. 10 0
      lib/Selenium/Remote/Driver.pm

+ 10 - 0
lib/Selenium/Remote/Driver.pm

@@ -314,6 +314,8 @@ Desired capabilities - HASH - Following options are accepted:
 
 =item B<extra_capabilities> - HASH     - Any other extra capabilities.  Accepted keys will vary by browser.  If firefox_profile is passed, the args (or profile) key will be overwritten, depending on how it was passed.
 
+=item B<debug>              - BOOL     - Turn Debug mode on from the start if true, rather than having to call debug_on().
+
 =back
 
 On WebDriver3 the 'extra_capabilities' will be automatically converted into the parameter needed by your browser.
@@ -720,6 +722,11 @@ has 'firefox_profile' => (
     clearer   => 1
 );
 
+has debug => (
+    is => 'lazy',
+    default => sub { 0 },
+);
+
 has 'desired_capabilities' => (
     is        => 'lazy',
     predicate => 'has_desired_capabilities'
@@ -780,6 +787,9 @@ sub BUILD {
         $self->set_inner_window_size(@$size);
     }
 
+    #Set debug if needed
+    $self->debug_on() if $self->debug;
+
     # Setup non-croaking, parameter versions of finders
     foreach my $by ( keys %{ $self->FINDERS } ) {
         my $finder_name = 'find_element_by_' . $by;