Appearance
browserstack-client • Readme | API
browserstack-client / AutomateClient
Class: AutomateClient
AutomateClient represents a client for interacting with the BrowserStack Automate API.
Index
recycleKey — Recycles the automate key.
getPlan — Retrieves the automate plan.
getBrowsers — Retrieves the list of available browsers for BrowserStack Automate.
getProjects — Retrieves the projects from the BrowserStack Automate API.
getProject — Retrieves a project by its ID.
updateProject — Updates a project with the specified ID.
deleteProject — Deletes a project with the specified ID.
getBadgeKey — Retrieves the badge key for a specific project.
getBuilds — Retrieves a list of builds from the BrowserStack Automate API.
getBuild — Retrieves information about a specific build.
updateBuild — Updates a build in the BrowserStack Automate API.
deleteBuild — Deletes a build with the specified ID.
deleteBuilds — Deletes multiple builds from the BrowserStack Automate API.
getSessions — Retrieves the sessions associated with a specific build.
getSession — Retrieves the details of a specific session.
updateSession — Updates an automate session.
deleteSession — Deletes a session by its session ID.
deleteSessions — Deletes the specified sessions.
uploadBuildTerminalLogs — Uploads terminal logs for a specific build.
uploadSessionTerminalLogs — Uploads terminal logs for a session.
getSessionLogs — Retrieves the logs for a specific session.
getSessionNetworkLogs — Retrieves the network logs for a specific session.
getSessionConsoleLogs — Retrieves the console logs for a specific session.
getSessionSeleniumLogs — Retrieves the Selenium logs for a specific session.
getSessionAppiumLogs — Retrieves the Appium logs for a specific session.
getSessionTelemetryLogs — Retrieves the telemetry logs for a specific session.
uploadMediaFile — Uploads a media file to the BrowserStack Automate API.
getMediaFiles — Retrieves the recent media files from the BrowserStack Automate API.
deleteMediaFile — Deletes a media file.
See
https://www.browserstack.com/automate/rest-api
Extends
APIClient
Constructors
new AutomateClient(options)
new AutomateClient(
options?):AutomateClient
Constructs a new instance of the AutomateClient class.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | BrowserStackOptions | Options to customize the client. |
Returns
Overrides
APIClient.constructor
Source
Methods
recycleKey()
recycleKey(
options?):Promise<Object>
Recycles the automate key.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | APIFetchOptions<Object> | The fetch options for the request. |
Returns
Promise<Object>
A promise that resolves to the response of the request.
Member Type Description old_keystringExample mkALWJIMwtzJOqyqONyqnew_keystringExample OQMCfsukIHWoNSOWAqkv
Source
getPlan()
getPlan(
options?):Promise<Object>
Retrieves the automate plan.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | APIFetchOptions<Object> | The fetch options for the request. |
Returns
Promise<Object>
A promise that resolves with the automate plan.
Member Type Description automate_planstringDescription
Specifies your Automate plan name
ExampleAutomate Mobileparallel_sessions_runningnumberDescription
Number of parallel sessions currently running
Example0parallel_sessions_max_allowednumberDescription
Maximum number of parallel sessions you can run
Example0team_parallel_sessions_max_allowednumberDescription
Maximum number of parallel sessions allowed in a team
Example250queued_sessionsnumberDescription
Number of sessions currently queued
Example10queued_sessions_max_allowednumberDescription
Maximum number of sessions that can be queued
Example240
Source
getBrowsers()
getBrowsers(
options?):Promise<Object&Object[]>
Retrieves the list of available browsers for BrowserStack Automate.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | APIFetchOptions<Object> | Optional fetch options for customizing the request. |
Returns
Promise<Object & Object[]>
A Promise that resolves to the list of available browsers.
Source
getProjects()
getProjects(
options?):Promise<Object[]>
Retrieves the projects from the BrowserStack Automate API.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | APIFetchOptions<Object> | The fetch options for the API request. |
Returns
Promise<Object[]>
A promise that resolves with the projects data.
Source
getProject()
getProject(
projectId,options?):Promise<Object&Object>
Retrieves a project by its ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectId | number | The ID of the project to retrieve. |
options? | APIFetchOptions<Object> | Additional options for the fetch request. |
Returns
Promise<Object & Object>
A promise that resolves to the retrieved project.
Source
updateProject()
updateProject(
projectId,body,options?):Promise<Object>
Updates a project with the specified ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectId | number | The ID of the project to update. |
body | Object | The request body containing the updated project details. |
body.name | string | Description Name of your project Example pricing_project |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<Object>
A promise that resolves with the updated project.
Member Type Description idnumberDescription
ID of your project
Example866256namestringDescription
Name of your project
Examplepricing_projectuser_idnumberDescription
Identifier for the user
Example256454group_idnumberDescription
Identifier for your account or group
Example2sub_group_idnumberDescription
Identifier for a team in a group
Example0created_atstringDescription
Time at which the project was created on BrowserStack servers
Example2020-03-11T10:14:36.000Zupdated_atstringDescription
Time at which the project was updated on BrowserStack servers
Example2020-09-18T09:45:57.000Z
Source
deleteProject()
deleteProject(
projectId,options?):Promise<Object>
Deletes a project with the specified ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectId | number | The ID of the project to delete. |
options? | APIFetchOptions<Object> | Additional options for the delete request. |
Returns
Promise<Object>
A promise that resolves when the project is successfully deleted.
Member Type Description statusstringDescription
Status of the operation
ExampleokmessagestringDescription
Message indicating the status of the operation
ExampleProject 966019 was deleted successfully.
Source
getBadgeKey()
getBadgeKey(
projectId,options?):Promise<string>
Retrieves the badge key for a specific project.
Parameters
| Parameter | Type | Description |
|---|---|---|
projectId | number | The ID of the project. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<string>
A promise that resolves to the badge key.
Source
getBuilds()
getBuilds(
query?,options?):Promise<Object[]>
Retrieves a list of builds from the BrowserStack Automate API.
Parameters
| Parameter | Type | Description |
|---|---|---|
query? | Object | Optional query parameters for filtering the builds. |
query.projectId? | number | Description ID of your project |
query.limit? | number | Description Specify the number of results to be displayed. The default value is 10, and the maximum value is 100 |
query.offset? | number | Description Retrieve builds from a specific point using the offset parameter |
query.status? | "running" | "timeout" | "failed" | "done" | Description Status of the build |
options? | APIFetchOptions<Object> | Optional fetch options for the API request. |
Returns
Promise<Object[]>
A Promise that resolves to an array of automation builds.
Source
getBuild()
getBuild(
buildId,options?):Promise<Object>
Retrieves information about a specific build.
Parameters
| Parameter | Type | Description |
|---|---|---|
buildId | string | The ID of the build. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<Object>
A promise that resolves to the build information.
Member Type Value Description sessionsObject&Object&Object[]- - namestring- Description
Name of your build
Examplepricing_project_builddurationnumber- Description
Duration of build execution
Example10status"running"|"timeout"|"failed"|"done"- user_idnumber- Description
Identifier for the user
Example256454group_idnumber- Description
Identifier for your account or group
Example2sub_group_idnumber- Description
Identifier for a team in a group
Example0automation_project_idnumber- Description
ID of your project
Example866256hashed_idstring- Description
Hashed ID of the build
Example4207442b2b0567368956dba064c22a3235a76214build_tagstring- Description
Tag for the build
Examplepricing_project_builddeltaboolean- Description
Indicates whether the build is a delta build
Examplefalseframeworkstring- Description
Framework used for the build
Exampleseleniumtest_dataRecord<string,never>- Description
Test data used for the buildcreated_atstring- Description
Time at which the project was created on BrowserStack servers
Example2020-03-11T10:14:36.000Zupdated_atstring- Description
Time at which the project was updated on BrowserStack servers
Example2020-09-18T09:45:57.000Z
Source
updateBuild()
updateBuild(
buildId,body,options?):Promise<Object>
Updates a build in the BrowserStack Automate API.
Parameters
| Parameter | Type | Description |
|---|---|---|
buildId | string | The ID of the build to update. |
body | unknown | The request body containing the updated build data. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<Object>
A promise that resolves to the updated build data.
Member Type Description namestringDescription
Name of your build
Examplepricing_project_builddurationnumberDescription
Duration of build execution
Example10status"running"|"timeout"|"failed"|"done"user_idnumberDescription
Identifier for the user
Example256454group_idnumberDescription
Identifier for your account or group
Example2sub_group_idnumberDescription
Identifier for a team in a group
Example0automation_project_idnumberDescription
ID of your project
Example866256hashed_idstringDescription
Hashed ID of the build
Example4207442b2b0567368956dba064c22a3235a76214build_tagstringDescription
Tag for the build
Examplepricing_project_builddeltabooleanDescription
Indicates whether the build is a delta build
ExamplefalseframeworkstringDescription
Framework used for the build
Exampleseleniumtest_dataRecord<string,never>Description
Test data used for the buildcreated_atstringDescription
Time at which the project was created on BrowserStack servers
Example2020-03-11T10:14:36.000Zupdated_atstringDescription
Time at which the project was updated on BrowserStack servers
Example2020-09-18T09:45:57.000Z
Throws
If an error occurs during the update.
Source
deleteBuild()
deleteBuild(
buildId,options?):Promise<Object>
Deletes a build with the specified ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
buildId | string | The ID of the build to delete. |
options? | APIFetchOptions<Object> | Additional options for the delete request. |
Returns
Promise<Object>
A promise that resolves when the build is successfully deleted.
Member Type Description statusstringDescription
Status of deletion
ExampleokmessagestringDescription
Message indicating the deletion of the build
ExampleBuild a4fb480a55efd6b3c558afb1ee051a7c337b8ef0 was deleted successfully.
Source
deleteBuilds()
deleteBuilds(
buildIds,options?):Promise<Object>
Deletes multiple builds from the BrowserStack Automate API.
Parameters
| Parameter | Type | Description |
|---|---|---|
buildIds | string[] | An array of build IDs to be deleted. |
options? | APIFetchOptions<Object> | Additional options for the delete request. |
Returns
Promise<Object>
A promise that resolves when the delete request is successful.
Member Type Description messagestringDescription
Message indicating the deletion of the builds
ExampleThe following build(s) were deleted successfully: 83078c39baf5c12cbbfcbd26a788d05ddfad626c,55e9782d749f601d09571023f56a8f0101929428.
Source
getSessions()
getSessions(
buildId,query?,options?):Promise<Object&Object&Object[]>
Retrieves the sessions associated with a specific build.
Parameters
| Parameter | Type | Description |
|---|---|---|
buildId | string | The ID of the build. |
query? | Object | Optional query parameters for filtering the sessions. |
query.limit? | number | Description Specify the number of results to be displayed. The default value is 10, and the maximum value is 100 |
query.offset? | number | Description Retrieve sessions from a specific point using the offset parameter |
query.status? | "running" | "timeout" | "failed" | "done" | Description Status of the session |
options? | APIFetchOptions<Object> | Optional fetch options for the request. |
Returns
Promise<Object & Object & Object[]>
A promise that resolves to an array of automation sessions.
Source
getSession()
getSession(
sessionId,options?):Promise<Object&Object&Object>
Retrieves the details of a specific session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session to retrieve. |
options? | APIFetchOptions<Object> | Additional options for the fetch request. |
Returns
Promise<Object & Object & Object>
A promise that resolves to the automation session data.
Source
updateSession()
updateSession(
sessionId,body,options?):Promise<Object&Object&Object>
Updates an automate session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session to update. |
body | Object | Object | The request body containing the updated session data. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<Object & Object & Object>
A promise that resolves to the updated automation session.
Source
deleteSession()
deleteSession(
sessionId,options?):Promise<Object>
Deletes a session by its session ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session to delete. |
options? | APIFetchOptions<Object> | Additional options for the delete request. |
Returns
Promise<Object>
A promise that resolves when the session is successfully deleted.
Member Type Description statusstringDescription
Status of deletion
ExampleokmessagestringDescription
Message indicating the deletion of the session
ExampleSession 4207442b2b0567368956dba064c22a3235a76214 was deleted successfully.
Source
deleteSessions()
deleteSessions(
sessionIds,options?):Promise<Object>
Deletes the specified sessions.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionIds | string[] | An array of session IDs to delete. |
options? | APIFetchOptions<Object> | Additional options for the delete request. |
Returns
Promise<Object>
A promise that resolves when the delete request is complete.
Member Type Description messagestringDescription
Message indicating the deletion of the sessions
ExampleThe following session(s) were deleted successfully: 83078c39baf5c12cbbfcbd26a788d05ddfad626c,55e9782d749f601d09571023f56a8f0101929428.
Source
uploadBuildTerminalLogs()
uploadBuildTerminalLogs(
buildId,data,options?):Promise<Object>
Uploads terminal logs for a specific build.
Parameters
| Parameter | Type | Description |
|---|---|---|
buildId | string | The ID of the build. |
data | Object & Object | The request body containing the logs file and its filename. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<Object>
A promise that resolves to the response of the request.
Member Type Description messagestringDescription
Message indicating upload result.
ExampleFile has been uploaded successfully!
Source
uploadSessionTerminalLogs()
uploadSessionTerminalLogs(
sessionId,data,options?):Promise<Object>
Uploads terminal logs for a session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session. |
data | Object & Object | The request body containing the logs file and filename. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<Object>
A promise that resolves to the response of the request.
Member Type Description messagestringDescription
Message indicating upload result.
ExampleFile has been uploaded successfully!
Source
getSessionLogs()
getSessionLogs(
sessionId,options?):Promise<string>
Retrieves the logs for a specific session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<string>
A promise that resolves with the logs of the session.
Source
getSessionNetworkLogs()
getSessionNetworkLogs(
sessionId,options?):Promise<Record<string,never>>
Retrieves the network logs for a specific session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session. |
options? | APIFetchOptions<Object> | Additional options for the network logs request. |
Returns
Promise<Record<string, never>>
A Promise that resolves to the network logs response.
Source
getSessionConsoleLogs()
getSessionConsoleLogs(
sessionId,options?):Promise<string>
Retrieves the console logs for a specific session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<string>
A Promise that resolves to the console logs.
Source
getSessionSeleniumLogs()
getSessionSeleniumLogs(
sessionId,options?):Promise<string>
Retrieves the Selenium logs for a specific session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<string>
A Promise that resolves to the Selenium logs.
Source
getSessionAppiumLogs()
getSessionAppiumLogs(
sessionId,options?):Promise<string>
Retrieves the Appium logs for a specific session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<string>
A Promise that resolves to the Appium logs.
Source
getSessionTelemetryLogs()
getSessionTelemetryLogs(
sessionId,options?):Promise<Object>
Retrieves the telemetry logs for a specific session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The ID of the session. |
options? | APIFetchOptions<Object> | Additional options for the request. |
Returns
Promise<Object>
A Promise that resolves with the telemetry logs.
Source
uploadMediaFile()
uploadMediaFile(
data,options?):Promise<Object>
Uploads a media file to the BrowserStack Automate API.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | Object & Object | The content of the media file to be uploaded, along with its filename. |
options? | APIFetchOptions<Object> | Additional options for the API request. |
Returns
Promise<Object>
A Promise that resolves to the response of the API request.
Member Type Description media_urlstringDescription
Unique identifier returned upon successful upload of your media file on BrowserStack. This value is used to specify the media files to be used in your tests.
Examplemedia://90c7a8h8dc82308108734e9a46c24d8f01de12881
Source
getMediaFiles()
getMediaFiles(
options?):Promise<Object[]>
Retrieves the recent media files from the BrowserStack Automate API.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | APIFetchOptions<Object> | Optional fetch options for the API request. |
Returns
Promise<Object[]>
A promise that resolves with the response from the API.
Source
deleteMediaFile()
deleteMediaFile(
mediaId,options?):Promise<Object>
Deletes a media file.
Parameters
| Parameter | Type | Description |
|---|---|---|
mediaId | string | The ID of the media file to delete. |
options? | APIFetchOptions<Object> | Additional options for the delete request. |
Returns
Promise<Object>
A promise that resolves when the media file is successfully deleted.
Member Type Description successbooleanDescription
Status of deletion
Exampletrue