@@ -154,8 +154,9 @@ type Browser interface {
154
154
// opened).
155
155
// In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from
156
156
// the browser server.
157
- // **NOTE** This is similar to force quitting the browser. Therefore, you should call [BrowserContext.Close] on any
158
- // [BrowserContext]'s you explicitly created earlier with [Browser.NewContext] **before** calling [Browser.Close].
157
+ // **NOTE** This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close
158
+ // events, call [BrowserContext.Close] on any [BrowserContext] instances you explicitly created earlier using
159
+ // [Browser.NewContext] **before** calling [Browser.Close].
159
160
// The [Browser] object itself is considered to be disposed and cannot be used anymore.
160
161
Close (options ... BrowserCloseOptions ) error
161
162
@@ -336,9 +337,13 @@ type BrowserContext interface {
336
337
// Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
337
338
// specified.
338
339
//
339
- // permissions: A permission or an array of permissions to grant. Permissions can be one of the following values:
340
+ // permissions: A list of permissions to grant.
341
+ //
342
+ // **NOTE** Supported permissions differ between browsers, and even between different versions of the same browser.
343
+ // Any permission may stop working after an update.
344
+ //
345
+ // Here are some permissions that may be supported by some browsers:
340
346
// - `'accelerometer'`
341
- // - `'accessibility-events'`
342
347
// - `'ambient-light-sensor'`
343
348
// - `'background-sync'`
344
349
// - `'camera'`
@@ -428,7 +433,7 @@ type BrowserContext interface {
428
433
// **NOTE** [Page.SetDefaultNavigationTimeout], [Page.SetDefaultTimeout] and
429
434
// [BrowserContext.SetDefaultNavigationTimeout] take priority over [BrowserContext.SetDefaultTimeout].
430
435
//
431
- // timeout: Maximum time in milliseconds
436
+ // timeout: Maximum time in milliseconds. Pass `0` to disable timeout.
432
437
SetDefaultTimeout (timeout float64 )
433
438
434
439
// The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are
@@ -490,16 +495,19 @@ type BrowserContext interface {
490
495
// BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is
491
496
// a typical example of using Playwright to drive automation:
492
497
type BrowserType interface {
493
- // This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
494
- // `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is
495
- // compatible with 1.2.x).
498
+ // This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
499
+ // **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
500
+ // Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
496
501
//
497
- // wsEndpoint: A browser websocket endpoint to connect to.
502
+ // wsEndpoint: A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint` .
498
503
Connect (wsEndpoint string , options ... BrowserTypeConnectOptions ) (Browser , error )
499
504
500
505
// This method attaches Playwright to an existing browser instance using the Chrome DevTools Protocol.
501
506
// The default browser context is accessible via [Browser.Contexts].
502
507
// **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
508
+ // **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
509
+ // [BrowserType.Connect]. If you are experiencing issues or attempting to use advanced functionality, you probably
510
+ // want to use [BrowserType.Connect].
503
511
//
504
512
// endpointURL: A CDP websocket endpoint or http url to connect to. For example `http://localhost:9222/` or
505
513
// `ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4`.
@@ -2597,7 +2605,9 @@ type Locator interface {
2597
2605
// [assertions guide]: https://playwright.dev/docs/test-assertions
2598
2606
IsDisabled (options ... LocatorIsDisabledOptions ) (bool , error )
2599
2607
2600
- // Returns whether the element is [editable].
2608
+ // Returns whether the element is [editable]. If the target element is not an `<input>`,
2609
+ // `<textarea>`, `<select>`, `[contenteditable]` and does not have a role allowing `[aria-readonly]`, this method
2610
+ // throws an error.
2601
2611
// **NOTE** If you need to assert that an element is editable, prefer [LocatorAssertions.ToBeEditable] to avoid
2602
2612
// flakiness. See [assertions guide] for more details.
2603
2613
//
@@ -2645,12 +2655,13 @@ type Locator interface {
2645
2655
Nth (index int ) Locator
2646
2656
2647
2657
// Creates a locator matching all elements that match one or both of the two locators.
2648
- // Note that when both locators match something, the resulting locator will have multiple matches and violate
2649
- // [locator strictness] guidelines .
2658
+ // Note that when both locators match something, the resulting locator will have multiple matches, potentially causing
2659
+ // a [locator strictness] violation .
2650
2660
//
2651
2661
// locator: Alternative locator to match.
2652
2662
//
2653
2663
// [locator strictness]: https://playwright.dev/docs/locators#strictness
2664
+ // ["strict mode violation" error]: https://playwright.dev/docs/locators#strictness
2654
2665
Or (locator Locator ) Locator
2655
2666
2656
2667
// A page this locator belongs to.
@@ -2911,6 +2922,14 @@ type LocatorAssertions interface {
2911
2922
// [accessible description]: https://w3c.github.io/accname/#dfn-accessible-description
2912
2923
ToHaveAccessibleDescription (description interface {}, options ... LocatorAssertionsToHaveAccessibleDescriptionOptions ) error
2913
2924
2925
+ // Ensures the [Locator] points to an element with a given
2926
+ // [aria errormessage].
2927
+ //
2928
+ // errorMessage: Expected accessible error message.
2929
+ //
2930
+ // [aria errormessage]: https://w3c.github.io/aria/#aria-errormessage
2931
+ ToHaveAccessibleErrorMessage (errorMessage interface {}, options ... LocatorAssertionsToHaveAccessibleErrorMessageOptions ) error
2932
+
2914
2933
// Ensures the [Locator] points to an element with a given
2915
2934
// [accessible name].
2916
2935
//
@@ -2925,8 +2944,8 @@ type LocatorAssertions interface {
2925
2944
// 2. value: Expected attribute value.
2926
2945
ToHaveAttribute (name string , value interface {}, options ... LocatorAssertionsToHaveAttributeOptions ) error
2927
2946
2928
- // Ensures the [Locator] points to an element with given CSS classes. This needs to be a full match or using a relaxed
2929
- // regular expression.
2947
+ // Ensures the [Locator] points to an element with given CSS classes. When a string is provided, it must fully match
2948
+ // the element's `class` attribute. To match individual classes or perform partial matches, use a regular expression:
2930
2949
//
2931
2950
// expected: Expected class or RegExp or a list of those.
2932
2951
ToHaveClass (expected interface {}, options ... LocatorAssertionsToHaveClassOptions ) error
@@ -3659,7 +3678,6 @@ type Page interface {
3659
3678
Pause () error
3660
3679
3661
3680
// Returns the PDF buffer.
3662
- // **NOTE** Generating a pdf is currently only supported in Chromium headless.
3663
3681
// `page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call
3664
3682
// [Page.EmulateMedia] before calling `page.pdf()`:
3665
3683
// **NOTE** By default, `page.pdf()` generates a pdf with modified colors for printing. Use the
@@ -3875,7 +3893,7 @@ type Page interface {
3875
3893
// This setting will change the default maximum time for all the methods accepting “[object Object]” option.
3876
3894
// **NOTE** [Page.SetDefaultNavigationTimeout] takes priority over [Page.SetDefaultTimeout].
3877
3895
//
3878
- // timeout: Maximum time in milliseconds
3896
+ // timeout: Maximum time in milliseconds. Pass `0` to disable timeout.
3879
3897
SetDefaultTimeout (timeout float64 )
3880
3898
3881
3899
// The extra HTTP headers will be sent with every request the page initiates.
0 commit comments