Skip to content

Documentation / local-testing-binary / LocalTestingBinary

Class: LocalTestingBinary

Defined in: local-testing-binary/src/local-testing-binary.ts:46

Represents a client for interacting with the BrowserStack Local binary and APIs. Extends features of LocalTestingClient for the node.js runtime. Download, spawn, and control the BrowserStack Local binary.

Example

ts
const localTesting = new BrowserStack.LocalTestingBinary({ accessKey: "my-key" });
await localTesting.start();
console.log(localTesting.state); // "started"
console.log(localTesting.pid); // 12345
await localTesting.stop();
console.log(localTesting.state); // "stopped"
console.log(localTesting.pid); // undefined

Extends

Constructors

Constructor

new LocalTestingBinary(options?): LocalTestingBinary

Defined in: local-testing-binary/src/local-testing-binary.ts:68

Constructs a new instance of the ScreenshotsClient class.

Parameters

ParameterTypeDescription
options?LocalTestingBinaryOptionsOptional configuration options for the client.

Returns

LocalTestingBinary

Overrides

LocalTestingClient.constructor

Properties

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
authHeader?readonlystringundefined-LocalTestingClient.authHeadercore/src/api-client.ts:50
authTokenreadonlystringundefined-LocalTestingClient.authTokenlocal-testing/src/client.ts:14
baseUrlsreadonlyobjectundefined-LocalTestingClient.baseUrlscore/src/api-client.ts:49
baseUrls.sdkpublicstringundefined--core/src/api-client.ts:49
baseUrls.sdkCloudpublicstringundefined--core/src/api-client.ts:49
binHomereadonlystringundefined--local-testing-binary/src/local-testing-binary.ts:56
commandTimeoutMsreadonlynumberundefined--local-testing-binary/src/local-testing-binary.ts:54
fetchFnreadonly{(input, init?): Promise<Response>; (input, init?): Promise<Response>; }undefined-LocalTestingClient.fetchFncore/src/api-client.ts:52
localIdentifierreadonlystringundefined--local-testing-binary/src/local-testing-binary.ts:47
registryreadonlyCodecRegistryundefined-LocalTestingClient.registrycore/src/api-client.ts:53
statepublic"stopped" | "starting" | "started" | "stopping""stopped"The last state of the BrowserStackLocal daemon command.-local-testing-binary/src/local-testing-binary.ts:62
userAgentreadonlystringundefined-LocalTestingClient.userAgentcore/src/api-client.ts:51

Accessors

args

Get Signature

get args(): string[]

Defined in: local-testing-binary/src/local-testing-binary.ts:493

Returns

string[]


pid

Get Signature

get pid(): number | undefined

Defined in: local-testing-binary/src/local-testing-binary.ts:489

Returns

number | undefined

Methods

disconnectBinaryInstance()

disconnectBinaryInstance(localInstanceId, query?, options?): Promise<string>

Defined in: local-testing/src/client.ts:98

Parameters

ParameterType
localInstanceIdstring
query?Omit<{ auth_token: string; }, "auth_token">
options?ExecuteOptions

Returns

Promise<string>

Inherited from

LocalTestingClient.disconnectBinaryInstance


disconnectInstance()

disconnectInstance(localInstanceId, authToken?, options?): Promise<{ apiVersion: string; message: string; metaData: {[key: string]: unknown; params?: {[key: string]: unknown; }; }; }>

Defined in: openapi/generated/local-testing.client.ts:67

Disconnect a Local binary instance

Parameters

ParameterType
localInstanceIdstring
authToken?string
options?ExecuteOptions

Returns

Promise<{ apiVersion: string; message: string; metaData: {[key: string]: unknown; params?: {[key: string]: unknown; }; }; }>

Inherited from

LocalTestingClient.disconnectInstance


downloadBinary()

downloadBinary(osArch, filenamePrefix?, options?): Promise<{ content: Uint8Array; filename: string; }>

Defined in: local-testing/src/client.ts:126

Parameters

ParameterTypeDefault value
osArch"win32" | "darwin-x64" | "linux-x64" | "linux-ia32" | "alpine"undefined
filenamePrefixstring"BrowserStackLocal"
options?ExecuteOptionsundefined

Returns

Promise<{ content: Uint8Array; filename: string; }>

Inherited from

LocalTestingClient.downloadBinary


execute()

protected execute<T>(spec): Promise<T>

Defined in: core/src/api-client.ts:103

Internal

Type Parameters

Type ParameterDefault type
Tunknown

Parameters

ParameterType
spec{[key: string]: unknown; baseUrl?: "sdk" | "sdkCloud"; method: HttpMethod; operationId: string; params?: { path?: Record<string, unknown>; query?: Record<string, unknown>; }; path: string; requestCodec?: string; requestCodecConfig?: unknown; requestInput?: unknown; responseCodec: string; responseCodecConfig: unknown; signal?: AbortSignal; }
spec.baseUrl?"sdk" | "sdkCloud"
spec.methodHttpMethod
spec.operationIdstring
spec.params?{ path?: Record<string, unknown>; query?: Record<string, unknown>; }
spec.params.path?Record<string, unknown>
spec.params.query?Record<string, unknown>
spec.pathstring
spec.requestCodec?string
spec.requestCodecConfig?unknown
spec.requestInput?unknown
spec.responseCodecstring
spec.responseCodecConfigunknown
spec.signal?AbortSignal

Returns

Promise<T>

Inherited from

LocalTestingClient.execute


getBinaryInstance()

getBinaryInstance(localInstanceId, query?, options?): Promise<{ commandLineParams?: string; disconnectReason?: string; email: string; endTime?: string; hostname?: string; id: string; lastActiveOn: string; localIdentifier: string; privateIP?: string[]; public-IP?: string; startTime: string; }>

Defined in: local-testing/src/client.ts:62

Parameters

ParameterType
localInstanceIdstring
query?Omit<{ auth_token: string; last?: number; state?: "running" | "all"; }, "auth_token">
options?ExecuteOptions

Returns

Promise<{ commandLineParams?: string; disconnectReason?: string; email: string; endTime?: string; hostname?: string; id: string; lastActiveOn: string; localIdentifier: string; privateIP?: string[]; public-IP?: string; startTime: string; }>

Inherited from

LocalTestingClient.getBinaryInstance


getBinaryInstances()

getBinaryInstances(query?, options?): Promise<object[]>

Defined in: local-testing/src/client.ts:36

Parameters

ParameterType
query?Omit<{ auth_token: string; last?: number; state?: "running" | "all"; }, "auth_token">
options?ExecuteOptions

Returns

Promise<object[]>

Inherited from

LocalTestingClient.getBinaryInstances


getInstance()

getInstance(localInstanceId, authToken?, options?): Promise<{ apiVersion: string; instances: object[]; metaData: {[key: string]: unknown; params?: {[key: string]: unknown; }; }; }>

Defined in: openapi/generated/local-testing.client.ts:50

Fetches details of a Local binary instance used for local testing. Note that the binary should have been started with the --enable-logging-for-api parameter.

Parameters

ParameterType
localInstanceIdstring
authToken?string
options?ExecuteOptions

Returns

Promise<{ apiVersion: string; instances: object[]; metaData: {[key: string]: unknown; params?: {[key: string]: unknown; }; }; }>

Inherited from

LocalTestingClient.getInstance


getInstances()

getInstances(authToken?, last?, state?, options?): Promise<{ apiVersion: string; instances: object[]; metaData: {[key: string]: unknown; params?: {[key: string]: unknown; }; }; }>

Defined in: openapi/generated/local-testing.client.ts:33

Fetches list of recent binary instances for local testing. Note that the binary should have been started with the --enable-logging-for-api parameter.

Parameters

ParameterType
authToken?string
last?string
state?string
options?ExecuteOptions

Returns

Promise<{ apiVersion: string; instances: object[]; metaData: {[key: string]: unknown; params?: {[key: string]: unknown; }; }; }>

Inherited from

LocalTestingClient.getInstances


start()

start(): Promise<string | undefined>

Defined in: local-testing-binary/src/local-testing-binary.ts:124

Starts the BrowserStackLocal daemon.

Returns

Promise<string | undefined>

A promise that resolves to a string if the binary starts successfully, or undefined if there is an error.


stop()

stop(): Promise<string | undefined>

Defined in: local-testing-binary/src/local-testing-binary.ts:153

Stops the BrowserStackLocal daemon.

Returns

Promise<string | undefined>

A promise that resolves to a string if the daemon stops successfully, or undefined otherwise.


version()

version(): Promise<string>

Defined in: local-testing-binary/src/local-testing-binary.ts:94

Retrieves the version of the local testing binary.

Returns

Promise<string>

A promise that resolves to the version string.