Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upREST api on Selenium Hub #3460
Conversation
krmahadevan
referenced this pull request
Feb 4, 2017
Open
Enhance the "grid/api/hub" response to include the list of nodes wired into the Hub as well #3446
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
krmahadevan
Feb 4, 2017
Contributor
This PR represents the original work that was started off by @dima-groupon as part of #265 and later rebased and revived by @mach6
|
This PR represents the original work that was started off by @dima-groupon as part of #265 and later rebased and revived by @mach6 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
krmahadevan
Feb 4, 2017
Contributor
Here's how the apis and their corresponding responses would look like
GET endpoints:
-
/api/v1
- Description: HTML page documenting the API endpoints (this page)
- Class: org.openqa.grid.web.servlet.api.v1.ApiV1
- Usage: /api/v1
-
/api/v1/hub
- Description: Returns configuration and proxy information of the hub
- Class: org.openqa.grid.web.servlet.api.v1.HubInfo
- Usage: /api/v1/hub
-
/api/v1/nodes
- Description: List of computers connected to the HUB and the nodes on each computer
- Class: org.openqa.grid.web.servlet.api.v1.Nodes
- Usage: /api/v1/nodes
-
/api/v1/proxy
- Description: Returns configuration and capability information for the current proxy
- Class: org.openqa.grid.web.servlet.api.v1.Proxy
- Usage: /api/v1/proxy/<ID> - ID retrieved from the /node endpoint
-
/api/v1/sessions
- Description: List of currently open sessions
- Class: org.openqa.grid.web.servlet.api.v1.Sessions
- Usage: /api/v1/sessions
-
/api/v1/session
- Description: Returns details for a given session
- Class: org.openqa.grid.web.servlet.api.v1.SessionInfo
- Usage: /api/v1/sessions/ - ID retrieved from the /sessions endpoint
-
Get Hub information. http://localhost:4444/api/v1/hub
{
"configuration": {
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"newSessionWaitTimeout": -1,
"throwOnCapabilityNotPresent": true,
"cleanUpCycle": 5000,
"custom": {},
"host": "192.168.1.5",
"servlets": [],
"withoutServlets": [],
"browserTimeout": 0,
"debug": false,
"port": 4444,
"role": "hub",
"timeout": 1800
},
"nodes": [
{
"host": "192.168.1.5",
"port": 5555,
"id": "http://192.168.1.5:5555"
},
{
"host": "192.168.1.5",
"port": 6666,
"id": "http://192.168.1.5:6666"
}
],
"registrationUrl": "http://192.168.1.5:4444//grid/register/",
"consoleUrl": "http://192.168.1.5:4444//grid/console",
"newSessionRequestCount": 0,
"usedProxyCount": 2,
"totalProxyCount": 2,
"activeSessionCount": 3
}- Get list of nodes attached to the hub http://localhost:4444/api/v1/nodes
[
{
"host": "192.168.1.5",
"port": 5555,
"id": "http://192.168.1.5:5555",
"slotUsage": {
"total": 11,
"busy": 2,
"breakup": [
{
"browser": "chrome",
"usage": {
"total": 5,
"busy": 2
}
},
{
"browser": "internet explorer",
"usage": {
"total": 1,
"busy": 0
}
},
{
"browser": "firefox",
"usage": {
"total": 5,
"busy": 0
}
}
]
}
},
{
"host": "192.168.1.5",
"port": 6666,
"id": "http://192.168.1.5:6666",
"slotUsage": {
"total": 11,
"busy": 1,
"breakup": [
{
"browser": "chrome",
"usage": {
"total": 5,
"busy": 1
}
},
{
"browser": "internet explorer",
"usage": {
"total": 1,
"busy": 0
}
},
{
"browser": "firefox",
"usage": {
"total": 5,
"busy": 0
}
}
]
}
}
]- Given a Proxy Id, get details of the proxy http://localhost:4444/api/v1/proxy/http://192.168.1.5:5555
{
"isBusy": true,
"sessions": [
{
"browserName": "chrome",
"sessionId": "157569ab-e0d8-4d04-b78d-7244d9d2d0c4"
},
{
"browserName": "chrome",
"sessionId": "30c089bd-ff76-4b95-a157-78519c488986"
}
],
"java": {
"version": "1.8.0_66"
},
"os": {
"name": "Mac OS X",
"arch": "x86_64",
"version": "10.12.3"
},
"slotUsage": {
"total": 11,
"busy": 2,
"breakup": [
{
"browser": "chrome",
"usage": {
"total": 5,
"busy": 2
}
},
{
"browser": "internet explorer",
"usage": {
"total": 1,
"busy": 0
}
},
{
"browser": "firefox",
"usage": {
"total": 5,
"busy": 0
}
}
]
},
"htmlRenderer": "org.openqa.grid.selenium.proxy.WebProxyHtmlRenderer",
"build": {
"version": "3.0.1",
"revision": "unknown",
"time": "unknown"
},
"percentUsed": 40.0,
"lastSessionStart": 1486196956545,
"config": {
"hubHost": "localhost",
"hubPort": 4444,
"id": "http://192.168.1.5:5555",
"capabilities": [
{
"browserName": "chrome",
"seleniumProtocol": "WebDriver",
"maxInstances": 5,
"platform": "MAC"
},
{
"browserName": "firefox",
"seleniumProtocol": "WebDriver",
"maxInstances": 5,
"platform": "MAC"
},
{
"browserName": "internet explorer",
"seleniumProtocol": "WebDriver",
"maxInstances": 1,
"platform": "MAC"
}
],
"downPollingLimit": 2,
"hub": "http://localhost:4444/grid/register",
"nodePolling": 5000,
"nodeStatusCheckTimeout": 5000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"register": true,
"registerCycle": 5000,
"unregisterIfStillDownAfter": 60000,
"cleanUpCycle": 5000,
"custom": {},
"host": "192.168.1.5",
"maxSession": 5,
"servlets": [],
"withoutServlets": [],
"browserTimeout": 0,
"debug": false,
"port": 5555,
"role": "node",
"timeout": 1800
}
}- List all active sessions in the Hub http://localhost:4444/api/v1/sessions
{
"31006720-cddd-408d-8f65-09813b8b5cb7": {
"slotInfo": {
"host": "192.168.1.5",
"port": 6666,
"id": "http://192.168.1.5:6666"
},
"browser": "chrome"
},
"eb38d217-3445-4f03-bf58-3428d28fb130": {
"slotInfo": {
"host": "192.168.1.5",
"port": 5555,
"id": "http://192.168.1.5:5555"
},
"browser": "chrome"
},
"8e9b194d-72ce-4b69-aecf-a0672f854b57": {
"slotInfo": {
"host": "192.168.1.5",
"port": 5555,
"id": "http://192.168.1.5:5555"
},
"browser": "chrome"
}
}- Given a Session Id, get details of the session http://localhost:4444/api/v1/session/8e9b194d-72ce-4b69-aecf-a0672f854b57
{
"isForwardingRequest": false,
"proxy": {
"host": "192.168.1.5",
"port": 5555,
"nodeId": "http://192.168.1.5:5555"
},
"protocol": "WebDriver",
"lastActivityWasAt": 253698,
"isOrphaned": false,
"internalKey": "bb556e03-95c4-4abd-bbae-7fbcfe16c026",
"requestedCapabilities": {
"browserName": "chrome"
},
"requestPath": "/wd/hub"
}|
Here's how the apis and their corresponding responses would look like GET endpoints:
{
"configuration": {
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"newSessionWaitTimeout": -1,
"throwOnCapabilityNotPresent": true,
"cleanUpCycle": 5000,
"custom": {},
"host": "192.168.1.5",
"servlets": [],
"withoutServlets": [],
"browserTimeout": 0,
"debug": false,
"port": 4444,
"role": "hub",
"timeout": 1800
},
"nodes": [
{
"host": "192.168.1.5",
"port": 5555,
"id": "http://192.168.1.5:5555"
},
{
"host": "192.168.1.5",
"port": 6666,
"id": "http://192.168.1.5:6666"
}
],
"registrationUrl": "http://192.168.1.5:4444//grid/register/",
"consoleUrl": "http://192.168.1.5:4444//grid/console",
"newSessionRequestCount": 0,
"usedProxyCount": 2,
"totalProxyCount": 2,
"activeSessionCount": 3
}
[
{
"host": "192.168.1.5",
"port": 5555,
"id": "http://192.168.1.5:5555",
"slotUsage": {
"total": 11,
"busy": 2,
"breakup": [
{
"browser": "chrome",
"usage": {
"total": 5,
"busy": 2
}
},
{
"browser": "internet explorer",
"usage": {
"total": 1,
"busy": 0
}
},
{
"browser": "firefox",
"usage": {
"total": 5,
"busy": 0
}
}
]
}
},
{
"host": "192.168.1.5",
"port": 6666,
"id": "http://192.168.1.5:6666",
"slotUsage": {
"total": 11,
"busy": 1,
"breakup": [
{
"browser": "chrome",
"usage": {
"total": 5,
"busy": 1
}
},
{
"browser": "internet explorer",
"usage": {
"total": 1,
"busy": 0
}
},
{
"browser": "firefox",
"usage": {
"total": 5,
"busy": 0
}
}
]
}
}
]
{
"isBusy": true,
"sessions": [
{
"browserName": "chrome",
"sessionId": "157569ab-e0d8-4d04-b78d-7244d9d2d0c4"
},
{
"browserName": "chrome",
"sessionId": "30c089bd-ff76-4b95-a157-78519c488986"
}
],
"java": {
"version": "1.8.0_66"
},
"os": {
"name": "Mac OS X",
"arch": "x86_64",
"version": "10.12.3"
},
"slotUsage": {
"total": 11,
"busy": 2,
"breakup": [
{
"browser": "chrome",
"usage": {
"total": 5,
"busy": 2
}
},
{
"browser": "internet explorer",
"usage": {
"total": 1,
"busy": 0
}
},
{
"browser": "firefox",
"usage": {
"total": 5,
"busy": 0
}
}
]
},
"htmlRenderer": "org.openqa.grid.selenium.proxy.WebProxyHtmlRenderer",
"build": {
"version": "3.0.1",
"revision": "unknown",
"time": "unknown"
},
"percentUsed": 40.0,
"lastSessionStart": 1486196956545,
"config": {
"hubHost": "localhost",
"hubPort": 4444,
"id": "http://192.168.1.5:5555",
"capabilities": [
{
"browserName": "chrome",
"seleniumProtocol": "WebDriver",
"maxInstances": 5,
"platform": "MAC"
},
{
"browserName": "firefox",
"seleniumProtocol": "WebDriver",
"maxInstances": 5,
"platform": "MAC"
},
{
"browserName": "internet explorer",
"seleniumProtocol": "WebDriver",
"maxInstances": 1,
"platform": "MAC"
}
],
"downPollingLimit": 2,
"hub": "http://localhost:4444/grid/register",
"nodePolling": 5000,
"nodeStatusCheckTimeout": 5000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"register": true,
"registerCycle": 5000,
"unregisterIfStillDownAfter": 60000,
"cleanUpCycle": 5000,
"custom": {},
"host": "192.168.1.5",
"maxSession": 5,
"servlets": [],
"withoutServlets": [],
"browserTimeout": 0,
"debug": false,
"port": 5555,
"role": "node",
"timeout": 1800
}
}
{
"31006720-cddd-408d-8f65-09813b8b5cb7": {
"slotInfo": {
"host": "192.168.1.5",
"port": 6666,
"id": "http://192.168.1.5:6666"
},
"browser": "chrome"
},
"eb38d217-3445-4f03-bf58-3428d28fb130": {
"slotInfo": {
"host": "192.168.1.5",
"port": 5555,
"id": "http://192.168.1.5:5555"
},
"browser": "chrome"
},
"8e9b194d-72ce-4b69-aecf-a0672f854b57": {
"slotInfo": {
"host": "192.168.1.5",
"port": 5555,
"id": "http://192.168.1.5:5555"
},
"browser": "chrome"
}
}
{
"isForwardingRequest": false,
"proxy": {
"host": "192.168.1.5",
"port": 5555,
"nodeId": "http://192.168.1.5:5555"
},
"protocol": "WebDriver",
"lastActivityWasAt": 253698,
"isOrphaned": false,
"internalKey": "bb556e03-95c4-4abd-bbae-7fbcfe16c026",
"requestedCapabilities": {
"browserName": "chrome"
},
"requestPath": "/wd/hub"
} |
mach6
added
the
C-grid
label
Feb 6, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mach6
Feb 6, 2017
Member
@krmahadevan thanks for this! This is going to take a little time to vet with the Se community. I'll look at the existing work in more detail in the days to come but in the meantime, will you please add tests? Cheers!
|
@krmahadevan thanks for this! This is going to take a little time to vet with the Se community. I'll look at the existing work in more detail in the days to come but in the meantime, will you please add tests? Cheers! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
krmahadevan
Feb 24, 2017
Contributor
@mach6 - Any news on how is the review with the SE community going on ? Thought of quickly checking on this!
|
@mach6 - Any news on how is the review with the SE community going on ? Thought of quickly checking on this! |
| @@ -0,0 +1,48 @@ | ||
| package org.openqa.grid.web.servlet.api.v1; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mach6
Feb 24, 2017
Member
@krmahadevan in general, agreement that since all of these api's are GET only, it is okay and will add value -- though there is concern about the long term implications of supporting additional api's and the fact that we'll have a mixed bag of RESTful (GET) operations and RESTish (POST/DELETE/GET) operations (the existing apis).
Once we complete the tests and remaining refinement, I believe I can merge this.
|
@krmahadevan in general, agreement that since all of these api's are GET only, it is okay and will add value -- though there is concern about the long term implications of supporting additional api's and the fact that we'll have a mixed bag of RESTful (GET) operations and RESTish (POST/DELETE/GET) operations (the existing apis). Once we complete the tests and remaining refinement, I believe I can merge this. |
| JsonObject computer = new JsonObject(); | ||
| computer.addProperty("host", proxy.getRemoteHost().getHost()); | ||
| computer.addProperty("port", proxy.getRemoteHost().getPort()); | ||
| computer.addProperty("id", proxy.getId()); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mach6
Feb 24, 2017
Member
I liked it better when we were hashing the Id for the benefit of the HTTP URL. This looks silly to me http://localhost:4444/api/v1/proxy/http://192.168.1.5:5555 due to http:// ... http://
mach6
Feb 24, 2017
•
Member
I liked it better when we were hashing the Id for the benefit of the HTTP URL. This looks silly to me http://localhost:4444/api/v1/proxy/http://192.168.1.5:5555 due to http:// ... http://
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
krmahadevan
Feb 27, 2017
Contributor
Fixed this by accepting both forms viz., with and without the protocol
krmahadevan
Feb 27, 2017
Contributor
Fixed this by accepting both forms viz., with and without the protocol
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
krmahadevan
Feb 27, 2017
Contributor
@mach6 - I have added tests as well. We should now be good to get this merged.
|
@mach6 - I have added tests as well. We should now be good to get this merged. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
ping @mach6 .. Gentle reminder Doug! |
| @@ -0,0 +1,149 @@ | ||
| package org.openqa.grid.e2e.misc; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mach6
Feb 28, 2017
Member
@krmahadevan thx for the follow-up here. I left a few more new comments for your consideration
|
@krmahadevan thx for the follow-up here. I left a few more new comments for your consideration |
dima-groupon
and others
added some commits
Oct 7, 2014
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
krmahadevan
Mar 4, 2017
Contributor
@mach6 - I have consolidated the proxy end-point and the session end-point into the same thing so that it works for querying all proxies/sessions (or) for a particular proxy/session.
I would really like to get this PR wrapped up. Please let me know what else is pending on this.
|
@mach6 - I have consolidated the proxy end-point and the session end-point into the same thing so that it works for querying all proxies/sessions (or) for a particular proxy/session. I would really like to get this PR wrapped up. Please let me know what else is pending on this. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
ping @mach6 - Gentle reminder! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
ping @mach6 - Any updates on this ? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
krmahadevan
May 18, 2017
Contributor
@mach6 - Pls let me know if I should just close off this PR. I haven't heard of anything on this PR and its more than a couple of months...
|
@mach6 - Pls let me know if I should just close off this PR. I haven't heard of anything on this PR and its more than a couple of months... |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Sorry for the continued delay. please do not close |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
krmahadevan
May 26, 2017
Contributor
@mach6 - What is holding this PR ? Can you please let me know. I was hoping that this would be wrapped up a long time back.
|
@mach6 - What is holding this PR ? Can you please let me know. I was hoping that this would be wrapped up a long time back. |
krmahadevan commentedFeb 4, 2017
Xin the preceding checkbox, I verify that I have signed the Contributor License Agreement