Skip to content

browserstack-clientReadme | API


browserstack-client / AutomateClient

Class: AutomateClient

AutomateClient represents a client for interacting with the BrowserStack Automate API.

Index

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

ParameterTypeDescription
options?BrowserStackOptionsOptions to customize the client.

Returns

AutomateClient

Overrides

APIClient.constructor

Source

src/automate.ts:19

Methods

recycleKey()

recycleKey(options?): Promise<Object>

Recycles the automate key.

Parameters

ParameterTypeDescription
options?APIFetchOptions<Object>The fetch options for the request.

Returns

Promise<Object>

A promise that resolves to the response of the request.

MemberTypeDescription
old_keystringExample
mkALWJIMwtzJOqyqONyq
new_keystringExample
OQMCfsukIHWoNSOWAqkv

Source

src/automate.ts:31


getPlan()

getPlan(options?): Promise<Object>

Retrieves the automate plan.

Parameters

ParameterTypeDescription
options?APIFetchOptions<Object>The fetch options for the request.

Returns

Promise<Object>

A promise that resolves with the automate plan.

MemberTypeDescription
automate_planstringDescription
Specifies your Automate plan name

Example
Automate Mobile
parallel_sessions_runningnumberDescription
Number of parallel sessions currently running

Example
0
parallel_sessions_max_allowednumberDescription
Maximum number of parallel sessions you can run

Example
0
team_parallel_sessions_max_allowednumberDescription
Maximum number of parallel sessions allowed in a team

Example
250
queued_sessionsnumberDescription
Number of sessions currently queued

Example
10
queued_sessions_max_allowednumberDescription
Maximum number of sessions that can be queued

Example
240

Source

src/automate.ts:40


getBrowsers()

getBrowsers(options?): Promise<Object & Object[]>

Retrieves the list of available browsers for BrowserStack Automate.

Parameters

ParameterTypeDescription
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

src/automate.ts:49


getProjects()

getProjects(options?): Promise<Object[]>

Retrieves the projects from the BrowserStack Automate API.

Parameters

ParameterTypeDescription
options?APIFetchOptions<Object>The fetch options for the API request.

Returns

Promise<Object[]>

A promise that resolves with the projects data.

Source

src/automate.ts:58


getProject()

getProject(projectId, options?): Promise<Object & Object>

Retrieves a project by its ID.

Parameters

ParameterTypeDescription
projectIdnumberThe 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

src/automate.ts:68


updateProject()

updateProject(projectId, body, options?): Promise<Object>

Updates a project with the specified ID.

Parameters

ParameterTypeDescription
projectIdnumberThe ID of the project to update.
bodyObjectThe request body containing the updated project details.
body.namestringDescription
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.

MemberTypeDescription
idnumberDescription
ID of your project

Example
866256
namestringDescription
Name of your project

Example
pricing_project
user_idnumberDescription
Identifier for the user

Example
256454
group_idnumberDescription
Identifier for your account or group

Example
2
sub_group_idnumberDescription
Identifier for a team in a group

Example
0
created_atstringDescription
Time at which the project was created on BrowserStack servers

Example
2020-03-11T10:14:36.000Z
updated_atstringDescription
Time at which the project was updated on BrowserStack servers

Example
2020-09-18T09:45:57.000Z

Source

src/automate.ts:90


deleteProject()

deleteProject(projectId, options?): Promise<Object>

Deletes a project with the specified ID.

Parameters

ParameterTypeDescription
projectIdnumberThe 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.

MemberTypeDescription
statusstringDescription
Status of the operation

Example
ok
messagestringDescription
Message indicating the status of the operation

Example
Project 966019 was deleted successfully.

Source

src/automate.ts:112


getBadgeKey()

getBadgeKey(projectId, options?): Promise<string>

Retrieves the badge key for a specific project.

Parameters

ParameterTypeDescription
projectIdnumberThe ID of the project.
options?APIFetchOptions<Object>Additional options for the request.

Returns

Promise<string>

A promise that resolves to the badge key.

Source

src/automate.ts:132


getBuilds()

getBuilds(query?, options?): Promise<Object[]>

Retrieves a list of builds from the BrowserStack Automate API.

Parameters

ParameterTypeDescription
query?ObjectOptional query parameters for filtering the builds.
query.projectId?numberDescription
ID of your project
query.limit?numberDescription
Specify the number of results to be displayed. The default value is 10, and the maximum value is 100
query.offset?numberDescription
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

src/automate.ts:154


getBuild()

getBuild(buildId, options?): Promise<Object>

Retrieves information about a specific build.

Parameters

ParameterTypeDescription
buildIdstringThe ID of the build.
options?APIFetchOptions<Object>Additional options for the request.

Returns

Promise<Object>

A promise that resolves to the build information.

MemberTypeValueDescription
sessionsObject & Object & Object[]--
namestring-Description
Name of your build

Example
pricing_project_build
durationnumber-Description
Duration of build execution

Example
10
status"running" | "timeout" | "failed" | "done"-
user_idnumber-Description
Identifier for the user

Example
256454
group_idnumber-Description
Identifier for your account or group

Example
2
sub_group_idnumber-Description
Identifier for a team in a group

Example
0
automation_project_idnumber-Description
ID of your project

Example
866256
hashed_idstring-Description
Hashed ID of the build

Example
4207442b2b0567368956dba064c22a3235a76214
build_tagstring-Description
Tag for the build

Example
pricing_project_build
deltaboolean-Description
Indicates whether the build is a delta build

Example
false
frameworkstring-Description
Framework used for the build

Example
selenium
test_dataRecord<string, never>-Description
Test data used for the build
created_atstring-Description
Time at which the project was created on BrowserStack servers

Example
2020-03-11T10:14:36.000Z
updated_atstring-Description
Time at which the project was updated on BrowserStack servers

Example
2020-09-18T09:45:57.000Z

Source

src/automate.ts:172


updateBuild()

updateBuild(buildId, body, options?): Promise<Object>

Updates a build in the BrowserStack Automate API.

Parameters

ParameterTypeDescription
buildIdstringThe ID of the build to update.
bodyunknownThe 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.

MemberTypeDescription
namestringDescription
Name of your build

Example
pricing_project_build
durationnumberDescription
Duration of build execution

Example
10
status"running" | "timeout" | "failed" | "done"
user_idnumberDescription
Identifier for the user

Example
256454
group_idnumberDescription
Identifier for your account or group

Example
2
sub_group_idnumberDescription
Identifier for a team in a group

Example
0
automation_project_idnumberDescription
ID of your project

Example
866256
hashed_idstringDescription
Hashed ID of the build

Example
4207442b2b0567368956dba064c22a3235a76214
build_tagstringDescription
Tag for the build

Example
pricing_project_build
deltabooleanDescription
Indicates whether the build is a delta build

Example
false
frameworkstringDescription
Framework used for the build

Example
selenium
test_dataRecord<string, never>Description
Test data used for the build
created_atstringDescription
Time at which the project was created on BrowserStack servers

Example
2020-03-11T10:14:36.000Z
updated_atstringDescription
Time at which the project was updated on BrowserStack servers

Example
2020-09-18T09:45:57.000Z

Throws

If an error occurs during the update.

Source

src/automate.ts:200


deleteBuild()

deleteBuild(buildId, options?): Promise<Object>

Deletes a build with the specified ID.

Parameters

ParameterTypeDescription
buildIdstringThe 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.

MemberTypeDescription
statusstringDescription
Status of deletion

Example
ok
messagestringDescription
Message indicating the deletion of the build

Example
Build a4fb480a55efd6b3c558afb1ee051a7c337b8ef0 was deleted successfully.

Source

src/automate.ts:228


deleteBuilds()

deleteBuilds(buildIds, options?): Promise<Object>

Deletes multiple builds from the BrowserStack Automate API.

Parameters

ParameterTypeDescription
buildIdsstring[]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.

MemberTypeDescription
messagestringDescription
Message indicating the deletion of the builds

Example
The following build(s) were deleted successfully: 83078c39baf5c12cbbfcbd26a788d05ddfad626c,55e9782d749f601d09571023f56a8f0101929428.

Source

src/automate.ts:248


getSessions()

getSessions(buildId, query?, options?): Promise<Object & Object & Object[]>

Retrieves the sessions associated with a specific build.

Parameters

ParameterTypeDescription
buildIdstringThe ID of the build.
query?ObjectOptional query parameters for filtering the sessions.
query.limit?numberDescription
Specify the number of results to be displayed. The default value is 10, and the maximum value is 100
query.offset?numberDescription
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

src/automate.ts:270


getSession()

getSession(sessionId, options?): Promise<Object & Object & Object>

Retrieves the details of a specific session.

Parameters

ParameterTypeDescription
sessionIdstringThe 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

src/automate.ts:292


updateSession()

updateSession(sessionId, body, options?): Promise<Object & Object & Object>

Updates an automate session.

Parameters

ParameterTypeDescription
sessionIdstringThe ID of the session to update.
bodyObject | ObjectThe 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

src/automate.ts:314


deleteSession()

deleteSession(sessionId, options?): Promise<Object>

Deletes a session by its session ID.

Parameters

ParameterTypeDescription
sessionIdstringThe 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.

MemberTypeDescription
statusstringDescription
Status of deletion

Example
ok
messagestringDescription
Message indicating the deletion of the session

Example
Session 4207442b2b0567368956dba064c22a3235a76214 was deleted successfully.

Source

src/automate.ts:336


deleteSessions()

deleteSessions(sessionIds, options?): Promise<Object>

Deletes the specified sessions.

Parameters

ParameterTypeDescription
sessionIdsstring[]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.

MemberTypeDescription
messagestringDescription
Message indicating the deletion of the sessions

Example
The following session(s) were deleted successfully: 83078c39baf5c12cbbfcbd26a788d05ddfad626c,55e9782d749f601d09571023f56a8f0101929428.

Source

src/automate.ts:356


uploadBuildTerminalLogs()

uploadBuildTerminalLogs(buildId, data, options?): Promise<Object>

Uploads terminal logs for a specific build.

Parameters

ParameterTypeDescription
buildIdstringThe ID of the build.
dataObject & ObjectThe 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.

MemberTypeDescription
messagestringDescription
Message indicating upload result.

Example
File has been uploaded successfully!

Source

src/automate.ts:377


uploadSessionTerminalLogs()

uploadSessionTerminalLogs(sessionId, data, options?): Promise<Object>

Uploads terminal logs for a session.

Parameters

ParameterTypeDescription
sessionIdstringThe ID of the session.
dataObject & ObjectThe 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.

MemberTypeDescription
messagestringDescription
Message indicating upload result.

Example
File has been uploaded successfully!

Source

src/automate.ts:411


getSessionLogs()

getSessionLogs(sessionId, options?): Promise<string>

Retrieves the logs for a specific session.

Parameters

ParameterTypeDescription
sessionIdstringThe 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

src/automate.ts:445


getSessionNetworkLogs()

getSessionNetworkLogs(sessionId, options?): Promise<Record<string, never>>

Retrieves the network logs for a specific session.

Parameters

ParameterTypeDescription
sessionIdstringThe 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

src/automate.ts:466


getSessionConsoleLogs()

getSessionConsoleLogs(sessionId, options?): Promise<string>

Retrieves the console logs for a specific session.

Parameters

ParameterTypeDescription
sessionIdstringThe ID of the session.
options?APIFetchOptions<Object>Additional options for the request.

Returns

Promise<string>

A Promise that resolves to the console logs.

Source

src/automate.ts:486


getSessionSeleniumLogs()

getSessionSeleniumLogs(sessionId, options?): Promise<string>

Retrieves the Selenium logs for a specific session.

Parameters

ParameterTypeDescription
sessionIdstringThe ID of the session.
options?APIFetchOptions<Object>Additional options for the request.

Returns

Promise<string>

A Promise that resolves to the Selenium logs.

Source

src/automate.ts:507


getSessionAppiumLogs()

getSessionAppiumLogs(sessionId, options?): Promise<string>

Retrieves the Appium logs for a specific session.

Parameters

ParameterTypeDescription
sessionIdstringThe ID of the session.
options?APIFetchOptions<Object>Additional options for the request.

Returns

Promise<string>

A Promise that resolves to the Appium logs.

Source

src/automate.ts:533


getSessionTelemetryLogs()

getSessionTelemetryLogs(sessionId, options?): Promise<Object>

Retrieves the telemetry logs for a specific session.

Parameters

ParameterTypeDescription
sessionIdstringThe ID of the session.
options?APIFetchOptions<Object>Additional options for the request.

Returns

Promise<Object>

A Promise that resolves with the telemetry logs.

Source

src/automate.ts:554


uploadMediaFile()

uploadMediaFile(data, options?): Promise<Object>

Uploads a media file to the BrowserStack Automate API.

Parameters

ParameterTypeDescription
dataObject & ObjectThe 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.

MemberTypeDescription
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.

Example
media://90c7a8h8dc82308108734e9a46c24d8f01de12881

Source

src/automate.ts:575


getMediaFiles()

getMediaFiles(options?): Promise<Object[]>

Retrieves the recent media files from the BrowserStack Automate API.

Parameters

ParameterTypeDescription
options?APIFetchOptions<Object>Optional fetch options for the API request.

Returns

Promise<Object[]>

A promise that resolves with the response from the API.

Source

src/automate.ts:597


deleteMediaFile()

deleteMediaFile(mediaId, options?): Promise<Object>

Deletes a media file.

Parameters

ParameterTypeDescription
mediaIdstringThe 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.

MemberTypeDescription
successbooleanDescription
Status of deletion

Example
true

Source

src/automate.ts:609