Dev Kit API
This page will help you get started with import-sample. You'll be up and running in a jiffy!
TDK Feature
This is not supported in Testim's visual editor.
Dev Kit API
The Testim Dev Kit is a platform that enables multi-browser low-latency and stable codeful automation through a high level API that runs inside the Testim platform.
Example of usage:
await go('http://example.com/?foo=bar');
await click('.loacker-juice');
const waferFan = await text('.affectionado');
// because Ilan really loves loacker
expect(waferFan).to.equal('ilan');
The Dev Kit exposes an API that enables you to perform web automation tasks easily.
Please see the tutorial on getting started with the API.
Full API reference
- Navigation
go(url)
- navigate to a given URL.resize(options)
- resize the browser.withContext(options')
- change tab or frame to execute code in
- Access
text(selector)
- Get an element's text.checkbox(selector)
- get a checkbox input's selected stateradio(selector)
- get a radio input's selected state
- Control
click(selector [, options])
- Click an element.hover(selector [, options])
- Hover over an element.dblclick(selector [,options])
- Double Click an element.dragAndDrop(draggedElementSelector, draggedOnElementSelector [,options])
- Drag and Drop elements.drag(draggedElementSelector, dragPath)
- Drag elements along a path.type(selector, textValue)
- Set an element's text.selectOption(selector)
- Select an<option>
element.submit(selector)
- Submit a form.scrollToElement(selector [,options])
- scroll to a given element.scrollToPosition(options)
- scroll to a given positionexists
- checks if an element exists on the page.sendCharacter(selector, key)
- send the given character to the given element.evaluate(javascriptFunction [,...args])
- execute arbitrary JavaScript code on the page.getCookie(name)
- gets the specified cookie by namesetCookie(options)
- sets a cookie.
- Waits
waitForElement
- waits for an element to be present on the page.waitForNoElement
- waits for an element to not be present on the page.waitForText(selector, value [,options])
- waits for an element to contain text.waitForCode(code [,options])
- wait for the given code to evaluate totrue
.
- Screenshots
screenshot.viewport()
- take a page screenshotscreenshot.element(selector)
- take an element screenshotscreenshot.stitch()
- take a scrolling page screenshot
Environment Variables
By default TDK exposes any environment variable prefixed with TDK_
and BASE_URL
. See Working with environment variables for a more in-depth guide of passing environment data to tests.
Updated over 2 years ago