Browse Source

adjust for cdp code

George Baugh 3 tháng trước cách đây
mục cha
commit
3bc68ad476
3 tập tin đã thay đổi với 12 bổ sung3 xóa
  1. 1 1
      dist.ini
  2. 2 1
      example.pl
  3. 9 1
      lib/Playwright.pm

+ 1 - 1
dist.ini

@@ -1,5 +1,5 @@
 name = Playwright
-version = 1.401
+version = 1.431
 author = George S. Baugh <george@troglodyne.net>
 license = MIT
 copyright_holder = Troglodyne LLC

+ 2 - 1
example.pl

@@ -203,7 +203,8 @@ CDP: {
           or kill_krom_and_die($stdin, "Server never came up after 10s!");
         print "done\n";
 
-        my $handle = Playwright->new( debug => 1, cdp_uri => "http://127.0.0.1:$port" );
+        #XXX not clear that this doesn't want an http uri instead? idk
+        my $handle = Playwright->new( debug => 1, cdp_uri => "ws://127.0.0.1:$port" );
 
         # Open a new chrome instance
         my $browser = $handle->launch( headless => 1, type => 'chrome' );

+ 9 - 1
lib/Playwright.pm

@@ -719,7 +719,15 @@ sub _start_server ( $port, $cdp_uri, $timeout, $debug, $cleanup ) {
         return "REUSE";
     }
 
-    my @args = ( qq{"$node_bin"}, qq{"$server_bin"}, "--port", $port );
+    # On windows, the args will have to be handled slightly differently.
+    my @args;
+    if (IS_WIN) {
+        push(@args, qq{"$node_bin"}, qq{"$server_bin"});
+    } else {
+        push(@args, $node_bin, $server_bin);
+    }
+
+    push(@args, ( "--port", $port ));
     push(@args, "--cdp", qq{"$cdp_uri"}) if $cdp_uri;
     push(@args, $debug) if $debug;