--- title: "Selenium API Test Scripting" slug: "selenium-api-test-scripting" updated: 2023-03-07T16:59:09Z published: 2023-03-07T16:59:09Z canonical: "docs.catchpoint.com/selenium-api-test-scripting" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.catchpoint.com/llms.txt > Use this file to discover all available pages before exploring further. # Selenium API Test Scripting Catchpoint relies on a customized subset of the **Selenium** language to perform API tests. At the end of this article is a list of supported Selenium verbs. ## Configuration Catchpoint API Test scripts currently consist of manually typed scripts. Fortunately, writing API Test scripts is straightforward since the editor provides syntax highlighting, autocomplete/suggestions, and tooltip hints. 1. In **Control Center > Tests**, select **New > API** ![Pic_7.png](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/4402406175501-Pic_7.png) 2. In the **Test Properties** page you can start writing your script: ![Pic_18.png](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/4402406198669-Pic_18.png) The autocomplete function in the script editor will become present upon typing. The hints can be viewed by clicking into the center of the command's content: **Verb:** ![](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/203429386-Verb_Example.png) **Macro:** ![](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/203429396-Macros_Example.png) 1. It is strongly recommended that you run an instant test and capture headers/response content to make sure your script is working at this point. ## Example Scripts Most API Test scripts involve opening a URL, setting a header, extracting some content into a variable, using that variable in a second step where a new URL is opened, and asserting the server's response. **Please note that the `assertHtmlSource()` command is used to assert the response content regardless of a content type.** Here is a somewhat complex script that repeatedly opens a URL every 5 seconds in the second step and asserts that a string must be **not present** in the response: ``` //Step - 1 open("http://example.com/channel/a58231f29bc5423aafd2edf246da5d48.m3u8") setHeader("Cookie", "foo=bar") storeVariable("\${extract(resp-content,regexp://\[\w/\\-\\.\\?=&%\]+)}", "url") //Step - 2 openWhile("http:\${var(url)}", "\${var(loopCounter, le(5))}") storeVariable("\${extract(resp-content,regexp:http://(\[\w/\\-\\.\\?=&%\]+))}", "ts") AssertNotHtmlSource("d959b7cb7e464571b9417e54494e4f46") pause("5000") storeVariable("\${var(loopCounter,add(1))}", "loopCounter") ``` A couple of sample scripts to assert an HTML Source are below: ``` open(io.catchpoint.com) assertHttpResponseCode(200) assertHtmlSource('