浏览代码

Fix #158: carp when drag is invoked on WebElement

Drag is no longer in the JSONWireProtocol for web elements. It doesn't
work with HTML5 elements in Webdriver, not on the binding
side. References:

https://code.google.com/p/selenium/issues/detail?id=6315
http://elementalselenium.com/tips/39-drag-and-drop
https://gist.github.com/rcorreia/2362544
Daniel Gempesaw 11 年之前
父节点
当前提交
fc7e01a06c
共有 1 个文件被更改,包括 10 次插入11 次删除
  1. 10 11
      lib/Selenium/Remote/WebElement.pm

+ 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