test
to work with the ThousandEyes transaction test configuration, such as getting the target test URL (for example https://google.com/) or getting the test timeout setting.thousandeyes
test
import { test } from 'thousandeyes'
const settings = test.getSettings();
getSettings()
interval
(number), timeout
(number), url
(string) and proxy
(object).thousandeyes
driver
import { driver } from 'thousandeyes';
await driver.get('https://google.com');
await driver.get('https://google.com');
actions( options )
executeAsyncScript( script, ...args )
executeScript( script, ...args )
findElement( locator )
findElements( locator )
get( url )
getAllWindowHandles()
getCurrentUrl()
getPageSource()
getTitle()
getWindowHandle()
manage()
navigate()
sleep( ms )
switchTo()
findElement()
function or similar), it can be managed using the following methods.selenium-webdriver
WebElement
const element = await driver.findElement(By.css('.someClass'))
clear()
click()
getAttribute( attributeName )
getCssValue( cssStyleProperty )
getId()
getText()
sendKeys( ...args )
submit()
selenium-webdriver
until
import { until } from 'selenium-webdriver';
await driver.wait(until.alertIsPresent(), 10 * 1000, 'Alert did not appear within 10 seconds!');
ableToSwitchToFrame( frame )
alertIsPresent()
elementIsDisabled( element )
elementIsEnabled( element )
elementIsNotSelected( element )
elementIsNotVisible( element )
elementIsSelected( element )
elementIsVisible( element )
elementLocated( locator )
elementTextContains( element, substr )
elementTextIs( element, text )
elementTextMatches( element, regex )
elementsLocated( locator )
stalenessOf( element )
titleContains( substr )
titleIs( title )
selenium-webdriver
Key
import { Key } from 'selenium-webdriver';
await driver.findElement(By.css('.form-input')).sendKeys(Key.RETURN);
Key.chord( ...keys )
thousandeyes
driver
takeScreenshot()
await driver.takeScreenshot();
thousandeyes
credentials
import { credentials } from 'thousandeyes';
credentials.get('MyPasswordName');
get( credentialName )
credentialName
(string) The name of the credential to fetchthousandeyes
uploads
import { uploads } from 'thousandeyes'
await uploads.generateFile('lion-for-marbas.jpeg', fileContent: any, encoding?: string);
generateFile( filename, fileContents )
fileName
(string) The name of the file to be uploaded.fileContents
(any) File contents encoded as string.thousandeyes
uploads
import { uploads } from 'thousandeyes'
await uploads.generateRandomTextFile(2000, 'myFilename.txt');
generateRandomTextFile( sizeInBytes, fileName )
sizeInBytes
(number) desired byte size of the generated file.fileName
(string) The name of the file to be generated.thousandeyes
uploads
import { uploads } from 'thousandeyes'
await uploads.generateRandomBinaryFile(2000, 'myFileName.bin');
generateRandomBinaryFile( sizeInBytes, fileName )
sizeInBytes
(number) desired byte size of the generated file.fileName
(string) The name of the file to be generated.thousandeyes
downloads
import { downloads } from 'thousandeyes';
await downloads.waitForDownload('myFilename.txt', 10 * 1000);
waitForDownload( fileName, timeout )
fileName
(string) The name of the file to wait fortimeout
(number) The max number of milliseconds to wait for download completion. Defaults to 60 secondsthousandeyes
downloads
import { downloads } from 'thousandeyes'
await downloads.getContents ('myFilePath');
getContents ( path )
path
(string)thousandeyes
downloads
import { downloads } from 'thousandeyes'
await downloads.getSize('myFilePath');
getSize( path )
path
(string)thousandeyes
downloads
import { downloads } from 'thousandeyes'
await downloads.getMD5 ('myFilePath');
or await downloads.getSHA256('myFilePath';
)getMD5 ( path )
or getSHA256 ( path )
path
(string)thousandeyes
downloads
import { downloads } from 'thousandeyes'
await downloads.getPdfTextContents('myFilePath');
getPdfTextContents ( path )
path
(string)thousandeyes
markers
start( markerName )
stop
function with the same name.markerName
(string) The name of the markerthousandeyes
markers
stop( markerName )
markerName
(string) The name of the markerthousandeyes
markers
set( markerName )
set
implicitly closes the marker, so there is no need to later close it.markerName
(string) The name of the markerthousandeyes
transaction
start()
thousandeyes
transaction
stop()
selenium-webdriver
By
import { By } from 'selenium-webdriver';
await driver.findElement(By.css('#myId'));
By.className( name )
By.css( selector )
By.id( selector )
By.js( script, ...var_args )
By.linkText( text )
By.name( name )
By.partialLinkText( text )
By.xpath( xpath )
assert
module provides a set of assertion functions for verifying invariants.assert
assert
import assert from 'assert';
assert(url === 'https://wikipedia.org', 'Assertion failed: not on wikipedia!')
assert( value[, message] )
deepEqual( actual, expected[, message] )
doesNotReject( asyncFn[, error][, message] )
doesNotThrow( fn[, error][, message] )
equal( actual, expected[, message] )
fail( [message] )
ifError( value )
notDeepEqual( actual, expected[, message] )
notEqual( actual, expected[, message] )
ok( value[, message] )
rejects( asyncFn[, error][, message] )
throws( fn[, error][, message] )
authentication
module to get a time-based one-time password (TOTP) for 2-factor authentication, as in this scripting example: usingTOTPTwoFactorAuth.js.thousandeyes
authentication
import { authentication } from 'thousandeyes'
var totp = authentication.getTimeBasedOneTimePassword(secretToken);
getTimeBasedOneTimePassword( secretToken )
secretToken
(string) Secret token provided by Identity administrator.