API Documentation

Test Resource

Search our documentation:

Toggle Documentation Menu

API: Test Resource

Jump to...


List Tests

Fetch an array of all the tests in your account.

Request
GEThttps://api.ghostinspector.com/v1/tests/?apiKey=<apiKey>
Parameters
apiKey
Your API key provided in your account
Response
{
  "code": "SUCCESS",
  "data": [
    {
      "_id": "5967e6fbbfebc5ba07c5b0e4",
      "startUrl": "https://ghostinspector.com",
      "suite": {
        "_id": "5967e6e7bfebc5ba07c5b0e3",
        "name": "API Samples"
      },
      "organization": {
        "_id": "547fb82d92423992d52a4fea",
        "name": "Sample Organization"
      },
      "dateCreated": "2017-07-13T21:32:43.549Z",
      "dateUpdated": "2017-07-13T21:33:37.548Z",
      "dateExecutionFinished": "2017-07-13T21:49:48.304Z",
      "dateExecutionStarted": "2017-07-13T21:49:38.805Z",
      "screenshotComparePassing": true,
      "screenshotCompareThreshold": 0.1,
      "screenshotCompareEnabled": null,
      "passing": true,
      "failOnJavaScriptError": null,
      "autoRetry": null,
      "finalDelay": 5000,
      "maxAjaxDelay": 10000,
      "maxWaitDelay": 15000,
      "globalStepDelay": 250,
      "httpHeaders": [],
      "testFrequencyAdvanced": [],
      "testFrequency": 0,
      "name": "Test #1"
    },
    {
      "_id": "5967e75abfebc5ba07c5b0e7",
      "startUrl": "http://ghostinspector.com/docs/",
      "suite": {
        "_id": "5967e6e7bfebc5ba07c5b0e3",
        "name": "API Samples"
      },
      "organization": {
        "_id": "547fb82d92423992d52a4fea",
        "name": "Sample Organization"
      },
      "dateCreated": "2017-07-13T21:34:18.425Z",
      "dateUpdated": "2017-07-13T21:36:08.523Z",
      "dateExecutionFinished": "2017-07-13T21:49:53.568Z",
      "dateExecutionStarted": "2017-07-13T21:49:42.657Z",
      "screenshotComparePassing": true,
      "screenshotCompareThreshold": 0.1,
      "screenshotCompareEnabled": null,
      "passing": true,
      "failOnJavaScriptError": null,
      "autoRetry": null,
      "finalDelay": 5000,
      "maxAjaxDelay": 10000,
      "maxWaitDelay": 15000,
      "globalStepDelay": 250,
      "httpHeaders": [],
      "testFrequencyAdvanced": [],
      "testFrequency": 0,
      "name": "Test #2"
    }
  ]
}


Get Test

Fetch a single test

Request
GEThttps://api.ghostinspector.com/v1/tests/<testId>/?apiKey=<apiKey>
Parameters
apiKey
Your API key provided in your account
testId
The ID of the test to fetch
Response
{
  "code": "SUCCESS",
  "data": {
    "_id": "5967e75abfebc5ba07c5b0e7",
    "startUrl": "http://ghostinspector.com/docs/",
    "suite": {
      "_id": "5967e6e7bfebc5ba07c5b0e3",
      "name": "API Samples"
    },
    "organization": {
      "_id": "547fb82d92423992d52a4fea",
      "name": "Sample Organization"
    },
    "dateCreated": "2017-07-13T21:34:18.425Z",
    "dateUpdated": "2017-07-13T21:36:08.523Z",
    "dateExecutionFinished": "2017-07-13T21:49:53.568Z",
    "dateExecutionStarted": "2017-07-13T21:49:42.657Z",
    "screenshotComparePassing": true,
    "screenshotCompareThreshold": 0.1,
    "screenshotCompareEnabled": null,
    "passing": true,
    "filters": [],
    "steps": [
      {
        "command": "assign",
        "target": ".header-search-input",
        "value": "frames",
        "variableName": "",
        "optional": false,
        "private": false,
        "sequence": 0
      },
      {
        "command": "click",
        "target": ".header-search-button",
        "value": "",
        "variableName": "",
        "optional": false,
        "private": false,
        "sequence": 1
      },
      {
        "command": "assertTextPresent",
        "target": ".content .search-input",
        "value": "frames",
        "variableName": "",
        "optional": false,
        "private": false,
        "sequence": 2
      }
    ],
    "failOnJavaScriptError": null,
    "autoRetry": null,
    "finalDelay": 5000,
    "maxAjaxDelay": 10000,
    "maxWaitDelay": 15000,
    "globalStepDelay": 250,
    "httpHeaders": [],
    "testFrequencyAdvanced": [],
    "testFrequency": 0,
    "name": "Test #2"
  }
}


Execute Test

Execute a single test in your account and return the result.

Note: Test are executed in real time so this request can take some time to return. We’d suggest programming your request to deal with response times of up to 11 minutes. Tests are currently limited to 10 minutes of run time.
Request
GET or POSThttps://api.ghostinspector.com/v1/tests/<testId>/execute/?apiKey=<apiKey>&startUrl=<startUrl>
Parameters
apiKey
Your API key provided in your account
testId
The ID of the test to execute
startUrl
(Optional) Alternate start URL to use for this execution only
browser
(Optional) Alternate browser to use for this execution. The following options are available: firefox (default), firefox-<version> specific version of Firefox, for example firefox-57, chrome (paid plans only), phantomjs
viewport
(Optional) Alternate screen size to use for this execution only. This should be a string formatted as {width}x{height}, for example 1024x768.
userAgent
(Optional) Alternate user agent to use for this execution only
region
(Optional) Geo-location for test execution. The following options are available: us-east-1 (default), us-west-1, ca-central-1, eu-central-1, eu-west-1, eu-west-2, eu-west-3, ap-northeast-1, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-south-1, sa-east-1
httpAuthUsername
(Optional) Alternate HTTP authentication username to use for this execution only
httpAuthPassword
(Optional) Alternate HTTP authentication password to use for this execution only
webhook
(Optional) An escaped URL (or array of URLs) added to the webhooks list for this execution only
disableNotifications
(Optional) Use 1 to disable all notifications for this execution only
immediate
(Optional) Use 1 to initiate the execution, then immediate return a response (without results)
dataFile
(Optional) A CSV file containing a row of variable values for each test run as outlined in our data-driven testing section. A POST request must be used when sending this file. When included, an array of test results will be returned, instead of a single result.
slackChannel
(Optional) Specify the Slack channel to notify for this test run. Note that the value must be myChannel or %23myChannel and not #myChannel.
[varName]
(Optional) Pass in custom variables for the test run that are accessible in your steps via {{varName}}. For example, including &firstName=Justin in the API call will create a {{firstName}} variable with the value Justin.
Request Examples using cURL
Note: in all cases POST variables will override GET parameters.
GET Request with Parameters:
curl https://api.ghostinspector.com/v1/tests/<testId>/execute/?apiKey=<key>&startUrl=<url>

POST Request with Parameters:
curl -d "apiKey=<key>" -d "startUrl=<url>" https://api.ghostinspector.com/v1/tests/<testId>/execute/

POST Request with JSON body:
curl -H 'Content-Type: application/json' -d '{"apiKey": "key", "startUrl": "https://ghostinspector.com", "myVar": 99}' https://api.ghostinspector.com/v1/tests/<testId>/execute/

POST Multipart Form Request with CSV File:
curl -F "apiKey=<key>" -F "dataFile=@vars.csv" https://api.ghostinspector.com/v1/tests/<testId>/execute/
Response
{
  "code": "SUCCESS",
  "data": {
    "_id": "5967ee29d078e8ba058b2458",
    "uuid": "a5243051-f997-40a7-86ae-1e4069f10748",
    "test": {
      "_id": "5967e75abfebc5ba07c5b0e7",
      "suite": "5967e6e7bfebc5ba07c5b0e3",
      "organization": "547fb82d92423992d52a4fea",
      "name": "Test #2"
    },
    "suiteResult": null,
    "name": "Test #2",
    "browser": "slimerjs-52",
    "globalStepDelay": 250,
    "maxWaitDelay": 15000,
    "maxAjaxDelay": 10000,
    "finalDelay": 5000,
    "autoRetry": true,
    "failOnJavaScriptError": false,
    "screenshotCompareEnabled": true,
    "screenshotCompareThreshold": 0.1,
    "startUrl": "http://ghostinspector.com/docs/",
    "region": "us-east-1",
    "dateExecutionStarted": "2017-07-13T22:03:23.374Z",
    "executionHost": "prod012.ghostinspector.net",
    "dateExecutionFinished": "2017-07-13T22:03:34.310Z",
    "endUrl": "https://ghostinspector.com/docs/?q=frames",
    "executionTime": 10936,
    "extractions": {
      "pageTitle": "Documentation - Ghost Inspector"
    },
    "screenshot": {
      "small": {
        "path": "/screenshots/a5243051-f997-40a7-86ae-1e4069f10748-small.png",
        "defaultUrl": "https://ghostinspector-prod.s3.amazonaws.com/screenshots/a5243051-f997-40a7-86ae-1e4069f10748-small.png",
        "dims": {
          "w": 320,
          "h": 698
        },
        "size": 92213
      },
      "original": {
        "path": "/screenshots/a5243051-f997-40a7-86ae-1e4069f10748-original.png",
        "defaultUrl": "https://ghostinspector-prod.s3.amazonaws.com/screenshots/a5243051-f997-40a7-86ae-1e4069f10748-original.png",
        "dims": {
          "w": 1024,
          "h": 2232
        },
        "size": 237173
      }
    },
    "screenshotCompareBaselineResult": "5967ee09bfebc5ba07c5b0f0",
    "dateCreated": "2017-07-13T22:03:21.224Z",
    "video": {
      "path": "/videos/a5243051-f997-40a7-86ae-1e4069f10748.mp4",
      "url": "https://ghostinspector-prod.s3.amazonaws.com/videos/a5243051-f997-40a7-86ae-1e4069f10748.mp4",
      "dims": {
        "w": 1024,
        "h": 768
      }
    },
    "screenshotCompareDifference": 0.001,
    "screenshotComparePassing": true,
    "passing": true,
    "console": [
      {
        "output": "Sample console error...",
        "error": false,
        "url": "https://ghostinspector.com/docs/?q=frames",
        "dateExecuted": "2017-07-13T22:03:27.288Z"
      }
    ],
    "urls": [
      "http://ghostinspector.com/docs/",
      "https://ghostinspector.com/docs/?q=frames"
    ],
    "filters": [],
    "steps": [
      {
        "command": "assign",
        "target": ".header-search-input",
        "value": "frames",
        "variableName": "",
        "url": "https://ghostinspector.com/docs/",
        "dateExecuted": "2017-07-13T22:03:26.503Z",
        "passing": true,
        "optional": false,
        "private": false,
        "sequence": 0
      },
      {
        "command": "click",
        "target": ".header-search-button",
        "value": "",
        "variableName": "",
        "url": "https://ghostinspector.com/docs/",
        "dateExecuted": "2017-07-13T22:03:26.982Z",
        "passing": true,
        "optional": false,
        "private": false,
        "sequence": 1
      },
      {
        "command": "assertTextPresent",
        "target": ".content .search-input",
        "value": "frames",
        "variableName": "",
        "url": "https://ghostinspector.com/docs/?q=frames",
        "dateExecuted": "2017-07-13T22:03:28.236Z",
        "passing": true,
        "optional": false,
        "private": false,
        "sequence": 2
      },
      {
        "command": "extract",
        "target": "title",
        "value": "",
        "variableName": "pageTitle",
        "url": "https://ghostinspector.com/docs/?q=frames",
        "extracted": "Documentation - Ghost Inspector",
        "dateExecuted": "2017-07-13T22:03:28.695Z",
        "passing": true,
        "optional": false,
        "private": false,
        "sequence": 3
      }
    ],
    "viewportSize": {
      "height": 768,
      "width": 1024
    },
    "user": {
      "_id": "52df0d27fbaced54db000006",
      "name": "Sample User"
    }
  }
}


Duplicate Test

Duplicate a test within your account, return the new test. The new test will be duplicated within the same Suite as the original.

Request
GET or POSThttps://api.ghostinspector.com/v1/tests/<testId>/duplicate/?apiKey=<apiKey>
Parameters
apiKey
Your API key provided in your account
testId
The ID of the test to duplicate
Response
{
    "code": "SUCCESS",
    "data": {
        "user": "59fcf3db937eed176d5d28dc",
        "startUrl": "http://ghostinspector.com/docs/",
        "suite": {
          "_id": "59fcf3e9937eed176d5d28e0",
          "name": "API Samples"
        },
        "organization": {
          "_id": "59fcf3dc937eed176d5d28dd",
          "name": "Sample Organization"
        },
        "__v": 0,
        "_id": "59fcf45e13df81176e885d29",
        "dateCreated": "2017-11-03T22:57:34.733Z",
        "dateUpdated": "2017-11-03T22:57:34.733Z",
        "dateExecutionFinished": "1970-01-01T00:00:00.000Z",
        "dateExecutionStarted": "1970-01-01T00:00:00.000Z",
        "dateExecutionTriggered": "1970-01-01T00:00:00.000Z",
        "screenshotComparePassing": null,
        "screenshotCompareThreshold": 0.1,
        "screenshotCompareEnabled": null,
        "passing": null,
        "filters": [],
        "steps": [
          {
            "command": "assign",
            "target": ".header-search-input",
            "value": "frames",
            "variableName": "",
            "optional": false,
            "private": false,
            "sequence": 0
          },
          {
            "command": "click",
            "target": ".header-search-button",
            "value": "",
            "variableName": "",
            "optional": false,
            "private": false,
            "sequence": 1
          },
          {
            "command": "assertTextPresent",
            "target": ".content .search-input",
            "value": "frames",
            "variableName": "",
            "optional": false,
            "private": false,
            "sequence": 2
          }
        ],
        "failOnJavaScriptError": null,
        "autoRetry": null,
        "finalDelay": 5000,
        "maxAjaxDelay": 10000,
        "maxWaitDelay": 15000,
        "globalStepDelay": 250,
        "httpHeaders": [],
        "testFrequencyAdvanced": [],
        "testFrequency": 0,
        "name": "Test #2 (Copy)"
    }
        }


List Test Results

Fetch an array containing the results for a test. Results are returned in reverse chronological order (newest first).

Request
GEThttps://api.ghostinspector.com/v1/tests/<testId>/results/?apiKey=<apiKey>
Parameters
apiKey
Your API key provided in your account
testId
The ID of the test containing the results
count
The number of results to return (default 10, maximum 50)
offset
The number of results to offset the returned set by (default 0)
Response
{
  "code": "SUCCESS",
  "data": [
    {
      "_id": "5967ee29d078e8ba058b2458",
      "uuid": "a5243051-f997-40a7-86ae-1e4069f10748",
      "test": {
        "_id": "5967e75abfebc5ba07c5b0e7",
        "suite": "5967e6e7bfebc5ba07c5b0e3",
        "organization": "547fb82d92423992d52a4fea",
        "name": "Test #2"
      },
      "suiteResult": null,
      "name": "Test #2",
      "browser": "slimerjs-52",
      "globalStepDelay": 250,
      "maxWaitDelay": 15000,
      "maxAjaxDelay": 10000,
      "finalDelay": 5000,
      "autoRetry": true,
      "failOnJavaScriptError": false,
      "screenshotCompareEnabled": true,
      "screenshotCompareThreshold": 0.1,
      "startUrl": "http://ghostinspector.com/docs/",
      "region": "us-east-1",
      "dateCreated": "2017-07-13T22:03:21.224Z",
      "screenshotCompareDifference": 0.001,
      "screenshotComparePassing": true,
      "passing": true,
      "console": [
        {
          "output": "Sample console error...",
          "error": false,
          "url": "https://ghostinspector.com/docs/?q=frames",
          "dateExecuted": "2017-07-13T22:03:27.288Z"
        }
      ],
      "urls": [
        "http://ghostinspector.com/docs/",
        "https://ghostinspector.com/docs/?q=frames"
      ],
      "filters": [],
      "steps": [
        {
          "command": "assign",
          "target": ".header-search-input",
          "value": "frames",
          "variableName": "",
          "url": "https://ghostinspector.com/docs/",
          "dateExecuted": "2017-07-13T22:03:26.503Z",
          "passing": true,
          "optional": false,
          "private": false,
          "sequence": 0
        },
        {
          "command": "click",
          "target": ".header-search-button",
          "value": "",
          "variableName": "",
          "url": "https://ghostinspector.com/docs/",
          "dateExecuted": "2017-07-13T22:03:26.982Z",
          "passing": true,
          "optional": false,
          "private": false,
          "sequence": 1
        },
        {
          "command": "assertTextPresent",
          "target": ".content .search-input",
          "value": "frames",
          "variableName": "",
          "url": "https://ghostinspector.com/docs/?q=frames",
          "dateExecuted": "2017-07-13T22:03:28.236Z",
          "passing": true,
          "optional": false,
          "private": false,
          "sequence": 2
        },
        {
          "command": "extract",
          "target": "title",
          "value": "",
          "variableName": "pageTitle",
          "url": "https://ghostinspector.com/docs/?q=frames",
          "extracted": "Documentation - Ghost Inspector",
          "dateExecuted": "2017-07-13T22:03:28.695Z",
          "passing": true,
          "optional": false,
          "private": false,
          "sequence": 3
        }
      ],
      "viewportSize": {
        "height": 768,
        "width": 1024
      },
      "user": {
        "_id": "52df0d27fbaced54db000006",
        "name": "Sample User"
      },
      "dateExecutionStarted": "2017-07-13T22:03:23.374Z",
      "executionHost": "prod012.ghostinspector.net",
      "dateExecutionFinished": "2017-07-13T22:03:34.310Z",
      "endUrl": "https://ghostinspector.com/docs/?q=frames",
      "executionTime": 10936,
      "extractions": {
        "pageTitle": "Documentation - Ghost Inspector"
      },
      "screenshot": {
        "original": {
          "size": 237173,
          "dims": {
            "h": 2232,
            "w": 1024
          },
          "defaultUrl": "https://ghostinspector-prod.s3.amazonaws.com/screenshots/a5243051-f997-40a7-86ae-1e4069f10748-original.png",
          "path": "/screenshots/a5243051-f997-40a7-86ae-1e4069f10748-original.png"
        },
        "small": {
          "size": 92213,
          "dims": {
            "h": 698,
            "w": 320
          },
          "defaultUrl": "https://ghostinspector-prod.s3.amazonaws.com/screenshots/a5243051-f997-40a7-86ae-1e4069f10748-small.png",
          "path": "/screenshots/a5243051-f997-40a7-86ae-1e4069f10748-small.png"
        }
      },
      "screenshotCompareBaselineResult": "5967ee09bfebc5ba07c5b0f0",
      "video": {
        "path": "/videos/a5243051-f997-40a7-86ae-1e4069f10748.mp4",
        "url": "https://ghostinspector-prod.s3.amazonaws.com/videos/a5243051-f997-40a7-86ae-1e4069f10748.mp4",
        "dims": {
          "w": 1024,
          "h": 768
        }
      }
    },
    {
      "_id": "5967ee09bfebc5ba07c5b0f0",
      "uuid": "8f779b4c-01c9-434f-b08c-86b99015e52f",
      "test": {
        "_id": "5967e75abfebc5ba07c5b0e7",
        "suite": "5967e6e7bfebc5ba07c5b0e3",
        "organization": "547fb82d92423992d52a4fea",
        "name": "Test #2"
      },
      "suiteResult": null,
      "name": "Test #2",
      "browser": "slimerjs-52",
      "globalStepDelay": 250,
      "maxWaitDelay": 15000,
      "maxAjaxDelay": 10000,
      "finalDelay": 5000,
      "autoRetry": true,
      "failOnJavaScriptError": false,
      "screenshotCompareEnabled": true,
      "screenshotCompareThreshold": 0.1,
      "startUrl": "http://ghostinspector.com/docs/",
      "region": "us-east-1",
      "dateCreated": "2017-07-13T22:02:49.129Z",
      "screenshotCompareDifference": 0,
      "screenshotComparePassing": true,
      "passing": true,
      "console": [
        {
          "output": "Sample console error...",
          "error": false,
          "url": "https://ghostinspector.com/docs/?q=frames",
          "dateExecuted": "2017-07-13T22:02:57.289Z"
        }
      ],
      "urls": [
        "http://ghostinspector.com/docs/",
        "https://ghostinspector.com/docs/?q=frames"
      ],
      "filters": [],
      "steps": [
        {
          "command": "assign",
          "target": ".header-search-input",
          "value": "frames",
          "variableName": "",
          "url": "https://ghostinspector.com/docs/",
          "dateExecuted": "2017-07-13T22:02:56.237Z",
          "passing": true,
          "optional": false,
          "private": false,
          "sequence": 0
        },
        {
          "command": "click",
          "target": ".header-search-button",
          "value": "",
          "variableName": "",
          "url": "https://ghostinspector.com/docs/",
          "dateExecuted": "2017-07-13T22:02:56.764Z",
          "passing": true,
          "optional": false,
          "private": false,
          "sequence": 1
        },
        {
          "command": "assertTextPresent",
          "target": ".content .search-input",
          "value": "frames",
          "variableName": "",
          "url": "https://ghostinspector.com/docs/?q=frames",
          "dateExecuted": "2017-07-13T22:02:58.034Z",
          "passing": true,
          "optional": false,
          "private": false,
          "sequence": 2
        },
        {
          "command": "extract",
          "target": "title",
          "value": "",
          "variableName": "pageTitle",
          "url": "https://ghostinspector.com/docs/?q=frames",
          "extracted": "Documentation - Ghost Inspector",
          "dateExecuted": "2017-07-13T22:02:58.470Z",
          "passing": true,
          "optional": false,
          "private": false,
          "sequence": 3
        }
      ],
      "viewportSize": {
        "height": 768,
        "width": 1024
      },
      "user": {
        "_id": "52df0d27fbaced54db000006",
        "name": "Sample User"
      },
      "dateExecutionStarted": "2017-07-13T22:02:52.850Z",
      "executionHost": "prod012.ghostinspector.net",
      "dateExecutionFinished": "2017-07-13T22:03:04.112Z",
      "endUrl": "https://ghostinspector.com/docs/?q=frames",
      "executionTime": 11262,
      "extractions": {
        "pageTitle": "Documentation - Ghost Inspector"
      },
      "screenshot": {
        "original": {
          "size": 237083,
          "dims": {
            "h": 2232,
            "w": 1024
          },
          "defaultUrl": "https://ghostinspector-prod.s3.amazonaws.com/screenshots/8f779b4c-01c9-434f-b08c-86b99015e52f-original.png",
          "path": "/screenshots/8f779b4c-01c9-434f-b08c-86b99015e52f-original.png"
        },
        "small": {
          "size": 92210,
          "dims": {
            "h": 698,
            "w": 320
          },
          "defaultUrl": "https://ghostinspector-prod.s3.amazonaws.com/screenshots/8f779b4c-01c9-434f-b08c-86b99015e52f-small.png",
          "path": "/screenshots/8f779b4c-01c9-434f-b08c-86b99015e52f-small.png"
        }
      },
      "video": {
        "path": "/videos/8f779b4c-01c9-434f-b08c-86b99015e52f.mp4",
        "url": "https://ghostinspector-prod.s3.amazonaws.com/videos/8f779b4c-01c9-434f-b08c-86b99015e52f.mp4",
        "dims": {
          "w": 1024,
          "h": 768
        }
      }
    }
  ]
}


Download in Selenium 1 Format (HTML)

Download a single test in Selenium 1 format (HTML).

Request
GEThttps://api.ghostinspector.com/v1/tests/<testId>/export/selenium-html/?apiKey=<apiKey>
Parameters
apiKey
Your API key provided in your account
testId
The ID of the test to fetch
Response
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://ghostinspector.com" />
<title>Sample Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">Sample Test</td>
</tr>
</thead>
<tbody>
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>css=#username</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>css=#username</td>
<td>test</td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>css=#submit</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>css=#submit</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>


Download in Selenium 2 Format (JSON)

Download a single test in Selenium 2 format (JSON).

Request
GEThttps://api.ghostinspector.com/v1/tests/<testId>/export/selenium-json/?apiKey=<apiKey>
Parameters
apiKey
Your API key provided in your account
testId
The ID of the test to fetch
Response
{
  "type": "script",
  "seleniumVersion": "2",
  "formatVersion": 2,
  "steps": [
    {
      "type": "get",
      "url": "http://www.example.com/"
    },
    {
      "type": "waitForElementPresent",
      "locator": {
        "type": "css selector",
        "value": "#header"
      }
    },
    {
      "type": "assertTextPresent",
      "locator": {
        "type": "css selector",
        "value": "#header"
      },
      "text": "Dashboard",
      "negated": false
    }
  ]
}


Test Status Badges

Note: Status badges are disabled by default and can be enabled under Test Settings > Details > Enable Status Badge.

Real-time embeddable status badges for your test. Will return the appropriate status badge image based on the current status of your test.

Request
GEThttps://api.ghostinspector.com/v1/tests/<testId>/status-badge
Parameters
screenshot
Show the status of screenshotComparePassing for this test.
Statuses
Passing
The last completed run of this test passed.
Failing
The last completed run of this test failed.
Running
Test execution is in progress.
Unknown
The test has no previous execution or the last execution was cancelled.
Screenshot Compare
The screenshot comparison for this test is passing.
Example usage
<img src="https://api.ghostinspector.com/v1/tests/<testId>/status-badge" title="My test status">