Prechádzať zdrojové kódy

Implemented command /session/:sessionId/timeouts as set_timeout, still have to add unit tests

Aditya Ivaturi 13 rokov pred
rodič
commit
e546242d4f
1 zmenil súbory, kde vykonal 31 pridanie a 0 odobranie
  1. 31 0
      lib/Selenium/Remote/Driver.pm

+ 31 - 0
lib/Selenium/Remote/Driver.pm

@@ -557,6 +557,37 @@ sub get_capabilities {
     return $self->_execute_command($res);
 }
 
+=head2 set_timeout
+
+ Description:
+    Configure the amount of time that a particular type of operation can execute
+    for before they are aborted and a |Timeout| error is returned to the client.
+ 
+ Input:
+    type - <STRING> - The type of operation to set the timeout for.
+                      Valid values are:
+                      "script"    : for script timeouts,
+                      "implicit"  : for modifying the implicit wait timeout
+                      "page load" : for setting a page load timeout.
+    ms - <NUMBER> - The amount of time, in milliseconds, that time-limited
+            commands are permitted to run.
+
+ Usage:
+    $driver->set_timeout('script', 1000);
+
+=cut
+
+sub set_timeout {
+    my ($self, $type, $ms) = @_;
+    if (not defined $type or not defined $ms)
+    {
+        return "Expecting type & timeour in ms";
+    }
+    my $res = {'command' => 'setTimeout'};
+    my $params = {'type' => $type, 'ms' => $ms};
+    return $self->_execute_command($res, $params);
+}
+
 =head2 set_async_script_timeout
 
  Description: