浏览代码

Added support for the concept of WebElement.

Aditya Ivaturi 15 年之前
父节点
当前提交
7482e81734
共有 1 个文件被更改,包括 29 次插入0 次删除
  1. 29 0
      lib/Selenium/Remote/WebElement.pm

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

@@ -0,0 +1,29 @@
+package Selenium::Remote::WebElement;
+
+use strict;
+use warnings;
+use Data::Dumper;
+
+# This is the already instantiated Driver object, which will be passed to the
+# constructor when this class is instantiated.
+my $driver;
+
+sub new {
+    my ($class, $id, $parent) = @_;
+    $driver = $parent;
+    my $self = {
+        id => $id,
+    };
+    bless $self, $class or die "Can't bless $class: $!";
+    return $self;
+}
+
+sub click {
+    my ($self) = @_;
+    my $res = { 'command' => 'clickElement', 'id' => $self->{id} };
+    return $driver->_execute_command($res);
+}
+
+
+
+1;