Parcourir la source

Fix windows specific startup issues: .exe suffix, localhost

- We're starting the servers on 127.0.0.1, and apparently our
  remote_server_addr default of localhost doesn't jive on Windows - we
  get some invalid pointer error messages and the LWP request never
  makes it to the webdriver binary. So, we can just manually set it in
  BUILDARGS to 127.1.

- Our _construct_command didn't account for the fact that Windows
  executables end in .EXE when File::Which gives them back to us.
Daniel Gempesaw il y a 10 ans
Parent
commit
63526761ec
1 fichiers modifiés avec 7 ajouts et 2 suppressions
  1. 7 2
      lib/Selenium/CanStartBinary.pm

+ 7 - 2
lib/Selenium/CanStartBinary.pm

@@ -30,6 +30,11 @@ sub BUILDARGS {
 
     if ( ! exists $args{remote_server_addr} && ! exists $args{port} ) {
         $args{try_binary} = 1;
+
+        # Windows may throw a fit about invalid pointers if we try to
+        # connect to localhost instead of 127.1
+        $args{remote_server_addr} = '127.0.0.1';
+
     }
 
     return { %args };
@@ -112,13 +117,13 @@ sub _construct_command {
     my ($executable, $port) = @_;
 
     my %args;
-    if ($executable =~ /chromedriver$/) {
+    if ($executable =~ /chromedriver(\.exe)?$/i) {
         %args = (
             port => $port,
             'url-base' => 'wd/hub'
         );
     }
-    elsif ($executable =~ /phantomjs$/) {
+    elsif ($executable =~ /phantomjs(\.exe)?$/i) {
         %args = (
             webdriver => '127.0.0.1:' . $port
         );