- Test HTML Design Folder/Directory
- Via SDK (browserstack.yml)
- Via language bindings
- Via command-line interface
- We’re sorry to hear that. Please share your feedback so we can do better
- 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
- We’re continuously improving our docs. We’d love to know what you liked
- Test Static HTML Pages
- Using Local Testing with Live
- Test localhost websites
- Test websites hosted on private or internal servers
- Website Loading Errors
- If the test website is behind a proxy
- If the test website is behind a firewall or VPN
- Test local HTTPS websites
- Test assets served from multiple internal (or public) servers
- Test HTML design folders
- Next Steps
- We’re sorry to hear that. Please share your feedback so we can do better
- 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
- We’re continuously improving our docs. We’d love to know what you liked
Test HTML Design Folder/Directory
You can test your HTML files (like newsletters or static campaign pages) with Local Testing, using —folder capability.
To enable this option, establish the Local Testing connection using one of two ways:
Via SDK (browserstack.yml)
Add the following snippet to your browserstack.yml file:
browserStackLocalOptions: f: /my/awesome/folder
browserStackLocalOptions: f: /my/awesome/folder
browserStackLocalOptions: f: /my/awesome/folder
Via language bindings
Add the following snippet to your test scripts:
bsLocalArgs.put("f", "/my/awesome/folder");
bs_local_args = 'key': ' ', 'f': '/my/awesome/folder' >
bsLocalArgs.Add(new KeyValuePairstring, string>("f", "/my/awesome/folder"));
$bs_local_args = array("key" => "", "f" => "/my/awesome/folder");
bs_local_args = "key": "" , "f": "/my/awesome/folder" >
bs_local_args = "key" => "" , "f" => "/my/awesome/folder" >
my %bs_local_args = ("key" => " ", "f" => "/my/awesome/folder");
Via command-line interface
Use the —folder flag while establishing a Local Testing connection, along with the absolute path of your HTML folder/directory.
Run the binary using the following command:
./BrowserStackLocal --key YOUR_ACCESS_KEY --folder
BrowserStackLocal.exe --key YOUR_ACCESS_KEY --folder
The remote browsers will now be able to access your HTML files and render them when the test script requests the Local Folder URL. Your Local Folder URL will be formatted as: http://username.browserstack.com.
You can also find your account’s Local Folder URL by following the steps below:
- Log in to BrowserStack and go to your account settings.
- Find “Local Folder URL” on the settings page and copy it.
- Use the Local Folder URL in your test script.
Note: Local Folder URLs can only be accessed by BrowserStack remote machines.
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
- This page has exactly what I am looking for
- This content & code samples are accurate and up-to-date
- The content on this page is easy to understand
- Other (please tell us more below)
Thank you for your valuable feedback
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
- This page has exactly what I am looking for
- This content & code samples are accurate and up-to-date
- The content on this page is easy to understand
- Other (please tell us more below)
Thank you for your valuable feedback!
We use cookies to enhance user experience, analyze site usage, and assist in our marketing efforts. By continuing to browse or closing this banner, you acknowledge that you have read and agree to our Cookie Policy, Privacy Policy and Terms of Service.
Test Static HTML Pages
There are many ways to test your static HTML pages using TestCafe, but in this recipe we will focus on two simple methods that use a few other packages and can be easily integrated into your workflow.
Install TestCafe and create tests
Install TestCafe locally in your project and create tests.
Option 1 — Test webpages in the local file system
Specify the target webpage using a relative path or the file:// URL scheme.
fixture `My fixture` .page `file:///user/my-website/index.html`
fixture `My fixture` .page `../my-website/index.html`
Add a command that runs tests to the package.json file.
This script runs tests from the ./test/acceptance/ directory in Chrome.
Option 2 — Set up a local HTTP server
that will be used as a local server.
Use the —app TestCafe option to provide a command that starts the local server. This command will be automatically executed before running tests. After tests are finished, TestCafe will stop the server.
Add the following code to package.json .
This script contains the following commands.
- «http-server ./my-website -s» — starts the local server at port 8080 with files from the ./my-website folder in silent mode. The contents of the ./my-website folder will be served at http://localhost:8080 . So, if you want to test the ./my-website/dir/page.html page, use fixture(‘. ‘).page(‘http://localhost:8080/dir/page.html’) in your fixture file.
- «testcafe chrome ./test/acceptance/**» — runs TestCafe tests from the ./test/acceptance directory in Chrome after the server starts
For more information on how to configure a test run using a testcafe command, see Command Line Interface.
TestCafe is a user-friendly end-to-end testing framework. Free and open source test runner. Powerful desktop app. Enterprise-quality web services.
© 2012–2023 Developer Express Inc. Use of this site constitutes acceptance of our Privacy Policy.
All trademarks or registered trademarks are property of their respective owners.
Using Local Testing with Live
A usage guide to test websites hosted on localhost, staging and private environments.
Test localhost websites
Once you’ve enabled Local Testing, start a Live session, and enter the website address in the remote browser’s address bar (for instance, localhost:3000 ). Browse as you would on your own device.
Note: Due to security restrictions in Safari (on iOS 10 and above), localhost URLs will automatically change to http://bs-local.com . This lets us load your website assets properly. Remember to ensure that your local server is configured to serve requests from bs-local.com
Test websites hosted on private or internal servers
You can securely test websites hosted on private or internal servers on our remote browsers and devices with Local Testing. To enable this, follow the steps below:
Start a Live session. In the toolbar dock, click on the Local Testing icon and check Resolve all URLs through my network option. This option ensures that all the requests on our remote browsers and devices are routed through your device.
Establish the Local Testing connection with a —force-local flag. This ensures that all the requests on our remote browsers and devices are routed through your device.
BrowserStackLocal --key YOUR_ACCESS_KEY --force-local
Website Loading Errors
Warning: Currently localhost is not supported on iOS (iPhone & iPad) Chrome browsers. Inorder to test your localhost website on iOS Chrome please replace localhost with bs-local.com. For e.g. Instead of using localhost:3000, please use bs-local.com:3000
In case you are not on iOS Chrome and see the local error page when trying to access a private website in a BrowserStack Live session, there is a possibility that you are behind network restrictions such as a proxy, firewall or a VPN.
If the local indicator is red, then please ensure that you have the Local Desktop Application installed and connected as per above instructions. If the local indiicator is green and you still see the error page, then there might be network restrictions on your website under test. You can try solve them by using the below listed guides on testing websites behind proxy, firewall or VPN.
If the test website is behind a proxy
In case your test website is behind a proxy, you can just add the configuration to the “Local Connection Dashboard”. Please follow this guide to learn how to test websites in environments behind one (or more) proxies
If the test website is behind a firewall or VPN
In case your test website is behind a firewall or VPN with IP restrictions, try enabling force local. Please follow this guide to learn how to test websites hosted on environments behind a firewall or VPN]
Test local HTTPS websites
You can test local websites with SSL certificates on our remote browsers and devices through Local Testing.
Once you’ve enabled Local Testing, start a Live session and enter the website address in the remote browser’s address bar (for instance: https://localhost:3000 or https://staging.example.com ). Browse as you would on your own machine.
Note: Custom/self-signed SSL certificates cannot be installed on remote browsers and devices. So when you request local websites with a custom SSL certificate, the remote browsers will show a security warning. You can manually bypass it and proceed with your testing.
Test assets served from multiple internal (or public) servers
You can test local websites with assets on multiple internal or public servers, with Local Testing. For example, staging.example. com could have content hosted on assets1.staging.example.com , certain public servers, and assets2.staging.example.com .
Once you’ve enabled Local Testing, the content will render as expected — no changes required. Just enter the website address in the remote browser’s address bar and browse as you would on your own machine. There’s no additional setup required.
Test HTML design folders
You can test your HTML files on BrowserStack, without first hosting them internally or locally with Local Testing.
Warning: This feature is currently not supported through the Local Desktop app on Windows & macOS. So, you’ll have to use the Local binary to use this feature. Learn more about using the Local binary (by selecting Other Browsers).
To enable Folder Testing, you’ll need to establish the Local Testing connection with an added –folder flag, along with the absolute path of your HTML file.
BrowserStackLocal --key YOUR_ACCESS_KEY --folder
After enabling Folder testing, you’ll need your account’s Local Folder URL. Your Local Folder URL will be formatted as http://YOUR_USERNAME.browserstack.com . This Local Folder URL can only be accessed by BrowserStack remote machines.
You can also find your account’s Local Folder URL by following the steps below:
- Log in to BrowserStack and go to your account settings.
- Find “Local Folder URL” on the settings page and copy it.
- Back in your Live session, paste the Local Folder URL in the remote browser’s address bar.
Next Steps
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
- This page has exactly what I am looking for
- This content & code samples are accurate and up-to-date
- The content on this page is easy to understand
- Other (please tell us more below)
Thank you for your valuable feedback
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
- This page has exactly what I am looking for
- This content & code samples are accurate and up-to-date
- The content on this page is easy to understand
- Other (please tell us more below)
Thank you for your valuable feedback!
We use cookies to enhance user experience, analyze site usage, and assist in our marketing efforts. By continuing to browse or closing this banner, you acknowledge that you have read and agree to our Cookie Policy, Privacy Policy and Terms of Service.