Skip to content

Commit

Permalink
Add getWindowHandles method (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
justafish authored Oct 3, 2023
1 parent 3014d58 commit a6e7908
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/WebDriver/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,19 @@ public function deleteCookie($cookieName)
return $this;
}

/**
* Get window handles : /session/:sessionId/window_handles (GET)
* : /session/:sessionId/window/handles (GET)
* - $session->getWindowHandles()
*
* @return mixed
*/
public function getWindowHandles() {
$result = $this->curl('GET', $this->w3c ? '/window/handles' : '/window_handles');

return $result['value'];
}

/**
* Get window handle: /session/:sessionId/window (GET)
* : /session/:sessionId/window_handle (GET)
Expand Down
1 change: 1 addition & 0 deletions lib/WebDriver/Window.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function __construct($url, $windowHandle = null)

/**
* Get window handle: /session/:sessionId/window (GET)
* : /session/:sessionId/window_handle (GET)
* - $session->window($handle)->getHandle()
* - $session->window()->getHandle()
*
Expand Down

0 comments on commit a6e7908

Please sign in to comment.