|
@@ -35,16 +35,18 @@ sub BUILD {
|
|
|
my $self = shift;
|
|
my $self = shift;
|
|
|
my $status;
|
|
my $status;
|
|
|
try {
|
|
try {
|
|
|
- $status = $self->request('GET','status');
|
|
|
|
|
|
|
+ $status = $self->request('GET','status');
|
|
|
}
|
|
}
|
|
|
catch {
|
|
catch {
|
|
|
croak "Could not connect to SeleniumWebDriver: $_" ;
|
|
croak "Could not connect to SeleniumWebDriver: $_" ;
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
if($status->{cmd_status} ne 'OK') {
|
|
if($status->{cmd_status} ne 'OK') {
|
|
|
# Could be grid, see if we can talk to it
|
|
# Could be grid, see if we can talk to it
|
|
|
$status = undef;
|
|
$status = undef;
|
|
|
- $status = $self->request('GET', 'grid/api/testsession');
|
|
|
|
|
|
|
+ $status = $self->request('GET', 'grid/api/hub/status');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
unless ($status->{cmd_status} eq 'OK') {
|
|
unless ($status->{cmd_status} eq 'OK') {
|
|
|
croak "Selenium server did not return proper status";
|
|
croak "Selenium server did not return proper status";
|
|
|
}
|
|
}
|
|
@@ -105,6 +107,7 @@ sub _process_response {
|
|
|
else {
|
|
else {
|
|
|
my $decoded_json = undef;
|
|
my $decoded_json = undef;
|
|
|
print "RES: ".$response->decoded_content."\n\n" if $self->debug;
|
|
print "RES: ".$response->decoded_content."\n\n" if $self->debug;
|
|
|
|
|
+
|
|
|
if (($response->message ne 'No Content') && ($response->content ne '')) {
|
|
if (($response->message ne 'No Content') && ($response->content ne '')) {
|
|
|
if ($response->content_type !~ m/json/i) {
|
|
if ($response->content_type !~ m/json/i) {
|
|
|
$data->{'cmd_return'} = 'Server returned error message '.$response->content.' instead of data';
|
|
$data->{'cmd_return'} = 'Server returned error message '.$response->content.' instead of data';
|