(js: string)
| 73 | |
| 74 | // Promise version of executeJavaScript. |
| 75 | executeJavaScript(js: string) { |
| 76 | if (!this.isDomReady) |
| 77 | throw new Error('Can not call executeJavaScript before page is loaded.'); |
| 78 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 79 | return new Promise<any>((resolve, reject) => { |
| 80 | this.browser.executeJavaScript(js, (success: boolean, value) => { |
| 81 | if (success) |
| 82 | resolve(value); |
| 83 | else |
| 84 | reject(new Error('Failed to execute JavaScript.')); |
| 85 | }); |
| 86 | }); |
| 87 | } |
| 88 | |
| 89 | // Push a task will be executed one by one in a queue. |
| 90 | // If the browser is not ready yet, the tasks will be delayed until page is |
no outgoing calls
no test coverage detected