diff --git a/src/ChromeDriver.php b/src/ChromeDriver.php index 3facc8a..38667e0 100644 --- a/src/ChromeDriver.php +++ b/src/ChromeDriver.php @@ -144,7 +144,6 @@ public function start() } if (isset($this->options['validateCertificate']) && $this->options['validateCertificate'] === false) { - $this->page->send('Security.enable'); $this->page->send('Security.setIgnoreCertificateErrors', ['ignore' => true]); } } @@ -239,8 +238,10 @@ public function reset() } $this->switchToWindow($this->main_window); $this->page->reset(); - $this->request_headers = []; - $this->sendRequestHeaders(); + if ($this->request_headers !== []) { + $this->request_headers = []; + $this->sendRequestHeaders(); + } } /** diff --git a/src/ChromePage.php b/src/ChromePage.php index e6c9d24..e441d2b 100644 --- a/src/ChromePage.php +++ b/src/ChromePage.php @@ -44,7 +44,6 @@ public function connect($url = null): void $this->send('Page.enable'); $this->send('DOM.enable'); $this->send('Network.enable'); - $this->send('Animation.enable'); $this->send('Animation.setPlaybackRate', ['playbackRate' => 100000]); $this->send('Console.enable'); } @@ -232,20 +231,6 @@ protected function processResponse(array $data): bool break; case 'Inspector.targetCrashed': throw new DriverException('Browser crashed'); - case 'Animation.animationStarted': - if (!empty($data['params']['source']['duration'])) { - usleep($data['params']['source']['duration'] * 10); - } - break; - case 'Security.certificateError': - if (isset($data['params']['eventId'])) { - $this->send( - 'Security.handleCertificateError', - ['eventId' => $data['params']['eventId'], 'action' => 'continue'] - ); - $this->page_ready = false; - } - break; case 'Console.messageAdded': $this->console_messages[] = $data['params']['message']; break; diff --git a/src/DevToolsConnection.php b/src/DevToolsConnection.php index 8609822..aa98bb6 100644 --- a/src/DevToolsConnection.php +++ b/src/DevToolsConnection.php @@ -147,7 +147,12 @@ protected function waitFor(callable $is_ready) } if (is_null($response)) { - return null; + // There seems to be no valid case where we could actually get an explicit `null` value from the + // underlying websocket, other than perhaps the socket being closed by Chrome. Certainly, calling code + // (which does not generally check the response) should not blindly continue at this point. + throw new DriverException( + 'Received unexpected NULL payload from Chrome websocket' + ); } if ($data = json_decode($response, true)) {