API Documentation Overview
Browsera supports REST API access for testing your websites. Using the API, you can integrate
with your source control system or test framework. Have questions? Send us an email
The response will contain a web site object which contains an "id" field. You must use this value
to create a test run object by issuing a POST request
with the header "content-type: text/xml" to the url
The response will contain an "id" field for the test run, which can be used to periodically check
the progress of the test examining the "status" field. When the "status" is 'Complete',
the test is finished and you can examine the results.
Enabling API Access
API access is not enabled by default. To enable API access for your account and get your API key, log in and click on "User Settings" in the top right corner. Then click "Enable API Access" and copy the key shown at the bottom of your account dashboard.Web sites
A web site object represents a site you plan to test. The web site object has information about the name of your site, the browsers to use, and which URLs to test. It can also contain additional parameters such as crawling options and login credentials. A web site object is required for executing a test run.Test runs
Test run objects are created for each test execution. A web site will usually have multiple test runs. To trigger a test on Browsera, you create a new test run object under a web site you wish to test. You can check the status of the test run by calling the test run viewing API and checking for the status 'Complete'. Once the test is finished, you can view all of the details of the test, such as what pages were tested, links to screenshots, and what Javascript errors have occurred.Example
Say you want to test the site example.com. First, create a web site object by issuing a POST request with the header "content-type: text/xml" to the urlhttps://api.browsera.com/v0.1a/web_sites.xml?api_key=YOUR_API_KEY
containing the content body:<?xml version="1.0" encoding="UTF-8"?> <web_site> <name>Example Website</name> <baseline_browser>Chrome 87</baseline_browser> <browsers type="array"> <browser>Internet Explorer 6</browser> <browser>Internet Explorer 7</browser> <browser>Internet Explorer 8</browser> <browser>Internet Explorer 9</browser> <browser>Safari 6</browser> <browser>Internet Explorer 10</browser> <browser>Internet Explorer 11</browser> <browser>Safari 7</browser> <browser>Safari 8</browser> <browser>Safari 9</browser> <browser>Safari 10</browser> <browser>Firefox 56</browser> <browser>Firefox 57</browser> <browser>Chrome 87</browser> </browsers> <urls type="array"> <url>http://example.com</url> </urls> <max_crawl_pages>1</max_crawl_pages> <exclude_crawl_pages type="array"> </exclude_crawl_pages> <test_runs type="array"> </test_runs> </web_site>
https://api.browsera.com/v0.1a/web_sites/ID_RETURNED_FROM_WEB_SITE/test_runs.xml?api_key=YOUR_API_KEY
with the content body:<?xml version="1.0" encoding="UTF-8"?> <test_run> <name>API Test 10-03-2024</name> <baseline_browser>Chrome 87</baseline_browser> <browsers type="array"> <browser>Internet Explorer 6</browser> <browser>Internet Explorer 7</browser> <browser>Internet Explorer 8</browser> <browser>Internet Explorer 9</browser> <browser>Safari 6</browser> <browser>Internet Explorer 10</browser> <browser>Internet Explorer 11</browser> <browser>Safari 7</browser> <browser>Safari 8</browser> <browser>Safari 9</browser> <browser>Safari 10</browser> <browser>Firefox 56</browser> <browser>Firefox 57</browser> <browser>Chrome 87</browser> </browsers> </test_run>
For more details on web sites and test runs, see the web site API documentation and test run API documentation.