Selenium Standalone
file
Upload a file to remote machine on which the browser is running.
Selenium Standalone command. More details can be found in the official protocol docs.
Usage
browser.file(file)
Parameters
Name | Type | Details |
---|---|---|
file | string | Base64-encoded zip archive containing single file which to upload. In case base64-encoded data does not represent a zip archive or archive contains more than one file it will throw an unknown error. |
Returns
- <String> path: Absolute path of uploaded file on remote machine.
getHubConfig
Receive hub config remotely.
Selenium Standalone command. More details can be found in the official protocol docs.
Usage
browser.getHubConfig()
Returns
- <Object> config: Returns the hub config with slotCount, timeouts and other information.
gridTestSession
Get the details of the Selenium Grid node running a session.
Selenium Standalone command. More details can be found in the official protocol docs.
Usage
browser.gridTestSession(session)
Parameters
Name | Type | Details |
---|---|---|
session | String | The id of the session to receive hub details for. |
Returns
- <Object> details: Object containing information about session details.
gridProxyDetails
Get proxy details.
Selenium Standalone command. More details can be found in the official protocol docs.
Usage
browser.gridProxyDetails(id)
Parameters
Name | Type | Details |
---|---|---|
id | string | the id of the proxy (can be received using gridTestSession command). |
Returns
- <Object> details: Object containing information about proxy.
manageSeleniumHubLifecycle
Manage lifecycle of hub node.
Selenium Standalone command. More details can be found in the official protocol docs.
Usage
browser.manageSeleniumHubLifecycle(action)
Parameters
Name | Type | Details |
---|---|---|
action | String | Command to call on Selenium Hub. The only implemented action is to 'shutdown' the hub. |
queryGrid
Send GraphQL queries to the Selenium (hub or node) server to fetch data. (Only supported with Selenium v4 Server)
Selenium Standalone command. More details can be found in the official protocol docs.
Usage
browser.queryGrid(query)
Parameters
Name | Type | Details |
---|---|---|
query | string | A GraphQL query to be send to the server. |
Example
- Asynchronous Mode
- Synchronous Mode
const result = await browser.queryGrid('{ nodesInfo { nodes { status, uri } } }');
console.log(JSON.stringify(result, null, 4))
/**
* outputs:
* {
* "data": {
* "nodesInfo": {
* "nodes": [{
* "status": "UP",
* "uri": "http://192.168.0.39:4444"
* }]
* }
* }
* }
*/
const result = browser.queryGrid('{ nodesInfo { nodes { status, uri } } }');
console.log(JSON.stringify(result, null, 4))
/**
* outputs:
* {
* "data": {
* "nodesInfo": {
* "nodes": [{
* "status": "UP",
* "uri": "http://192.168.0.39:4444"
* }]
* }
* }
* }
*/
caution
Synchronous Mode will depcrecated with Node.js v16. With an update to the
underlying Chromium version it became technically impossible to provide the
same synchronous behavior. We recommend to start transition to asynchronous
command execution. For more information, see our <a href="https://github.com/webdriverio/webdriverio/discussions/6702">RFC</a>.
Returns
- <Object> data: Result of the GraphQL query.