Chromium
isAlertOpen
Whether a simple dialog is currently open.
Non official and undocumented Chromium command. More about this command can be found here.
Usage
browser.isAlertOpen()
Example
console.log(browser.isAlertOpen()); // outputs: false
browser.execute('window.alert()');
console.log(browser.isAlertOpen()); // outputs: true
Returns
- <Boolean>
isAlertOpen:trueorfalsebased on whether simple dialog is present or not.
isAutoReporting
Whether it should automatically raises errors on browser logs.
Non official and undocumented Chromium command. More about this command can be found here.
Usage
browser.isAutoReporting()
Returns
- <Boolean>
isAutoReporting:trueorfalsebased on whether auto reporting is enabled.
setAutoReporting
Toggle whether to return response with unknown error with first browser error (e.g. failed to load resource due to 403/404 response) for all subsequent commands (once enabled).
Non official and undocumented Chromium command. More about this command can be found here.
Usage
browser.setAutoReporting(enabled)
Parameters
| Name | Type | Details |
|---|---|---|
enabled | boolean | true if auto reporting should be enabled, use false to disable previously enabled auto reporting. |
Examples
// Enable auto reporting first thing after session was initiated with empty browser logs
console.log(browser.setAutoReporting(true)); // outputs: null
// Upon requesting an non-existing resource it will abort execution due to thrown unknown error
browser.url('https://webdriver.io/img/404-does-not-exist.png');
// During the session do some operations which populate the browser logs
browser.url('https://webdriver.io/img/404-does-not-exist.png');
browser.url('https://webdriver.io/403/no-access');
// Enable auto reporting which throws an unknown error for first browser log (404 response)
browser.setAutoReporting(true);
Returns
- <Object|Null>
firstBrowserError: In case first browser error already occured prior to executing this command it will throw unknown error as response, which is an object with 'message' key describing first browser error. Otherwise it returnsnullon success.
isLoading
Determines load status for active window handle.
Non official and undocumented Chromium command. More about this command can be found here.
Usage
browser.isLoading()
Example
console.log(browser.isLoading()); // outputs: false
browser.newWindow('https://webdriver.io');
console.log(browser.isLoading()); // outputs: true
Returns
- <Boolean>
isLoading:trueorfalsebased on whether active window handle is loading or not.
takeHeapSnapshot
Takes a heap snapshot of the current execution context.
Non official and undocumented Chromium command. More about this command can be found here.
Usage
browser.takeHeapSnapshot()
Returns
- <Object>
heapSnapshot: A JSON representation of the heap snapshot. Which can be inspected by loading as file into Chrome DevTools.
getNetworkConnection
Get the connection type for network emulation. This command is only applicable when remote end replies with networkConnectionEnabled capability set to true.
Non official and undocumented Chromium command. More about this command can be found here.
Usage
browser.getNetworkConnection()
Example
const browser = remote({
capabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
// Network emulation requires device mode, which is only enabled when mobile emulation is on
mobileEmulation: { deviceName: 'iPad' },
},
}
});
console.log(browser.getNetworkConnection()); // outputs: 6 (Both Wi-Fi and data)
Returns
- <Number>
connectionType: A bitmask to represent the network connection type. Airplane Mode (1), Wi-Fi only (2), Wi-Fi and data (6), 4G (8), 3G (10), 2G (20). By default Wi-Fi and data are enabled.
setNetworkConnection
Change connection type for network connection. This command is only applicable when remote end replies with networkConnectionEnabled capability set to true.
Non official and undocumented Chromium command. More about this command can be found here.
Usage
browser.setNetworkConnection(parameters)