Browser actions
goto
Method allowing to go a web page.
Parameter | Type | Description |
---|---|---|
url | string | URL 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.
Parameter | Type | Description |
---|---|---|
delta | number | Index 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.
Parameter | Type | Description |
---|---|---|
width | number | Width value of the window. |
height | number | Height value of the window. |
Basic Usage
await I.resizeWindow(1920,1080);
switchToFrame
Method allowing to switch context towards a specific frame.
Parameter | Type | Description |
---|---|---|
selector | selectortype | Selector 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.
Parameter | Type | Description |
---|---|---|
window | object | Horizontal offset coordinates that define a point where the action is stopped. |
Parameter | Type | Description |
---|---|---|
id | string | Horizontal 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.
Parameter | Type | Description |
---|---|---|
url | string | Url of the web page that will be visited in the new browser window. |
returns
Parameter | Type | Description |
---|---|---|
id | string | Id of the window. |
Basic Usage
await I.openWindow(`https://my-website.com`);
closeWindow
Method allowing to close a specific browser window.
Parameter | Type | Description |
---|---|---|
window | object |
Parameter | Type | Description |
---|---|---|
id | string | Id of the window. |
Basic Usage
await I.closeWindow({
id:`windowId`
});
getCurrentWindow
Method allowing to get the id of the current window.
returns
Parameter | Type | Description |
---|---|---|
id | string | Id of the window. |
Basic Usage
const myWindowId = await I.getCurrentWindow();
handleAlertDialog
Method allowing to handle an alert dialog.
Parameter | Type | Description |
---|---|---|
fn | function / null | Function returning the intended value to handle the dialog. |
options | HandleDialogOptions | Handle dialog options. |
fn
Parameter | Type | Description |
---|---|---|
text | string | text parameter. |
url | string | url parameter. |
options
Parameter | Type | Description |
---|---|---|
disposeAfterHandling | boolean | If 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.
Parameter | Type | Description |
---|---|---|
fn | function / null | Function returning the intended value to handle the dialog. |
options | HandleDialogOptions | Handle dialog options. |
fn
Parameter | Type | Description |
---|---|---|
text | string | text parameter. |
url | string | url parameter. |
returns
boolean
options
Parameter | Type | Description |
---|---|---|
disposeAfterHandling | boolean | If 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.
Parameter | Type | Description |
---|---|---|
fn | function / null | Function returning the intended value to handle the dialog. |
options | HandleDialogOptions | Handle dialog options. |
fn
Parameter | Type | Description |
---|---|---|
text | string | text parameter. |
url | string | url parameter. |
returns
string
options
Parameter | Type | Description |
---|---|---|
disposeAfterHandling | boolean | If 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.
Parameter | Type | Description |
---|---|---|
fn | function / null | Function returning the intended value to handle the dialog. |
options | HandleDialogOptions | Handle dialog options. |
fn
Parameter | Type | Description |
---|---|---|
text | string | text parameter. |
url | string | url parameter. |
returns
boolean
options
Parameter | Type | Description |
---|---|---|
disposeAfterHandling | boolean | If true, the handler will be deactivated after handling a dialog. |
handleNativeDialog
Method allowing to handle any native dialog.
Parameter | Type | Description |
---|---|---|
fn | function / null | Function returning the intended value to handle the dialog. |
options | HandleDialogOptions | Handle dialog options. |
fn
Parameter | Type | Description |
---|---|---|
type | alert / confirm / beforeunload / prompt | Native dialog type. |
text | string | text parameter. |
url | string | url parameter. |
options
Parameter | Type | Description |
---|---|---|
disposeAfterHandling | boolean | If true, the handler will be deactivated after handling a dialog. |
await I.handleNativeDialog(() => {return true});
setCookie
Method allowing to set a specific cookie.
Parameter | Type | Description |
---|---|---|
cookie | object | Object representing a cookie to create. |
cookie
Parameter | Type | Description |
---|---|---|
name | string | Cookie name. |
value | string | Cookie value. |
domain | string | Cookie domain. |
path | string | Cookie path. |
expires | Date | Expiration date. |
secure | boolean | Cookie secure option. |
sameSite | Lax / Strict / None | Horizontal 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.
Parameter | Type | Description |
---|---|---|
cookieName | string | Name of the targeted cookie. |
returns
Cookie
/ null
Basic Usage
await I.getCookie(`cookieName`);
clearCookie
Method allowing to clear a specific cookie value.
Parameter | Type | Description |
---|---|---|
cookieName | string | Name of the targeted cookie. |
Basic Usage
await I.clearCookie(`cookieName`);
deleteCookie
Method allowing to delete a specific cookie.
Parameter | Type | Description |
---|---|---|
cookieName | string | Name of the targeted cookie. |
Basic Usage
await I.deleteCookie(`cookieName`);
setLocalStorage
Method allowing to set a specific local storage.
Parameter | Type | Description |
---|---|---|
name | string | Name of the local storage. |
value | string | Value of the local storage. |
Basic Usage
await I.setLocalStorage(`localStorageName`, `localStorageValue`);
getLocalStorage
Method allowing to get a specific local storage value.
Parameter | Type | Description |
---|---|---|
name | string | Name of the local storage. |
returns
string
/ null
Basic Usage
await I.getLocalStorage(`localStorageName`);
removeLocalStorage
Method allowing to remove a local storage.
Parameter | Type | Description |
---|---|---|
name | string | Name of the local storage. |
Basic Usage
await I.removeLocalStorage(`localStorageName`);
setSessionStorage
Method allowing to set a specific session storage.
Parameter | Type | Description |
---|---|---|
name | string | Name of the session storage. |
value | string | Value of the session storage. |
Basic Usage
await I.getSessionStorage(`sessionStorageName`, `sessionStorageValue`);
getSessionStorage
Method allowing to get a specific session storage value.
Parameter | Type | Description |
---|---|---|
name | string | Name of the targeted session storage. |
returns
string
/ null
Basic Usage
await I.getSessionStorage(`sessionStorageName`);
removeSessionStorage
Method allowing to remove a session storage.
Parameter | Type | Description |
---|---|---|
name | string | Name 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
Parameter | Type | Description |
---|---|---|
code | string | Code to inject. |
filePath | string | Path of the file containing code to inject. |
name | string | |
position | head / bodyTop / bodyBottom | Code 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
Parameter | Type | Description |
---|---|---|
code | string | Code to inject. |
filePath | string | Path of the file containing code to inject. |
name | string | |
position | head / bodyTop / bodyBottom | Code injection location. |
await I.injectJs({
//optional
code: 'element{background-color: lightyellow;}',
//optional
filepath:'./custom-js.ts',
//optional
name:'Injected JavaScript',
//optional
position:"head"
});