Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit e9a152c

Browse files
authored
Merge pull request #48 from w0rse/window-handles
feat: implement gettings all window handles
2 parents a84becd + 84dd9be commit e9a152c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Method | Description
7272
`driver.setCookie(Cookie)` | Sets a cookie on the current page's domain. `Cookie = { name, value, path='/' }`
7373
`driver.switchToDefaultFrame()` | Change focus to default content on the page.
7474
`driver.switchToFrame(indexOrNameOrId)` | Change focus to another frame on the page.
75+
`driver.getWindowHandles()` | Retrieve the list of all window handles available to the session.
7576
`driver.getCurrentWindowHandle()` | Retrieve the current window handle.
7677
`driver.switchToWindow(name)` | Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its `name` attribute.
7778
`driver.closeWindow()` | Close the current window.
@@ -132,7 +133,7 @@ Status | HTTP Method | Path | Summary
132133
![impl] | POST | `/session/:sessionId/timeouts/async_script` | Set the amount of time, in milliseconds, that asynchronous scripts executed by `/session/:sessionId/execute_async` are permitted to run before they are aborted and a `Timeout` error is returned to the client.
133134
![impl] | POST | `/session/:sessionId/timeouts/implicit_wait` | Set the amount of time the driver should wait when searching for elements.
134135
![impl] | GET | `/session/:sessionId/window_handle` | Retrieve the current window handle.
135-
![not-yet] | GET | `/session/:sessionId/window_handles` | Retrieve the list of all window handles available to the session.
136+
![impl] | GET | `/session/:sessionId/window_handles` | Retrieve the list of all window handles available to the session.
136137
![impl] | GET | `/session/:sessionId/url` | Retrieve the URL of the current page.
137138
![impl] | POST | `/session/:sessionId/url` | Navigate to a new URL.
138139
![not-yet] | POST | `/session/:sessionId/forward` | Navigate forwards in the browser history, if possible.

lib/window_api.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ module.exports = function(http) {
4949
response = http.get('/window_handle');
5050
return parseResponseData(response);
5151
},
52+
getWindowHandles: function() {
53+
var response;
54+
response = http.get('/window_handles');
55+
return parseResponseData(response);
56+
},
5257
switchToWindow: function(name) {
5358
http.post('/window', {
5459
name: name

src/window_api.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ module.exports = (http) ->
4545
response = http.get '/window_handle'
4646
parseResponseData(response)
4747

48+
getWindowHandles: ->
49+
response = http.get '/window_handles'
50+
parseResponseData(response)
51+
4852
switchToWindow: (name) ->
4953
http.post '/window', { name }
5054
return

0 commit comments

Comments
 (0)