You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dotnet/docs/api/class-browsertype.mdx
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,6 +180,9 @@ var browser = await playwright.Chromium.LaunchAsync(new() {
180
180
:::
181
181
182
182
Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](https://peter.sh/experiments/chromium-command-line-switches/).
If specified, artifacts (traces, videos, downloads, HAR files, etc.) are saved into this directory. The directory is not cleaned up when the browser closes. If not specified, a temporary directory is used and cleaned up when the browser closes.
Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](https://peter.sh/experiments/chromium-command-line-switches/).
If specified, artifacts (traces, videos, downloads, HAR files, etc.) are saved into this directory. The directory is not cleaned up when the browser closes. If not specified, a temporary directory is used and cleaned up when the browser closes.
When using [Page.GotoAsync()](/api/class-page.mdx#page-goto), [Page.RouteAsync()](/api/class-page.mdx#page-route), [Page.WaitForURLAsync()](/api/class-page.mdx#page-wait-for-url), [Page.RunAndWaitForRequestAsync()](/api/class-page.mdx#page-wait-for-request), or [Page.RunAndWaitForResponseAsync()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Unset by default. Examples:
Copy file name to clipboardExpand all lines: dotnet/docs/ci-intro.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ Click on the **Actions** tab to see the workflows. Here you see if your tests ha
69
69
70
70
On Pull Requests you can also click on the **Details** link in the [PR status check](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks).
71
71
72
-
<img width="645" alt="pr status checked" src="https://user-images.githubusercontent.com/13063165/183722462-17a985db-0e10-4205-b16c-8aaac36117b9.png" />
72
+
<img height="404" width="1290" alt="pr status checked" src="https://user-images.githubusercontent.com/13063165/183722462-17a985db-0e10-4205-b16c-8aaac36117b9.png" />
<imgwidth="870"alt="Codegen generating code for tests for playwright.dev website with a specific viewport dotnet"src="https://user-images.githubusercontent.com/13063165/220403496-4a46a9a1-4bc4-43e7-8f22-9cc760ceadaf.png" />
70
+
<imgheight="1496"width="1740"alt="Codegen generating code for tests for playwright.dev website with a specific viewport dotnet"src="https://user-images.githubusercontent.com/13063165/220403496-4a46a9a1-4bc4-43e7-8f22-9cc760ceadaf.png" />
<imgwidth="1300"alt="Codegen generating code for tests for playwright.dev website emulated for iPhone 13 csharp"src="https://user-images.githubusercontent.com/13063165/220923048-f13583b1-ab08-4702-ab74-58691d50acfe.png" />
81
+
<imgheight="1660"width="2600"alt="Codegen generating code for tests for playwright.dev website emulated for iPhone 13 csharp"src="https://user-images.githubusercontent.com/13063165/220923048-f13583b1-ab08-4702-ab74-58691d50acfe.png" />
<imgwidth="1394"alt="Codegen generating code for tests for playwright.dev website in dark mode csharp"src="https://user-images.githubusercontent.com/13063165/220930893-c1d0df65-c662-4b33-91eb-ea10552d7cc5.png" />
92
+
<imgheight="1824"width="2788"alt="Codegen generating code for tests for playwright.dev website in dark mode csharp"src="https://user-images.githubusercontent.com/13063165/220930893-c1d0df65-c662-4b33-91eb-ea10552d7cc5.png" />
<imgwidth="1394"alt="Codegen generating code for tests for bing maps showing timezone, geolocation as Rome, Italy and in Italian language csharp"src="https://user-images.githubusercontent.com/13063165/220932688-a47df2a8-332b-47a4-9580-7d351def9f50.png" />
105
+
<imgheight="1824"width="2788"alt="Codegen generating code for tests for bing maps showing timezone, geolocation as Rome, Italy and in Italian language csharp"src="https://user-images.githubusercontent.com/13063165/220932688-a47df2a8-332b-47a4-9580-7d351def9f50.png" />
<imgwidth="1394"alt="github page before logging in csharp"src="https://user-images.githubusercontent.com/13063165/220929619-28d4ed0c-d172-4cf1-b30b-bf5bed0e07bf.png" />
116
+
<imgheight="1824"width="2788"alt="github page before logging in csharp"src="https://user-images.githubusercontent.com/13063165/220929619-28d4ed0c-d172-4cf1-b30b-bf5bed0e07bf.png" />
117
117
118
118
#### Login
119
119
120
120
After performing authentication and closing the browser, `auth.json` will contain the storage state which you can then reuse in your tests.
121
121
122
-
<imgwidth="1394"alt="login to GitHub screen"src="https://user-images.githubusercontent.com/13063165/220561688-04b2b984-4ba6-4446-8b0a-8058876e2a02.png" />
122
+
<imgheight="1824"width="2788"alt="login to GitHub screen"src="https://user-images.githubusercontent.com/13063165/220561688-04b2b984-4ba6-4446-8b0a-8058876e2a02.png" />
123
123
124
124
Make sure you only use the `auth.json` locally as it contains sensitive information. Add it to your `.gitignore` or delete it once you have finished generating your tests.
<imgwidth="1394"alt="github signed in showing use of load storage scharp"src="https://user-images.githubusercontent.com/13063165/220928354-caa0e958-fe09-4125-9b54-67483064da51.png" />
135
+
<imgheight="1824"width="2788"alt="github signed in showing use of load storage scharp"src="https://user-images.githubusercontent.com/13063165/220928354-caa0e958-fe09-4125-9b54-67483064da51.png" />
Copy file name to clipboardExpand all lines: dotnet/docs/debug.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ import HTMLCard from '@site/src/components/HTMLCard';
10
10
11
11
The Playwright Inspector is a GUI tool to help you debug your Playwright tests. It allows you to step through your tests, live edit locators, pick locators and see actionability logs.
You can play, pause or step through each action of your test using the toolbar at the top of the Inspector. You can see the current action highlighted in the test code, and matching elements highlighted in the browser window.
58
58
59
-
<imgwidth="1340"alt="Playwright Inspector and browser"src="https://user-images.githubusercontent.com/13063165/212936618-84b87acc-bc2e-46ed-994b-32b2ef742e60.png" />
59
+
<imgheight="1736"width="2680"alt="Playwright Inspector and browser"src="https://user-images.githubusercontent.com/13063165/212936618-84b87acc-bc2e-46ed-994b-32b2ef742e60.png" />
60
60
61
61
### Run a test from a specific breakpoint
62
62
@@ -68,27 +68,27 @@ await page.PauseAsync();
68
68
69
69
Once you add a `page.pause()` call, run your tests in debug mode. Clicking the "Resume" button in the Inspector will run the test and only stop on the `page.pause()`.
70
70
71
-
<imgwidth="1350"alt="test with page.pause"src="https://user-images.githubusercontent.com/13063165/219473050-122be4c2-31d0-4cbd-aa8b-8588e8b781a6.png" />
71
+
<imgheight="1736"width="2700"alt="test with page.pause"src="https://user-images.githubusercontent.com/13063165/219473050-122be4c2-31d0-4cbd-aa8b-8588e8b781a6.png" />
72
72
73
73
### Live editing locators
74
74
75
75
While running in debug mode you can live edit the locators. Next to the 'Pick Locator' button there is a field showing the [locator](./locators.mdx) that the test is paused on. You can edit this locator directly in the **Pick Locator** field, and matching elements will be highlighted in the browser window.
While debugging, you might need to choose a more resilient locator. You can do this by clicking on the **Pick Locator** button and hovering over any element in the browser window. While hovering over an element you will see the code needed to locate this element highlighted below. Clicking an element in the browser will add the locator into the field where you can then either tweak it or copy it into your code.
Playwright will look at your page and figure out the best locator, prioritizing [role, text and test id locators](./locators.mdx). If Playwright finds multiple elements matching the locator, it will improve the locator to make it resilient and uniquely identify the target element, so you don't have to worry about failing tests due to locators.
86
86
87
87
### Actionability logs
88
88
89
89
By the time Playwright has paused on a click action, it has already performed [actionability checks](./actionability.mdx) that can be found in the log. This can help you understand what happened during your test and what Playwright did or tried to do. The log tells you if the element was visible, enabled and stable, if the locator resolved to an element, scrolled into view, and so much more. If actionability can't be reached, it will show the action as pending.
@@ -109,7 +109,7 @@ When running in Debug Mode with `PWDEBUG=console`, a `playwright` object is avai
109
109
-**See console logs** during execution (or learn how to [read logs via API](./api/class-page.mdx#page-event-console))
110
110
- Check **network activity** and other developer tools features
111
111
112
-
<imgwidth="1399"alt="Browser Developer Tools with Playwright object"src="https://user-images.githubusercontent.com/13063165/219128002-898f604d-9697-4b7f-95b5-a6a8260b7282.png" />
112
+
<imgheight="1626"width="2798"alt="Browser Developer Tools with Playwright object"src="https://user-images.githubusercontent.com/13063165/219128002-898f604d-9697-4b7f-95b5-a6a8260b7282.png" />
113
113
114
114
To debug your tests using the browser developer tools, start by setting a breakpoint in your test to pause the execution using the [Page.PauseAsync()](/api/class-page.mdx#page-pause) method.
<imgwidth="458"alt="playwright.dev website emulated for iPhone 13"src="https://user-images.githubusercontent.com/13063165/220411073-76fe59f9-9a2d-463d-8e30-c19a7deca133.png" />
30
+
<imgheight="1582"width="916"alt="playwright.dev website emulated for iPhone 13"src="https://user-images.githubusercontent.com/13063165/220411073-76fe59f9-9a2d-463d-8e30-c19a7deca133.png" />
31
31
32
32
## Viewport
33
33
@@ -78,7 +78,7 @@ await using var context = await browser.NewContextAsync(new()
78
78
});
79
79
```
80
80
81
-
<imgwidth="1394"alt="Bing in german lang and timezone"src="https://user-images.githubusercontent.com/13063165/220416571-ccc96ab1-44bb-4579-8430-64502fc24a15.png" />
81
+
<imgheight="1824"width="2788"alt="Bing in german lang and timezone"src="https://user-images.githubusercontent.com/13063165/220416571-ccc96ab1-44bb-4579-8430-64502fc24a15.png" />
82
82
83
83
## Permissions
84
84
@@ -108,7 +108,7 @@ await using var context = await browser.NewContextAsync(new()
108
108
});
109
109
```
110
110
111
-
<imgwidth="1394"alt="geolocation for italy on bing maps"src="https://user-images.githubusercontent.com/13063165/220417670-bb22d815-f5cd-47c4-8562-0b88165eac27.png" />
111
+
<imgheight="1824"width="2788"alt="geolocation for italy on bing maps"src="https://user-images.githubusercontent.com/13063165/220417670-bb22d815-f5cd-47c4-8562-0b88165eac27.png" />
<imgwidth="1394"alt="playwright web in dark mode"src="https://user-images.githubusercontent.com/13063165/220411638-55d2b051-4678-4da7-9f0b-ed22f5a3c47c.png" />
151
+
<imgheight="1824"width="2788"alt="playwright web in dark mode"src="https://user-images.githubusercontent.com/13063165/220411638-55d2b051-4678-4da7-9f0b-ed22f5a3c47c.png" />
Copy file name to clipboardExpand all lines: dotnet/docs/other-locators.mdx
+15-5Lines changed: 15 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ Consider a page with two buttons, first invisible and second visible.
99
99
100
100
### CSS: elements that contain other elements
101
101
102
-
The `:has()` pseudo-class is an [experimental CSS pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:has). It returns an element if any of the selectors passed as parameters relative to the `:scope` of the given element match at least one element.
102
+
The `:has()` pseudo-class is a [CSS pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:has). It returns an element if any of the selectors passed as parameters relative to the `:scope` of the given element match at least one element.
103
103
104
104
Following snippet returns text content of an `<article>` element that has a `<div class=promo>` inside.
105
105
@@ -116,7 +116,7 @@ Comma-separated list of CSS selectors will match all elements that can be select
The `:is()` pseudo-class is an [experimental CSS pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:is) that may be useful for specifying a list of extra conditions on an element.
119
+
The `:is()` pseudo-class is a [CSS pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:is) that may be useful for specifying a list of extra conditions on an element.
120
120
121
121
### CSS: matching elements based on layout
122
122
@@ -165,9 +165,19 @@ It is usually possible to distinguish elements by some attribute or text content
165
165
Sometimes page contains a number of similar elements, and it is hard to select a particular one. For example:
0 commit comments