Просмотр исходного кода

Merge pull request #163 from gempesaw/deprecate-drag

Drag is no longer in the JSONWireProtocol and should be deprecated.
Daniel Gempesaw 11 лет назад
Родитель
Сommit
53d0991ee4
2 измененных файлов с 11 добавлено и 12 удалено
  1. 10 11
      lib/Selenium/Remote/WebElement.pm
  2. 1 1
      t/02-webelement.t

+ 10 - 11
lib/Selenium/Remote/WebElement.pm

@@ -3,7 +3,7 @@ package Selenium::Remote::WebElement;
 # ABSTRACT: Representation of an HTML Element used by Selenium Remote Driver
 
 use Moo;
-use Carp qw(croak);
+use Carp qw(carp croak);
 
 =head1 DESCRIPTION
 
@@ -356,19 +356,18 @@ sub is_hidden {
  Usage:
     $elem->drag(216,158);
 
+ Note: DEPRECATED - drag is no longer available in the
+ JSONWireProtocol. We are working on an ActionsChains implementation,
+ but drag and drop doesn't currently work on the Webdriver side for
+ HTML5 pages. For reference, see:
+
+ http://elementalselenium.com/tips/39-drag-and-drop
+ https://gist.github.com/rcorreia/2362544
+
 =cut
 
 sub drag {
-    my ( $self, $x, $y ) = @_;
-    if ( ( not defined $x ) || ( not defined $y ) ) {
-        croak 'X & Y pixel coordinates not provided';
-    }
-    my $res = { 'command' => 'dragElement', 'id' => $self->id };
-    my $params = {
-        'x' => $x,
-        'y' => $y,
-    };
-    return $self->_execute_command( $res, $params );
+    carp 'drag is no longer available in the JSONWireProtocol and will be removed in the next version of this module';
 }
 
 =head2 get_size

+ 1 - 1
t/02-webelement.t

@@ -106,7 +106,7 @@ IMAGES: {
     my $y = $ret->{'y'};
   TODO: {
         local $TODO = "drag doesn't appear to be working currently in selenium server";
-        eval {$ret = $elem->drag(200,200);};
+        $ret = $elem->drag(200,200);
         $ret = $elem->get_element_location();
         is($ret->{'x'}, ($x+200), 'Moved to new x coord');
         is($ret->{'y'}, ($y+200), 'Moved to new y coord');