فهرست منبع

Use WD context for Chrome binary startup

We can/should probably simplify things and just use `/` for the context
for Chrome, since that's what it uses by default, and we had been using
the `--url-base` as a workaround.
Daniel Gempesaw 10 سال پیش
والد
کامیت
95282e1a3f
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 4 1
      lib/Selenium/Chrome.pm
  2. 2 1
      t/CanStartBinary.t

+ 4 - 1
lib/Selenium/Chrome.pm

@@ -73,7 +73,10 @@ has '_binary_args' => (
     builder => sub {
         my ($self) = @_;
 
-        return ' --port=' . $self->port . ' --url-base=wd/hub ';
+        my $context = $self->wd_context_prefix;
+        $context =~ s{^/}{};
+
+        return ' --port=' . $self->port . ' --url-base=' . $context . ' ';
     }
 );
 

+ 2 - 1
t/CanStartBinary.t

@@ -55,7 +55,8 @@ CHROME: {
 
         my $chrome = Selenium::Chrome->new;
         ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
-        isnt( $chrome->port, 4444, 'chrome can start up its own binary');
+        isnt( $chrome->port, 4444, 'chrome can start up its own binary' );
+        like( $chrome->_binary_args, qr/--url-base=wd\/hub/, 'chrome has correct webdriver context' );
 
         ok( Selenium::CanStartBinary::probe_port( $chrome->port ), 'the chrome binary is listening on its port');
     }