Constructor
new module:WebDriverManager(browser, config)
Creates a manager.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
browser |
string
|
chrome |
Browser to use. Valid value includes |
config |
object
|
Manager configuration. |
Methods
getBaseUrl() → {string}
Get base URL from manager's configuration.
- Source:
Returns:
- Type:
-
string
Base URL from manager's configuration.
getConfigScreenSize() → {string}
Get screen size from manager's configuration.
- Source:
Returns:
- Type:
-
string
Screen size like 'desktop' or 'mobile'.
getDriver() → {object}
Returns instance of WebDriver.
- Source:
Returns:
- Type:
-
object
Instance of WebDriver.
Example
import { WebDriverManager } from 'wp-e2e-webdriver';
const manager = new WebDriverManager( 'chrome' );
const driver = manager.getDriver();
getPageUrl(pagePath) → {string}
Get page url given a pagePath
without the hostname.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
pagePath |
string
|
/ |
Page path. |
Returns:
- Type:
-
string
Full URL. Joined base URL with pagePath
.
getScreenSizeAsObject(screenSize) → {object}
Get object representation of screenSize
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
screenSize |
string
|
Screen size like 'desktop' or 'mobile'. |
Returns:
- Type:
-
object
Object representation of screen size.
quitBrowser(waitForMs) → {Promise}
Quit currently running browser.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
waitForMs |
number
|
0 |
Wait time in millisecond before quit. |
Returns:
- Type:
-
Promise
A promise that will be resolved once browser quitted.
resizeBrowser(screenSize)
Resize the browser to screenSize
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
screenSize |
string
|
Screen size like 'desktop' or 'mobile'. |