Ver código fonte

Fix #136 again in the new no_content_success fashion

Daniel Gempesaw 11 anos atrás
pai
commit
9177ebd89f
2 arquivos alterados com 3 adições e 9 exclusões
  1. 1 1
      lib/Selenium/Remote/Commands.pm
  2. 2 8
      lib/Selenium/Remote/Driver.pm

+ 1 - 1
lib/Selenium/Remote/Commands.pm

@@ -72,7 +72,7 @@ has '_cmds' => (
             'setWindowSize' => {
                 'method'             => 'POST',
                 'url'                => 'session/:sessionId/window/:windowHandle/size',
-                'no_content_success' => 0
+                'no_content_success' => 1
             },
             'setWindowPosition' => {
                 'method'             => 'POST',

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

@@ -1539,10 +1539,7 @@ sub set_window_position {
     my $res = { 'command' => 'setWindowPosition', 'window_handle' => $window };
     my $params = { 'x' => $x, 'y' => $y };
     my $ret = $self->_execute_command( $res, $params );
-    if ( $ret =~ m/200|204/g ) {
-        return 1;
-    }
-    else { return 0; }
+    return $ret ? 1 : 0;
 }
 
 =head2 set_window_size
@@ -1572,10 +1569,7 @@ sub set_window_size {
     my $res = { 'command' => 'setWindowSize', 'window_handle' => $window };
     my $params = { 'height' => $height, 'width' => $width };
     my $ret = $self->_execute_command( $res, $params );
-    if ( $ret =~ m/200|204/g ) {
-        return 1;
-    }
-    else { return 0; }
+    return $ret ? 1 : 0;
 }
 
 =head2 get_all_cookies