Skip to main content
Version: 7.5.5

Browser actions

goto

Method allowing to go a web page.

ParameterTypeDescription
urlstringURL of the web page to visit.

Basic Usage

await I.goto(`https://my-website.com`);

goForward

Method allowing to go to following next web page.

Basic Usage

await I.goForward();

goBackward

Method allowing to return to the previous web page.

Basic Usage

await I.goBackward();

go

Method allowing to a specific a web page among the web pages that were visited.

ParameterTypeDescription
deltanumberIndex of the web page to visit among the web pages that were visited.

Basic Usage

await I.go(1);

refresh

Method allowing to refresh the web page.

Basic Usage

await I.refresh();

maximizeWindow

Method allowing to maximize the browser window (depends on your screen settings and your operating system).

Basic Usage

await I.maximizeWindow();

resizeWindow

Method allowing to resize the browser window.

ParameterTypeDescription
widthnumberWidth value of the window.
heightnumberHeight value of the window.

Basic Usage

await I.resizeWindow(1920,1080);

switchToFrame

Method allowing to switch context towards a specific frame.

ParameterTypeDescription
selectorselectortypeSelector of the targeted frame.

Basic Usage

await I.switchToFrame(`#Frame1`);

switchToMainFrame

Method allowing to switch context towards the main frame.

Basic Usage

await I.switchToMainFrame();

switchToWindow

Method allowing to switch context towards a specific browser window.

ParameterTypeDescription
windowobjectHorizontal offset coordinates that define a point where the action is stopped.
ParameterTypeDescription
idstringHorizontal offset coordinates that define a point where the action is stopped.

Basic Usage

await I.switchToWindow({
id:`windowId`
});

switchToParentWindow

Method allowing to switch context towards the parent browser window.

Basic Usage

await I.switchToParentWindow();

switchToPreviousWindow

Method allowing to switch context towards the previous browser window.

Basic Usage

await I.switchToPreviousWindow();

openWindow

Method allowing to open a new browser window.

ParameterTypeDescription
urlstringUrl of the web page that will be visited in the new browser window.

returns

ParameterTypeDescription
idstringId of the window.

Basic Usage

await I.openWindow(`https://my-website.com`);

closeWindow

Method allowing to close a specific browser window.

ParameterTypeDescription
windowobject
ParameterTypeDescription
idstringId of the window.

Basic Usage

await I.closeWindow({
id:`windowId`
});

getCurrentWindow

Method allowing to get the id of the current window.

returns

ParameterTypeDescription
idstringId of the window.

Basic Usage

const myWindowId = await I.getCurrentWindow();

handleAlertDialog

Method allowing to handle an alert dialog.

ParameterTypeDescription
fnfunction / nullFunction returning the intended value to handle the dialog.
optionsHandleDialogOptionsHandle dialog options.

fn

ParameterTypeDescription
textstringtext parameter.
urlstringurl parameter.

options

ParameterTypeDescription
disposeAfterHandlingbooleanIf true, the handler will be deactivated after handling a dialog.

Basic Usage

await I.handleAlertDialog((alert) => true); //before triggering the dialog

handleConfirmDialog

Method allowing to handle a confirm dialog.

ParameterTypeDescription
fnfunction / nullFunction returning the intended value to handle the dialog.
optionsHandleDialogOptionsHandle dialog options.

fn

ParameterTypeDescription
textstringtext parameter.
urlstringurl parameter.

returns

boolean

options

ParameterTypeDescription
disposeAfterHandlingbooleanIf true, the handler will be deactivated after handling a dialog.

Basic Usage

await I.handleConfirmDialog((confirm) => true); //before triggering the dialog

handlePromptDialog

Method allowing to handle a prompt dialog.

ParameterTypeDescription
fnfunction / nullFunction returning the intended value to handle the dialog.
optionsHandleDialogOptionsHandle dialog options.

fn

ParameterTypeDescription
textstringtext parameter.
urlstringurl parameter.

returns

string

options

ParameterTypeDescription
disposeAfterHandlingbooleanIf true, the handler will be deactivated after handling a dialog.

Basic Usage


await I.handlePromptDialog(() => 'Hello!'); //before triggering the dialog

handleBeforeunloadDialog

Method allowing to handle a Beforeunload dialog.

ParameterTypeDescription
fnfunction / nullFunction returning the intended value to handle the dialog.
optionsHandleDialogOptionsHandle dialog options.

fn

ParameterTypeDescription
textstringtext parameter.
urlstringurl parameter.

returns

boolean

options

ParameterTypeDescription
disposeAfterHandlingbooleanIf true, the handler will be deactivated after handling a dialog.

handleNativeDialog

Method allowing to handle any native dialog.

ParameterTypeDescription
fnfunction / nullFunction returning the intended value to handle the dialog.
optionsHandleDialogOptionsHandle dialog options.

fn

ParameterTypeDescription
typealert / confirm / beforeunload / promptNative dialog type.
textstringtext parameter.
urlstringurl parameter.

options

ParameterTypeDescription
disposeAfterHandlingbooleanIf true, the handler will be deactivated after handling a dialog.
 await I.handleNativeDialog(() => {return true});

setCookie

Method allowing to set a specific cookie.

ParameterTypeDescription
cookieobjectObject representing a cookie to create.
ParameterTypeDescription
namestringCookie name.
valuestringCookie value.
domainstringCookie domain.
pathstringCookie path.
expiresDateExpiration date.
securebooleanCookie secure option.
sameSiteLax / Strict / NoneHorizontal offset coordinates that define a point where the action is stopped.

Basic Usage

await I.setCookie(
{
name:`cookieName`,
value:`cookieValue`,
domain:`cookieDomain`,
path:`cookiePath`,
expires: new Date(1642002630),
secure: false,
sameSite:`Strict`
}
);

getCookie

Method allowing to get a specific cookie.

ParameterTypeDescription
cookieNamestringName of the targeted cookie.

returns

Cookie / null

Basic Usage

await I.getCookie(`cookieName`);

clearCookie

Method allowing to clear a specific cookie value.

ParameterTypeDescription
cookieNamestringName of the targeted cookie.

Basic Usage

await I.clearCookie(`cookieName`);

deleteCookie

Method allowing to delete a specific cookie.

ParameterTypeDescription
cookieNamestringName of the targeted cookie.

Basic Usage

await I.deleteCookie(`cookieName`);

setLocalStorage

Method allowing to set a specific local storage.

ParameterTypeDescription
namestringName of the local storage.
valuestringValue of the local storage.

Basic Usage

await I.setLocalStorage(`localStorageName`, `localStorageValue`);

getLocalStorage

Method allowing to get a specific local storage value.

ParameterTypeDescription
namestringName of the local storage.

returns

string / null

Basic Usage

await I.getLocalStorage(`localStorageName`);

removeLocalStorage

Method allowing to remove a local storage.

ParameterTypeDescription
namestringName of the local storage.

Basic Usage

await I.removeLocalStorage(`localStorageName`);

setSessionStorage

Method allowing to set a specific session storage.

ParameterTypeDescription
namestringName of the session storage.
valuestringValue of the session storage.

Basic Usage

await I.getSessionStorage(`sessionStorageName`, `sessionStorageValue`);

getSessionStorage

Method allowing to get a specific session storage value.

ParameterTypeDescription
namestringName of the targeted session storage.

returns

string / null

Basic Usage

await I.getSessionStorage(`sessionStorageName`);

removeSessionStorage

Method allowing to remove a session storage.

ParameterTypeDescription
namestringName of the targeted session storage.

Basic Usage

await I.removeSessionStorage(`sessionStorageName`);

injectCss

Method allowing to inject a css code directly inside a web page.

object

ParameterTypeDescription
codestringCode to inject.
filePathstringPath of the file containing code to inject.
namestring
positionhead / bodyTop/ bodyBottomCode injection location.

Basic Usage

 await I.injectCss({
//optional
code: 'var framework="Test Maker"\n' + 'alert("We are using " + framework)',
//optional
filepath:'./custom-css.ts',
//optional
name:'Injected CSS',
//optional
position:"head"
});

injectJs

Method allowing to inject a javascript code directly inside a web page.

object

ParameterTypeDescription
codestringCode to inject.
filePathstringPath of the file containing code to inject.
namestring
positionhead / bodyTop/ bodyBottomCode injection location.
 await I.injectJs({
//optional
code: 'element{background-color: lightyellow;}',
//optional
filepath:'./custom-js.ts',
//optional
name:'Injected JavaScript',
//optional
position:"head"
});