Quellcode durchsuchen

implemented /sessions resource as get_sessions()

Aditya Ivaturi vor 14 Jahren
Ursprung
Commit
f04b3f7fd0
2 geänderte Dateien mit 27 neuen und 0 gelöschten Zeilen
  1. 4 0
      lib/Selenium/Remote/Commands.pm
  2. 23 0
      lib/Selenium/Remote/Driver.pm

+ 4 - 0
lib/Selenium/Remote/Commands.pm

@@ -16,6 +16,10 @@ sub new {
                           'method' => 'POST',
                           'url'    => 'session'
         },
+        'getSessions' => {
+                          'method' => 'GET',
+                          'url'    => 'sessions'
+        },
         'getCapabilities' => {
                           'method' => 'GET',
                           'url'    => 'session/:sessionId'

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

@@ -255,6 +255,29 @@ sub new_session {
     }
 }
 
+=head2 get_sessions
+
+  Description:
+    Returns a list of the currently active sessions. Each session will be
+    returned as an array of Hashes with the following keys:
+    
+    'id' : The session ID
+    'capabilities: An object describing session's capabilities
+
+  Output:
+    Array of Hashes
+
+  Usage:
+    print Dumper $driver->get_sessions();
+
+=cut
+
+sub get_sessions{
+    my ($self) = @_;
+    my $res = { 'command' => 'getSessions' };
+    return $self->_execute_command($res);
+}
+
 =head2 status
 
   Description: