Appearance
browserstack-client • Readme | API
browserstack-client / LocalTestingBinary
Class: LocalTestingBinary
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.
Index
version — Retrieves the version of the local testing binary.
start — Starts the BrowserStackLocal daemon.
stop — Stops the BrowserStackLocal daemon.
getBinaryInstances — Retrieves a list of recent Local binary instances from the server.
getBinaryInstance — Retrieves details of a Local binary instance from the server.
disconnectBinaryInstance — Disconnects a binary instance.
Example
ts
const localTesting = new BrowserStack.LocalTestingBinary({ key: "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
new LocalTestingBinary(options)
new LocalTestingBinary(
options
?):LocalTestingBinary
Constructs a new instance of the ScreenshotsClient class.
Parameters
Parameter | Type | Description |
---|---|---|
options ? | LocalTestingBinaryOptions | Optional configuration options for the client. |
Returns
Overrides
LocalTestingClient
.constructor
Source
src/local-testing-binary.ts:68
Properties
Property | Modifier | Type | Description |
---|---|---|---|
state | public | "stopped" | "starting" | "started" | "stopping" | The last state of the BrowserStackLocal daemon command. |
options? | private | LocalTestingBinaryOptions | Optional configuration options for the client. |
Accessors
pid
get
pid():undefined
|number
Returns
undefined
| number
Source
src/local-testing-binary.ts:489
args
get
args():string
[]
Returns
string
[]
Source
src/local-testing-binary.ts:493
Methods
version()
version():
Promise
<string
>
Retrieves the version of the local testing binary.
Returns
Promise
<string
>
A promise that resolves to the version string.
Source
src/local-testing-binary.ts:94
start()
start():
Promise
<undefined
|string
>
Starts the BrowserStackLocal daemon.
Returns
Promise
<undefined
| string
>
A promise that resolves to a string if the binary starts successfully, or undefined if there is an error.
Source
src/local-testing-binary.ts:124
stop()
stop():
Promise
<undefined
|string
>
Stops the BrowserStackLocal daemon.
Returns
Promise
<undefined
| string
>
A promise that resolves to a string if the daemon stops successfully, or undefined otherwise.
Source
src/local-testing-binary.ts:153
getBinaryInstances()
getBinaryInstances(
query
?,options
?):Promise
<Object
[]>
Retrieves a list of recent Local binary instances from the server.
Parameters
Parameter | Type | Description |
---|---|---|
query ? | Omit <Object , "auth_token" > | - |
options ? | APIFetchOptions <Object > | The fetch options for the request. |
Returns
Promise
<Object
[]>
A promise that resolves to a fetch response containing the list of active Local instances.
Inherited from
LocalTestingClient
.getBinaryInstances
Source
getBinaryInstance()
getBinaryInstance(
localInstanceId
,query
?,options
?):Promise
<Object
>
Retrieves details of a Local binary instance from the server.
Parameters
Parameter | Type | Description |
---|---|---|
localInstanceId | string | The ID of the local binary instance to retrieve. |
query ? | Omit <Object , "auth_token" > | Optional query parameters for the request. |
options ? | APIFetchOptions <Object > | Optional fetch options for the request. |
Returns
Promise
<Object
>
A promise that resolves to the retrieved local binary instance.
Member Type Description id
string
Description
Unique identifier for the Local instance.
ExampleQUERTY1
string
Description
User account that started the Local instance.
Examplejohn@browserstack.com
hostname
string
Description
Hostname for the machine running the Local instance.
Examplemy-local-box
lastActiveOn
string
Description
Timestamp at which the Local instance was last active.
Example2013-03-14 16:25:45 UTC
startTime
string
Description
Timestamp at which the Local instance was started.
Example2013-03-14 16:25:45 UTC
endTime
string
Description
Timestamp at which the Local instance was terminated.
Example2013-03-14 16:25:45 UTC
disconnectReason
string
Description
Reason for termination of the Local instance.
ExampleUser terminated the instance.
commandLineParams
string
Description
Command line parameters used to start the Local instance.
Example--key <access_key> --enable-logging-for-api --local-identifier <local_identifier>
localIdentifier
string
Description
Identifier for the Local instance.
Example4207442b2b0567368956dba064c22a3235a76214
public-IP
string
Description
Public IP address of the machine running the Local instance.
Example8.8.4.4
privateIP
string
[]Example [ "127.0.0.1", "10.100.100.1" ]
Inherited from
LocalTestingClient
.getBinaryInstance
Throws
If no local binary instance is found with the specified ID.
Source
disconnectBinaryInstance()
disconnectBinaryInstance(
localInstanceId
,query
?,options
?):Promise
<string
>
Disconnects a binary instance.
Parameters
Parameter | Type | Description |
---|---|---|
localInstanceId | string | The ID of the local binary instance to disconnect. |
query ? | Omit <Object , "auth_token" > | Optional query parameters for the request. |
options ? | APIFetchOptions <Object > | Optional API fetch options. |
Returns
Promise
<string
>
A promise that resolves to a string representing the message from the server.
Inherited from
LocalTestingClient
.disconnectBinaryInstance