Test on Internal Networks

BrowserStack enables you to run your Selenide 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.

Note: Code samples in this guide can be found in the selenide-browserstack sample repo on GitHub

Configuring your Selenide tests for Local Testing takes just three steps:

  1. Clone the selenide-browserstack repo on GitHub with BrowserStack’s sample tests, if not already done:

     git clone https://github.com/browserstack/selenide-browserstack.git
     cd selenide-browserstack
    
  2. You will see that the following dependencies exist in your pom.xml file, which will be responsible for creating the connection between your privately hosted website and the BrowserStack cloud:
    pom.xml
     <dependency>
      <groupId>com.browserstack</groupId>
      <artifactId>browserstack-local-java</artifactId>
      <version>0.1.0</version>
     </dependency>
    
  3. Install the dependencies using maven (if not already done):

    mvn install
    
  4. Next, update your Selenide config file, local.conf.json, and set the browserstack.local capability to true:

    local.conf.json
     {
       "server": "hub-cloud.browserstack.com",
       "user":"YOUR_USERNAME",
       "key":"YOUR_ACCESS_KEY",
    
       "capabilities": {
         "name": "Bstack-[Selenide] Local Test",
         "browserstack.local": true
       },
    
       "environments": [{
         "browser": "chrome"
       }]
     }
    

    You will also need the Selenide XML file, as shown below (exists in the sample repository):

     <!-- local.testng.xml -->
     ?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
     <suite name="Local">
     	<test name="LocalTest">
     		<parameter name="config" value="local.conf.json"/>
     		<parameter name="environment" value="chrome"/>
     		<classes>
     			<class name="com.browserstack.LocalTest"/>
     		</classes>
     	</test>
     </suite>
    

    Here is a sample test case written for running local with Selenide (exists in the sample repository). We will run this test in the next step to check if the connection between your private server and BrowserStack cloud has been established or not.

    LocalTest.java
     public class LocalTest extends BrowserStackTest {
     	@Test
     	public void test() throws Exception {
     		open("http://bs-local.com:45691/check");
     		$("body").shouldHave(text("Up and running"));
     	}
     }
    
  5. You can now run your Selenide test using BrowserStack Local with the following command:

     # Run using maven
     mvn test -P local
    

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Talk to an Expert