Jelajahi Sumber

Return the error message instead of dying mysteriously, see
https://github.com/aivaturi/Selenium-Remote-Driver/issues/53

Charles Howes 12 tahun lalu
induk
melakukan
0d78dbee64
1 mengubah file dengan 4 tambahan dan 0 penghapusan
  1. 4 0
      lib/Selenium/Remote/RemoteConnection.pm

+ 4 - 0
lib/Selenium/Remote/RemoteConnection.pm

@@ -92,6 +92,10 @@ sub _process_response {
         my $decoded_json = undef;
         print "RES: ".$response->decoded_content."\n\n" if $self->{debug};
         if (($response->message ne 'No Content') && ($response->content ne '')) {
+	    if ($response->content =~ m/^<html>/i) {
+		$data->{'cmd_return'} = 'Server returned error message '.$response->content.' instead of data';
+		return $data;
+	    }
             $decoded_json = $json->allow_nonref(1)->utf8(1)->decode($response->content);
             $data->{'sessionId'} = $decoded_json->{'sessionId'};
         }