Page
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public get |
this get was deprecated.
|
|
public get |
|
|
public get |
URL of current page |
|
public get |
webContents: object: * |
|
public get |
|
Private Members | ||
private |
_assert: * |
|
private |
_browserPage: * |
|
private |
_context: * |
|
private get |
context: * |
Method Summary
Public Methods | ||
public |
assertScreen(identifier: *, options: *): Assert |
|
public |
|
|
public |
Create and Return new Finder object with given finder-condition |
|
public |
Get the HTML source of current page. |
|
public |
Create and Return new Page object in given iframe context. |
|
public |
Load new page which is URL given, and returned Promise is resolved when finished load. |
|
public |
openDevTools(): * |
|
public |
Reload current page. |
|
public |
takeScreenshot(fileName: String): Promise Take a screenshot of this page. |
|
public |
waitForAjaxDone(action: function): Promise |
|
public |
waitForAlert(alertOptioin: object, action: function): Promise |
|
public |
waitForBrowserSocket(socketOption: object, action: function): Promise |
|
public |
waitForConfirm(confirmOption: object, action: function): Promise |
|
public |
waitForDownload(action: function, options: object): Promise<object> Wait file-download completed and resolve the promise with result object(contains filename, savedFilePath) A File is saved in config.fileDownloadDir with timestamp string like '20171225002540_print.pdf' |
|
public |
waitForFinder(finder: Finder, action: function): Promise Wait for appearance of element specified by Finder object. |
|
public |
waitForNewWindow(action: function): Promise Wait new-window opend and resolve the promise with Window object. |
|
public |
waitForPageLoad(action: function): Promise Wait loading for contents in new page. |
|
public |
waitForSelector(cssSelector: string, action: function): Promise Wait for appearance of element specified by css-selector. |
|
public |
wget(url: *): * Download file that url given. |
Private Methods | ||
private |
newPromiseWithCheckReady(func: *, action: *): * if window.isReadyForPage is false, return failed promise. |
Public Constructors
public constructor() source
Public Members
public get browserPage: BrowserPage: * source
Private Members
private _assert: * source
private _browserPage: * source
private _context: * source
private get context: * source
Public Methods
public assertScreen(identifier: *, options: *): Assert source
Params:
Name | Type | Attribute | Description |
identifier | * | ||
options | * |
public executeJs(code: string): Promise source
Params:
Name | Type | Attribute | Description |
code | string | JavaScript Code for executing this page. |
public find(args: ...*): Finder source
Create and Return new Finder object with given finder-condition
Params:
Name | Type | Attribute | Description |
args | ...* |
public inIframe(finderForIframe: Finder): Page source
Create and Return new Page object in given iframe context.
Params:
Name | Type | Attribute | Description |
finderForIframe | Finder | finder object for iframe |
Example:
const pageInIframe = page.inIframe(page.find("iframe").first());
await pageInIframe.find("h3").text()
public load(url: *, options: {}): Promise source
Load new page which is URL given, and returned Promise is resolved when finished load.
Params:
Name | Type | Attribute | Description |
url | * | ||
options | {} |
|
public takeScreenshot(fileName: String): Promise source
Take a screenshot of this page.
Params:
Name | Type | Attribute | Description |
fileName | String | fileName for saving as it in config.screentshotsDir. If absolutePath is given, save to it. |
public waitForAjaxDone(action: function): Promise source
Params:
Name | Type | Attribute | Description |
action | function | A function representing the operation of sending Ajax request |
public waitForAlert(alertOptioin: object, action: function): Promise source
Example:
await page.waitAlertDialog({ message: "You are wrong!" }, ()=>{
page.find("button.submit-form").click()
})
public waitForConfirm(confirmOption: object, action: function): Promise source
Example:
await page.waitConfirmDialog({ message: "Are you OK?", isClickOK: false }, ()=>{
page.find("button.submit-form").click()
})
await page.waitLoading(async ()=>{
await page.waitForConfirm(async ()=>{
await page.find("button.submit-form").click()
})
})
public waitForDownload(action: function, options: object): Promise<object> source
Wait file-download completed and resolve the promise with result object(contains filename, savedFilePath) A File is saved in config.fileDownloadDir with timestamp string like '20171225002540_print.pdf'
Example:
const item = await page.waitForDownload(()=>{
...
})
assert.equal(await (util.promisify(fs.readFile))(item.savedFilePath, 'utf-8'), ...);
public waitForFinder(finder: Finder, action: function): Promise source
Wait for appearance of element specified by Finder object.
public waitForNewWindow(action: function): Promise source
Wait new-window opend and resolve the promise with Window object.
Params:
Name | Type | Attribute | Description |
action | function | A function representing the operation of open new window |
Example:
const newWin = await page.waitForNewWindow(()=>{
...
})
newWin.page.find(...).click();
newWin.close();
public waitForPageLoad(action: function): Promise source
Wait loading for contents in new page.
Params:
Name | Type | Attribute | Description |
action | function | A function representing the operation of loading new page. |
public waitForSelector(cssSelector: string, action: function): Promise source
Wait for appearance of element specified by css-selector.
public wget(url: *): * source
Download file that url given. This method operates outside of browser.
Params:
Name | Type | Attribute | Description |
url | * |
Return:
* |
Private Methods
private newPromiseWithCheckReady(func: *, action: *): * source
if window.isReadyForPage is false, return failed promise. if window.isReadyForPage is true, invoke given "func". And "resolve" which is passed to "func" is resolved, "action" will be called.
Params:
Name | Type | Attribute | Description |
func | * | ||
action | * |
Return:
* |