Test on Internal Networks
BrowserStack enables you to run automated tests on your internal development environments, on localhost, and from behind a corporate firewall. This feature is called “Local Testing”.
Local Testing establishes a secure connection between your machine and the BrowserStack cloud. Once you set up Local Testing, all URLs work out of the box, including HTTPS URLs and those behind a proxy or firewall.
Enabling Local Testing with Automate is a simple two-step process:
- Establishing a Local Testing connection.
- Configuring test scripts so they run through the Local Testing connection.
Enabling Local Testing with Automate
You can establish Local Testing connection in one of two ways:
- Language bindings
- Command-line interface
Within your test scripts, you can add a snippet that will automatically start and end the Local Testing connection. To do this, you’ll need bindings.
Following are the steps to download and install the bindings:
-
Download the
Makefile.PL
file from the GitHub repository and execute the following commands:perl Makefile.PL make make install
Note: Before you execute the test, ensure to install
JSON::Parse
library. -
Setup the Local Testing connection in your code:
use BrowserStack::Local; # Creates an instance of Local $bs_local = BrowserStack::Local::new; # You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY". my %bs_local_args = ("key" => "YOUR_ACCESS_KEY"); # Starts the Local instance with the required arguments $bs_local->start(%bs_local_args); # Check if BrowserStack local instance is running print($bs_local->isRunning()); # Stop the Local instance $bs_local->stop();
Refer to this GitHub repository for more details.
You can also start a Local Testing connection through your command-line interface by following the steps below:
- Download the appropriate binary for your system:
- Unzip the binary to a folder/directory on your machine.
- Open your command-line interface and navigate to the folder containing the Local binary.
- Run the binary using the following command:
./BrowserStackLocal --key YOUR_ACCESS_KEY
BrowserStackLocal.exe --key YOUR_ACCESS_KEY
The Local Testing setup will differ slightly based on your requirements (for example, proxy settings, restricting connections to certain domains, etc.). Refer to our complete list of flags to set up Local Testing for different environments/network configurations.
Configuring tests to run with Local Testing connection
After establishing the Local Testing connection, set browserstack.local
capability to true
by adding the following snippet to your test scripts:
"browserstack.local" => "true"
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!