Methods
allowWindowClose() → {FinderBase}
- Description:
Declare that the action closes the window itself, like clicking a link calling window.close(). Such an action can not return its result because the page is already gone, which is reported as an error like "Target page, context or browser has been closed". This method makes the action ignore that error.
- Source:
Example
const newWin = await page.waitForNewWindow(()=>{ ... })
await newWin.page.find("a.close-link").allowWindowClose().click();
Returns:
new finder object
- Type
- FinderBase
clone(callback) → {Object}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function | Optional. if callback function given, it is called with the cloned as argument |
Returns:
cloned object
- Type
- Object
evaluate() → {Promise}
- Description:
Evaluate this finder and resolve with the result (the match count, or the action result).
- Source:
Returns:
Promise resolved in evaluated JavaScript code
- Type
- Promise
evaluateAction() → {Promise}
- Description:
Evaluate as a action (used by click, fillIn, check, ...). The difference from
evaluate()is how it behaves when an element is not found. When config.autoWaiting.enabled is false, throws "Element not found" error. When config.autoWaiting.enabled is true, retries until the target element exists, is visible and is not disabled. When config.slowMotion is over 0, wait that msec before running the action.
- Source:
Returns:
Promise resolved in evaluated JavaScript code
- Type
- Promise
find() → {FinderBase}
- Source:
Returns:
new finder object which have added conditions
- Type
- FinderBase
map() → {FinderBase}
- Source:
Returns:
new finder object with added mapping function
- Type
- FinderBase
noWait() → {FinderBase}
- Description:
Disable auto-waiting for this finder. The action is executed immediately even when config.autoWaiting.enabled is true. If target element is not found when called, throw exception.
- Source:
Returns:
new finder object
- Type
- FinderBase
toJsCode(options) → {string}
- Description:
generate and return javascript code for finding element by this finder object
- Source:
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
Returns:
- Type
- string
waitTimeout(msec) → {FinderBase}
- Description:
Override the auto-waiting timeout for this finder.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
msec |
number | timeout in milliseconds |
Returns:
new finder object
- Type
- FinderBase
withRetry(opts) → {FinderBase}
- Description:
Make evaluate() poll (retry) until the target condition is met, or the timeout elapses.
- Source:
Parameters:
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object |
Properties
|
Returns:
new finder object
- Type
- FinderBase