Przeglądaj źródła

Improve debugging in CanStartBinary & RemoteConnection

Daniel Gempesaw 9 lat temu
rodzic
commit
7a64564e53

+ 21 - 2
lib/Selenium/CanStartBinary.pm

@@ -289,6 +289,26 @@ has 'window_title' => (
     }
 );
 
+=attr command
+
+Intended for internal use: this read-only attribute is built by us,
+but it can be useful after instantiation to see exactly what command
+was run to start the webdriver server.
+
+    my $f = Selenium::Firefox->new;
+    say $f->_command;
+
+=cut
+
+has '_command' => (
+    is => 'lazy',
+    init_arg => undef,
+    builder => sub {
+        my ($self) = @_;
+        return $self->_construct_command;
+    }
+);
+
 use constant IS_WIN => $^O eq 'MSWin32';
 
 sub BUILDARGS {
@@ -338,8 +358,7 @@ sub _build_binary_mode {
 
     $self->_handle_firefox_setup($port);
 
-    my $command = $self->_construct_command;
-    system($command);
+    system($self->_command);
 
     my $success = wait_until { probe_port($port) } timeout => $self->startup_timeout;
     if ($success) {

+ 1 - 1
lib/Selenium/Remote/RemoteConnection.pm

@@ -94,7 +94,7 @@ sub request {
         $content = $json->allow_nonref->utf8->encode($params);
     }
 
-    print "REQ: $method, $url, $content\n" if $self->debug;
+    print "REQ: $method, $fullurl, $content\n" if $self->debug;
 
     # HTTP request
     my $header =