mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat: add timeout to electron.firstWindow() method (#21863)
Fixes https://github.com/microsoft/playwright/issues/21846
This commit is contained in:
parent
1fbefa694f
commit
5223c1ba39
@ -135,6 +135,14 @@ Convenience method that waits for the first application window to be opened.
|
||||
// ...
|
||||
```
|
||||
|
||||
### option: ElectronApplication.firstWindow.timeout
|
||||
* since: v1.33
|
||||
- `timeout` ?<[float]>
|
||||
|
||||
Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds).
|
||||
Pass `0` to disable timeout. The default value can be changed by using the
|
||||
[`method: BrowserContext.setDefaultTimeout`].
|
||||
|
||||
## method: ElectronApplication.process
|
||||
* since: v1.21
|
||||
- returns: <[ChildProcess]>
|
||||
|
||||
@ -95,10 +95,10 @@ export class ElectronApplication extends ChannelOwner<channels.ElectronApplicati
|
||||
return [...this._windows];
|
||||
}
|
||||
|
||||
async firstWindow(): Promise<Page> {
|
||||
async firstWindow(options?: { timeout?: number }): Promise<Page> {
|
||||
if (this._windows.size)
|
||||
return this._windows.values().next().value;
|
||||
return this.waitForEvent('window');
|
||||
return this.waitForEvent('window', options);
|
||||
}
|
||||
|
||||
context(): BrowserContext {
|
||||
|
||||
10
packages/playwright-core/types/types.d.ts
vendored
10
packages/playwright-core/types/types.d.ts
vendored
@ -13402,8 +13402,16 @@ export interface ElectronApplication {
|
||||
* // ...
|
||||
* ```
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
firstWindow(): Promise<Page>;
|
||||
firstWindow(options?: {
|
||||
/**
|
||||
* Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
|
||||
* default value can be changed by using the
|
||||
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout).
|
||||
*/
|
||||
timeout?: number;
|
||||
}): Promise<Page>;
|
||||
|
||||
/**
|
||||
* Returns the main process for this Electron Application.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user