Browse Source

Merge branch 'dist-zilla'

Conflicts:
	Makefile.PL
	lib/Selenium/Remote/Commands.pm
	lib/Selenium/Remote/Driver.pm
	lib/Selenium/Remote/RemoteConnection.pm
	lib/Selenium/Remote/WDKeys.pm
Charles Howes 12 years ago
parent
commit
81a6ffe3a2

+ 0 - 55
MANIFEST

@@ -1,55 +0,0 @@
-Changes
-MANIFEST
-Makefile.PL
-META.yml
-README
-lib/Selenium/Remote/Driver.pm
-lib/Selenium/Remote/WebElement.pm
-lib/Selenium/Remote/RemoteConnection.pm
-lib/Selenium/Remote/ErrorHandler.pm
-lib/Selenium/Remote/Commands.pm
-lib/Selenium/Remote/WDKeys.pm
-t/00-load.t
-t/01-driver.t
-t/02-webelement.t
-t/03-spec-coverage.t
-t/04-commands-implemented.t
-t/mock-recordings/01-driver-mock-darwin.json
-t/mock-recordings/02-webelement-mock-darwin.json
-t/mock-recordings/01-driver-mock-MSWin32.json
-t/mock-recordings/02-webelement-mock-MSWin32.json
-t/mock-recordings/01-driver-mock-linux.json
-t/mock-recordings/02-webelement-mock-linux.json
-t/http-server.pl
-t/lib/MockSeleniumWebDriver.pm
-inc/Module/AutoInstall.pm
-inc/Module/Install/AutoInstall.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Include.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
-inc/Module/Install.pm
-driver-example.pl
-ide-plugin.js
-MANIFEST.SKIP
-t/manifest.t
-t/pod.t
-t/www/404.html
-t/www/alerts.html
-t/www/cookies.html
-t/www/dragAndDropTest.html
-t/www/formPage.html
-t/www/frameset.html
-t/www/icon.gif
-t/www/iframes.html
-t/www/index.html
-t/www/javascriptPage.html
-t/www/jquery-1.3.2.js
-t/www/nestedElements.html
-t/www/popup.html
-t/www/xhtmlTest.html
-t/www/metakeys.html

+ 0 - 13
MANIFEST.SKIP

@@ -1,13 +0,0 @@
-.git.*
-blib.*
-Makefile
-Makefile.old
-Build
-Build.bat
-_build.*
-pm_to_blib.*
-.*.tar.gz
-.lwpcookies
-cover_db
-pod2htm.*.tmp
-Selenium-Remote-Driver-.*

+ 0 - 30
Makefile.PL

@@ -1,30 +0,0 @@
-use inc::Module::Install;
-
-name     'Selenium-Remote-Driver';
-all_from 'lib/Selenium/Remote/Driver.pm';
-author   q{"Aditya Ivaturi" <"ivaturi@gmail.com">};
-license  'apache';
-
-build_requires 'LWP::Protocol::PSGI';
-build_requires 'Test::More';
-requires 'LWP::UserAgent';
-requires 'HTTP::Headers';
-requires 'HTTP::Request';
-requires 'Carp';
-test_requires 'Carp' => '1.25';
-requires 'JSON';
-requires 'Net::Ping';
-requires 'MIME::Base64';
-requires 'IO::Compress::Zip';
-
-resources 'bugtracker' => 'https://github.com/aivaturi/Selenium-Remote-Driver/issues';
-resources 'repository' => {
-    type => 'git',
-    url => 'git://github.com/aivaturi/Selenium-Remote-Driver.git',
-    web => 'https://github.com/aivaturi/Selenium-Remote-Driver',
-};
-
-auto_install;
-
-WriteAll;
-

+ 44 - 0
dist.ini

@@ -0,0 +1,44 @@
+name = Selenium-Remote-Driver
+version = 0.17
+author = Aditya Ivaturi <ivaturi@gmail.com>
+license = Apache_2_0
+
+copyright_holder = Aditya Ivaturi
+
+[@Git]
+[GatherDir]
+[MakeMaker]
+[ManifestSkip]
+[Manifest]
+[MetaJSON]
+[MetaYAML]
+[PkgVersion]
+[PruneCruft]
+[PodCoverageTests]
+[PodSyntaxTests]
+[PodVersion]
+
+[TestRelease]
+[ConfirmRelease]
+[UploadToCPAN]
+
+[Prereqs / BuildRequires]
+LWP::Protocol::PSGI = 0
+Test::More = 0
+
+[Prereqs / RuntimeRequires]
+Carp = 0
+HTTP::Headers = 0
+HTTP::Request = 0
+JSON = 0
+LWP::UserAgent = 0
+Net::Ping = 0
+
+[Prereqs / TestRequires]
+Carp = 1.25
+
+[MetaResources]
+bugtracker.web = https://github.com/aivaturi/Selenium-Remote-Driver/issues
+repository.type = git
+repository.url = git://github.com/aivaturi/Selenium-Remote-Driver.git
+repository.web = https://github.com/aivaturi/Selenium-Remote-Driver

+ 8 - 5
lib/Selenium/Remote/Driver.pm

@@ -26,7 +26,7 @@ use constant FINDERS => {
       xpath             => 'xpath',
 };
 
-our $VERSION = "0.15";
+our $VERSION = "0.17";
 
 =head1 NAME
 
@@ -130,6 +130,7 @@ created when you use the find_* methods.
             'httpProxy' - <string> - OPTIONAL, ignored if proxyType is not 'manual'. Expected format: hostname.com:1234
             'sslProxy' - <string> - OPTIONAL, ignored if proxyType is not 'manual'. Expected format: hostname.com:1234
 
+
         If no values are provided, then these defaults will be assumed:
             'remote_server_addr' => 'localhost'
             'port'         => '4444'
@@ -251,13 +252,13 @@ sub _execute_command {
         my $resp = $self->{remote_conn}
           ->request( $resource->{'method'}, $resource->{'url'}, $params );
         if(ref($resp) eq 'HASH') {
-            if($resp->{cmd_status} eq 'OK') {
+            if($resp->{cmd_status} && $resp->{cmd_status} eq 'OK') {
                return $resp->{cmd_return};
             } else {
                my $msg = "Error while executing command";
                if($resp->{cmd_error}) {
                  $msg .= ": $resp->{cmd_error}" if $resp->{cmd_error};
-               } else {
+               } elsif ($resp->{cmd_return}) {
                    if(ref($resp->{cmd_return}) eq 'HASH') {
                      $msg .= ": $resp->{cmd_return}->{error}->{msg}"
                        if $resp->{cmd_return}->{error}->{msg};
@@ -305,7 +306,9 @@ sub new_session {
         $self->{session_id} = $resp->{'sessionId'};
     }
     else {
-        croak "Could not create new session";
+        my $error = 'Could not create new session';
+        $error .= ": $resp->{cmd_return}" if defined $resp->{cmd_return};
+        croak $error;
     }
 }
 
@@ -1777,7 +1780,7 @@ sub click {
   }
   my $res = { 'command' => 'click' };
   my $params = { 'button' => $button };
-  return $self->_execute_command($res,$button);
+  return $self->_execute_command($res,$params);
 }
 
 =head2 double_click

+ 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_type !~ m/json/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'};
         }

+ 13 - 0
lib/Selenium/Remote/WDKeys.pm

@@ -1,5 +1,18 @@
 package Selenium::Remote::WDKeys;
 
+=head1 NAME
+
+Selenium::Remote::WDKeys - Representation of keystrokes used by Selenium::Remote::WebDriver
+
+=cut
+
+=head1 DESCRIPTION
+
+The constant KEYS is defined here.
+
+=cut
+
+
 use strict;
 use warnings;
 

+ 1 - 0
lib/Selenium/Remote/WebElement.pm

@@ -100,6 +100,7 @@ sub submit {
 sub send_keys {
     my ($self, @strings) = @_;
     my $res = { 'command' => 'sendKeysToElement', 'id' => $self->{id} };
+    map { $_ .= "" } @strings;
     my $params = {
         'value' => \@strings,
     };