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

Commit a86850e

Browse files
authored
Merge pull request #52 from w0rse/get-capabilities
feat: implement getting browser capabilities for current session
2 parents 74d0d2b + 42c10ff commit a86850e

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Method | Description
6767
`driver.getPageTitle()` | Returns the current page title.
6868
`driver.getPageSource()` | Returns the current page's html source.
6969
`driver.getScreenshot()` | Returns screenshot as a base64 encoded PNG.
70+
`driver.getCapabilities()` | Returns browser capabilities for current session.
7071
`driver.evaluate(javascriptString)` | Executes the given javascript. It must contain a return statement in order to get a value back.
7172
`driver.evaluateAsync(javascriptString)` | Executes the given asynchronous javascript. The executed script must signal that is done by invoking the provided callback, which is always provided as the final argument to the function.
7273
`driver.setCookie(Cookie)` | Sets a cookie on the current page's domain. `Cookie = { name, value, path='/' }`
@@ -128,7 +129,7 @@ Status | HTTP Method | Path | Summary
128129
![not-yet] | GET | `/status` | Query the server's current status.
129130
![impl] | POST | `/session` | Create a new session.
130131
![not-yet] | GET | `/sessions` | Returns a list of the currently active sessions.
131-
![not-yet] | GET | `/session/:sessionId` | Retrieve the capabilities of the specified session.
132+
![impl] | GET | `/session/:sessionId` | Retrieve the capabilities of the specified session.
132133
![impl] | DELETE | `/session/:sessionId` | Delete the session.
133134
![impl] | POST | `/session/:sessionId/timeouts` | 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.
134135
![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.

lib/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ module.exports = WebDriver = (function() {
9999
this.http["delete"]('');
100100
};
101101

102+
WebDriver.prototype.getCapabilities = function() {
103+
var response;
104+
response = this.http.get('');
105+
return parseResponseData(response);
106+
};
107+
102108
WebDriver.prototype.setTimeouts = function(type, ms) {
103109
this.http.post("/timeouts", {
104110
type: type,

src/index.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ module.exports = class WebDriver
7979
@http.delete ''
8080
return
8181

82+
getCapabilities: ->
83+
response = @http.get ''
84+
parseResponseData response
85+
8286
setTimeouts: (type, ms) ->
8387
@http.post "/timeouts", { type, ms }
8488
return

0 commit comments

Comments
 (0)