codeceptjs 3.5.12-beta.1 → 3.5.12-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/advanced.md +351 -0
- package/docs/ai.md +248 -0
- package/docs/api.md +323 -0
- package/docs/basics.md +979 -0
- package/docs/bdd.md +539 -0
- package/docs/best.md +237 -0
- package/docs/books.md +37 -0
- package/docs/bootstrap.md +135 -0
- package/docs/build/ApiDataFactory.js +410 -0
- package/docs/build/Appium.js +2027 -0
- package/docs/build/Expect.js +422 -0
- package/docs/build/FileSystem.js +228 -0
- package/docs/build/GraphQL.js +229 -0
- package/docs/build/GraphQLDataFactory.js +309 -0
- package/docs/build/JSONResponse.js +338 -0
- package/docs/build/Mochawesome.js +71 -0
- package/docs/build/Nightmare.js +2152 -0
- package/docs/build/OpenAI.js +126 -0
- package/docs/build/Playwright.js +5110 -0
- package/docs/build/Protractor.js +2706 -0
- package/docs/build/Puppeteer.js +3905 -0
- package/docs/build/REST.js +344 -0
- package/docs/build/TestCafe.js +2125 -0
- package/docs/build/WebDriver.js +4240 -0
- package/docs/changelog.md +2572 -0
- package/docs/commands.md +266 -0
- package/docs/community-helpers.md +58 -0
- package/docs/configuration.md +157 -0
- package/docs/continuous-integration.md +22 -0
- package/docs/custom-helpers.md +306 -0
- package/docs/data.md +379 -0
- package/docs/detox.md +235 -0
- package/docs/docker.md +136 -0
- package/docs/email.md +183 -0
- package/docs/examples.md +149 -0
- package/docs/helpers/ApiDataFactory.md +266 -0
- package/docs/helpers/Appium.md +1374 -0
- package/docs/helpers/Detox.md +586 -0
- package/docs/helpers/Expect.md +275 -0
- package/docs/helpers/FileSystem.md +152 -0
- package/docs/helpers/GraphQL.md +151 -0
- package/docs/helpers/GraphQLDataFactory.md +226 -0
- package/docs/helpers/JSONResponse.md +254 -0
- package/docs/helpers/Mochawesome.md +8 -0
- package/docs/helpers/MockRequest.md +377 -0
- package/docs/helpers/Nightmare.md +1305 -0
- package/docs/helpers/OpenAI.md +70 -0
- package/docs/helpers/Playwright.md +2759 -0
- package/docs/helpers/Polly.md +44 -0
- package/docs/helpers/Protractor.md +1769 -0
- package/docs/helpers/Puppeteer-firefox.md +86 -0
- package/docs/helpers/Puppeteer.md +2317 -0
- package/docs/helpers/REST.md +218 -0
- package/docs/helpers/TestCafe.md +1321 -0
- package/docs/helpers/WebDriver.md +2547 -0
- package/docs/hooks.md +340 -0
- package/docs/index.md +111 -0
- package/docs/installation.md +75 -0
- package/docs/internal-api.md +266 -0
- package/docs/locators.md +339 -0
- package/docs/mobile-react-native-locators.md +67 -0
- package/docs/mobile.md +338 -0
- package/docs/pageobjects.md +291 -0
- package/docs/parallel.md +400 -0
- package/docs/playwright.md +632 -0
- package/docs/plugins.md +1259 -0
- package/docs/puppeteer.md +316 -0
- package/docs/quickstart.md +162 -0
- package/docs/react.md +70 -0
- package/docs/reports.md +392 -0
- package/docs/secrets.md +36 -0
- package/docs/shadow.md +68 -0
- package/docs/shared/keys.mustache +31 -0
- package/docs/shared/react.mustache +1 -0
- package/docs/testcafe.md +174 -0
- package/docs/translation.md +247 -0
- package/docs/tutorial.md +271 -0
- package/docs/typescript.md +180 -0
- package/docs/ui.md +59 -0
- package/docs/videos.md +28 -0
- package/docs/visual.md +202 -0
- package/docs/vue.md +143 -0
- package/docs/webapi/amOnPage.mustache +11 -0
- package/docs/webapi/appendField.mustache +11 -0
- package/docs/webapi/attachFile.mustache +12 -0
- package/docs/webapi/blur.mustache +18 -0
- package/docs/webapi/checkOption.mustache +13 -0
- package/docs/webapi/clearCookie.mustache +9 -0
- package/docs/webapi/clearField.mustache +9 -0
- package/docs/webapi/click.mustache +25 -0
- package/docs/webapi/clickLink.mustache +8 -0
- package/docs/webapi/closeCurrentTab.mustache +7 -0
- package/docs/webapi/closeOtherTabs.mustache +8 -0
- package/docs/webapi/dontSee.mustache +11 -0
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +10 -0
- package/docs/webapi/dontSeeCookie.mustache +8 -0
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +10 -0
- package/docs/webapi/dontSeeElement.mustache +8 -0
- package/docs/webapi/dontSeeElementInDOM.mustache +8 -0
- package/docs/webapi/dontSeeInCurrentUrl.mustache +4 -0
- package/docs/webapi/dontSeeInField.mustache +11 -0
- package/docs/webapi/dontSeeInSource.mustache +8 -0
- package/docs/webapi/dontSeeInTitle.mustache +8 -0
- package/docs/webapi/doubleClick.mustache +13 -0
- package/docs/webapi/downloadFile.mustache +12 -0
- package/docs/webapi/dragAndDrop.mustache +9 -0
- package/docs/webapi/dragSlider.mustache +11 -0
- package/docs/webapi/executeAsyncScript.mustache +24 -0
- package/docs/webapi/executeScript.mustache +26 -0
- package/docs/webapi/fillField.mustache +16 -0
- package/docs/webapi/focus.mustache +13 -0
- package/docs/webapi/forceClick.mustache +28 -0
- package/docs/webapi/forceRightClick.mustache +18 -0
- package/docs/webapi/grabAllWindowHandles.mustache +7 -0
- package/docs/webapi/grabAttributeFrom.mustache +10 -0
- package/docs/webapi/grabAttributeFromAll.mustache +9 -0
- package/docs/webapi/grabBrowserLogs.mustache +9 -0
- package/docs/webapi/grabCookie.mustache +11 -0
- package/docs/webapi/grabCssPropertyFrom.mustache +11 -0
- package/docs/webapi/grabCssPropertyFromAll.mustache +10 -0
- package/docs/webapi/grabCurrentUrl.mustache +9 -0
- package/docs/webapi/grabCurrentWindowHandle.mustache +6 -0
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +20 -0
- package/docs/webapi/grabElementBoundingRect.mustache +20 -0
- package/docs/webapi/grabGeoLocation.mustache +8 -0
- package/docs/webapi/grabHTMLFrom.mustache +10 -0
- package/docs/webapi/grabHTMLFromAll.mustache +9 -0
- package/docs/webapi/grabNumberOfOpenTabs.mustache +8 -0
- package/docs/webapi/grabNumberOfVisibleElements.mustache +9 -0
- package/docs/webapi/grabPageScrollPosition.mustache +8 -0
- package/docs/webapi/grabPopupText.mustache +5 -0
- package/docs/webapi/grabSource.mustache +8 -0
- package/docs/webapi/grabTextFrom.mustache +10 -0
- package/docs/webapi/grabTextFromAll.mustache +9 -0
- package/docs/webapi/grabTitle.mustache +8 -0
- package/docs/webapi/grabValueFrom.mustache +9 -0
- package/docs/webapi/grabValueFromAll.mustache +8 -0
- package/docs/webapi/grabWebElement.mustache +9 -0
- package/docs/webapi/grabWebElements.mustache +9 -0
- package/docs/webapi/moveCursorTo.mustache +12 -0
- package/docs/webapi/openNewTab.mustache +7 -0
- package/docs/webapi/pressKey.mustache +12 -0
- package/docs/webapi/pressKeyDown.mustache +12 -0
- package/docs/webapi/pressKeyUp.mustache +12 -0
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +60 -0
- package/docs/webapi/refreshPage.mustache +6 -0
- package/docs/webapi/resizeWindow.mustache +6 -0
- package/docs/webapi/rightClick.mustache +14 -0
- package/docs/webapi/saveElementScreenshot.mustache +10 -0
- package/docs/webapi/saveScreenshot.mustache +12 -0
- package/docs/webapi/say.mustache +10 -0
- package/docs/webapi/scrollIntoView.mustache +11 -0
- package/docs/webapi/scrollPageToBottom.mustache +6 -0
- package/docs/webapi/scrollPageToTop.mustache +6 -0
- package/docs/webapi/scrollTo.mustache +12 -0
- package/docs/webapi/see.mustache +11 -0
- package/docs/webapi/seeAttributesOnElements.mustache +9 -0
- package/docs/webapi/seeCheckboxIsChecked.mustache +10 -0
- package/docs/webapi/seeCookie.mustache +8 -0
- package/docs/webapi/seeCssPropertiesOnElements.mustache +9 -0
- package/docs/webapi/seeCurrentUrlEquals.mustache +11 -0
- package/docs/webapi/seeElement.mustache +8 -0
- package/docs/webapi/seeElementInDOM.mustache +8 -0
- package/docs/webapi/seeInCurrentUrl.mustache +8 -0
- package/docs/webapi/seeInField.mustache +12 -0
- package/docs/webapi/seeInPopup.mustache +8 -0
- package/docs/webapi/seeInSource.mustache +7 -0
- package/docs/webapi/seeInTitle.mustache +8 -0
- package/docs/webapi/seeNumberOfElements.mustache +11 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +10 -0
- package/docs/webapi/seeTextEquals.mustache +9 -0
- package/docs/webapi/seeTitleEquals.mustache +8 -0
- package/docs/webapi/selectOption.mustache +21 -0
- package/docs/webapi/setCookie.mustache +16 -0
- package/docs/webapi/setGeoLocation.mustache +12 -0
- package/docs/webapi/switchTo.mustache +9 -0
- package/docs/webapi/switchToNextTab.mustache +10 -0
- package/docs/webapi/switchToPreviousTab.mustache +10 -0
- package/docs/webapi/type.mustache +21 -0
- package/docs/webapi/uncheckOption.mustache +13 -0
- package/docs/webapi/wait.mustache +8 -0
- package/docs/webapi/waitForClickable.mustache +11 -0
- package/docs/webapi/waitForDetached.mustache +10 -0
- package/docs/webapi/waitForElement.mustache +11 -0
- package/docs/webapi/waitForEnabled.mustache +6 -0
- package/docs/webapi/waitForFunction.mustache +17 -0
- package/docs/webapi/waitForInvisible.mustache +10 -0
- package/docs/webapi/waitForNumberOfTabs.mustache +9 -0
- package/docs/webapi/waitForText.mustache +13 -0
- package/docs/webapi/waitForValue.mustache +10 -0
- package/docs/webapi/waitForVisible.mustache +10 -0
- package/docs/webapi/waitInUrl.mustache +9 -0
- package/docs/webapi/waitNumberOfVisibleElements.mustache +10 -0
- package/docs/webapi/waitToHide.mustache +10 -0
- package/docs/webapi/waitUrlEquals.mustache +10 -0
- package/docs/webdriver.md +701 -0
- package/docs/wiki/Books-&-Posts.md +27 -0
- package/docs/wiki/Community-Helpers-&-Plugins.md +53 -0
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +61 -0
- package/docs/wiki/Examples.md +145 -0
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +68 -0
- package/docs/wiki/Home.md +16 -0
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
- package/docs/wiki/Release-Process.md +24 -0
- package/docs/wiki/Roadmap.md +23 -0
- package/docs/wiki/Tests.md +1393 -0
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +153 -0
- package/docs/wiki/Videos.md +19 -0
- package/lib/css2xpath/js/css_to_xpath.js +20 -0
- package/lib/css2xpath/js/expression.js +23 -0
- package/lib/css2xpath/js/renderer.js +239 -0
- package/lib/locator.js +15 -1
- package/package.json +12 -9
|
@@ -0,0 +1,2759 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /helpers/Playwright
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: Playwright
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## Playwright
|
|
11
|
+
|
|
12
|
+
**Extends Helper**
|
|
13
|
+
|
|
14
|
+
Uses [Playwright][1] library to run tests inside:
|
|
15
|
+
|
|
16
|
+
- Chromium
|
|
17
|
+
- Firefox
|
|
18
|
+
- Webkit (Safari)
|
|
19
|
+
|
|
20
|
+
This helper works with a browser out of the box with no additional tools required to install.
|
|
21
|
+
|
|
22
|
+
Requires `playwright` or `playwright-core` package version ^1 to be installed:
|
|
23
|
+
|
|
24
|
+
npm i playwright@^1.18 --save
|
|
25
|
+
|
|
26
|
+
or
|
|
27
|
+
|
|
28
|
+
npm i playwright-core@^1.18 --save
|
|
29
|
+
|
|
30
|
+
Breaking Changes: if you use Playwright v1.38 and later, it will no longer download browsers automatically.
|
|
31
|
+
|
|
32
|
+
Run `npx playwright install` to download browsers after `npm install`.
|
|
33
|
+
|
|
34
|
+
Using playwright-core package, will prevent the download of browser binaries and allow connecting to an existing browser installation or for connecting to a remote one.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
This helper should be configured in codecept.conf.(js|ts)
|
|
41
|
+
|
|
42
|
+
Type: [object][6]
|
|
43
|
+
|
|
44
|
+
### Properties
|
|
45
|
+
|
|
46
|
+
- `url` **[string][9]?** base url of website to be tested
|
|
47
|
+
- `browser` **(`"chromium"` | `"firefox"` | `"webkit"` | `"electron"`)?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
48
|
+
- `show` **[boolean][26]?** show browser window.
|
|
49
|
+
- `restart` **([string][9] | [boolean][26])?** restart strategy between tests. Possible values:- 'context' or **false** - restarts [browser context][44] but keeps running browser. Recommended by Playwright team to keep tests isolated.
|
|
50
|
+
- 'browser' or **true** - closes browser and opens it again between tests.
|
|
51
|
+
- 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with `keepCookies` and `keepBrowserState` options. This behavior was default before CodeceptJS 3.1
|
|
52
|
+
- `timeout` **[number][20]?** - [timeout][45] in ms of all Playwright actions .
|
|
53
|
+
- `disableScreenshots` **[boolean][26]?** don't save screenshot on failure.
|
|
54
|
+
- `emulate` **any?** browser in device emulation mode.
|
|
55
|
+
- `video` **[boolean][26]?** enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
56
|
+
- `keepVideoForPassedTests` **[boolean][26]?** save videos for passed tests; videos are saved into `output/videos` folder
|
|
57
|
+
- `trace` **[boolean][26]?** record [tracing information][46] with screenshots and snapshots.
|
|
58
|
+
- `keepTraceForPassedTests` **[boolean][26]?** save trace for passed tests.
|
|
59
|
+
- `fullPageScreenshots` **[boolean][26]?** make full page screenshots on failure.
|
|
60
|
+
- `uniqueScreenshotNames` **[boolean][26]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
61
|
+
- `keepBrowserState` **[boolean][26]?** keep browser state between tests when `restart` is set to 'session'.
|
|
62
|
+
- `keepCookies` **[boolean][26]?** keep cookies between tests when `restart` is set to 'session'.
|
|
63
|
+
- `waitForAction` **[number][20]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
64
|
+
- `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"commit"`)?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `commit`. Choose one of those options is possible. See [Playwright API][42].
|
|
65
|
+
- `pressKeyDelay` **[number][20]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
66
|
+
- `getPageTimeout` **[number][20]?** config option to set maximum navigation time in milliseconds.
|
|
67
|
+
- `waitForTimeout` **[number][20]?** default wait* timeout in ms. Default: 1000.
|
|
68
|
+
- `basicAuth` **[object][6]?** the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
69
|
+
- `windowSize` **[string][9]?** default window size. Set a dimension like `640x480`.
|
|
70
|
+
- `colorScheme` **(`"dark"` | `"light"` | `"no-preference"`)?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
71
|
+
- `userAgent` **[string][9]?** user-agent string.
|
|
72
|
+
- `locale` **[string][9]?** locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
73
|
+
- `manualStart` **[boolean][26]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
74
|
+
- `chromium` **[object][6]?** pass additional chromium options
|
|
75
|
+
- `firefox` **[object][6]?** pass additional firefox options
|
|
76
|
+
- `electron` **[object][6]?** (pass additional electron options
|
|
77
|
+
- `channel` **any?** (While Playwright can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. See [Google Chrome & Microsoft Edge][47].
|
|
78
|
+
- `ignoreLog` **[Array][10]<[string][9]>?** An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values][48].
|
|
79
|
+
- `ignoreHTTPSErrors` **[boolean][26]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
80
|
+
- `bypassCSP` **[boolean][26]?** bypass Content Security Policy or CSP
|
|
81
|
+
- `highlightElement` **[boolean][26]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
82
|
+
- `recordHar` **[object][6]?** record HAR and will be saved to `output/har`. See more of [HAR options][3].
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
#### Video Recording Customization
|
|
87
|
+
|
|
88
|
+
By default, video is saved to `output/video` dir. You can customize this path by passing `dir` option to `recordVideo` option.
|
|
89
|
+
|
|
90
|
+
`video`: enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
91
|
+
|
|
92
|
+
- `keepVideoForPassedTests`: - save videos for passed tests
|
|
93
|
+
- `recordVideo`: [additional options for videos customization][2]
|
|
94
|
+
|
|
95
|
+
#### Trace Recording Customization
|
|
96
|
+
|
|
97
|
+
Trace recording provides complete information on test execution and includes DOM snapshots, screenshots, and network requests logged during run.
|
|
98
|
+
Traces will be saved to `output/trace`
|
|
99
|
+
|
|
100
|
+
- `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
|
|
101
|
+
- `keepTraceForPassedTests`: - save trace for passed tests
|
|
102
|
+
|
|
103
|
+
#### HAR Recording Customization
|
|
104
|
+
|
|
105
|
+
A HAR file is an HTTP Archive file that contains a record of all the network requests that are made when a page is loaded.
|
|
106
|
+
It contains information about the request and response headers, cookies, content, timings, and more. You can use HAR files to mock network requests in your tests.
|
|
107
|
+
HAR will be saved to `output/har`. More info could be found here [https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har][3].
|
|
108
|
+
|
|
109
|
+
...
|
|
110
|
+
recordHar: {
|
|
111
|
+
mode: 'minimal', // possible values: 'minimal'|'full'.
|
|
112
|
+
content: 'embed' // possible values: "omit"|"embed"|"attach".
|
|
113
|
+
}
|
|
114
|
+
...
|
|
115
|
+
|
|
116
|
+
#### Example #1: Wait for 0 network connections.
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
{
|
|
120
|
+
helpers: {
|
|
121
|
+
Playwright : {
|
|
122
|
+
url: "http://localhost",
|
|
123
|
+
restart: false,
|
|
124
|
+
waitForNavigation: "networkidle0",
|
|
125
|
+
waitForAction: 500
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Example #2: Wait for DOMContentLoaded event
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
{
|
|
135
|
+
helpers: {
|
|
136
|
+
Playwright : {
|
|
137
|
+
url: "http://localhost",
|
|
138
|
+
restart: false,
|
|
139
|
+
waitForNavigation: "domcontentloaded",
|
|
140
|
+
waitForAction: 500
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Example #3: Debug in window mode
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
{
|
|
150
|
+
helpers: {
|
|
151
|
+
Playwright : {
|
|
152
|
+
url: "http://localhost",
|
|
153
|
+
show: true
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Example #4: Connect to remote browser by specifying [websocket endpoint][4]
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
{
|
|
163
|
+
helpers: {
|
|
164
|
+
Playwright: {
|
|
165
|
+
url: "http://localhost",
|
|
166
|
+
chromium: {
|
|
167
|
+
browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a',
|
|
168
|
+
cdpConnection: false // default is false
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### Example #5: Testing with Chromium extensions
|
|
176
|
+
|
|
177
|
+
[official docs][5]
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
{
|
|
181
|
+
helpers: {
|
|
182
|
+
Playwright: {
|
|
183
|
+
url: "http://localhost",
|
|
184
|
+
show: true // headless mode not supported for extensions
|
|
185
|
+
chromium: {
|
|
186
|
+
// Note: due to this would launch persistent context, so to avoid the error when running tests with run-workers a timestamp would be appended to the defined folder name. For instance: playwright-tmp_1692715649511
|
|
187
|
+
userDataDir: '/tmp/playwright-tmp', // necessary to launch the browser in normal mode instead of incognito,
|
|
188
|
+
args: [
|
|
189
|
+
`--disable-extensions-except=${pathToExtension}`,
|
|
190
|
+
`--load-extension=${pathToExtension}`
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### Example #6: Launch tests emulating iPhone 6
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
const { devices } = require('playwright');
|
|
202
|
+
|
|
203
|
+
{
|
|
204
|
+
helpers: {
|
|
205
|
+
Playwright: {
|
|
206
|
+
url: "http://localhost",
|
|
207
|
+
emulate: devices['iPhone 6'],
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### Example #7: Launch test with a specific user locale
|
|
214
|
+
|
|
215
|
+
```js
|
|
216
|
+
{
|
|
217
|
+
helpers: {
|
|
218
|
+
Playwright : {
|
|
219
|
+
url: "http://localhost",
|
|
220
|
+
locale: "fr-FR",
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
- #### Example #8: Launch test with a specific color scheme
|
|
227
|
+
|
|
228
|
+
```js
|
|
229
|
+
{
|
|
230
|
+
helpers: {
|
|
231
|
+
Playwright : {
|
|
232
|
+
url: "http://localhost",
|
|
233
|
+
colorScheme: "dark",
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
- #### Example #9: Launch electron test
|
|
240
|
+
|
|
241
|
+
```js
|
|
242
|
+
{
|
|
243
|
+
helpers: {
|
|
244
|
+
Playwright: {
|
|
245
|
+
browser: 'electron',
|
|
246
|
+
electron: {
|
|
247
|
+
executablePath: require("electron"),
|
|
248
|
+
args: [path.join('../', "main.js")],
|
|
249
|
+
},
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
256
|
+
|
|
257
|
+
## Access From Helpers
|
|
258
|
+
|
|
259
|
+
Receive Playwright client from a custom helper by accessing `browser` for the Browser object or `page` for the current Page object:
|
|
260
|
+
|
|
261
|
+
```js
|
|
262
|
+
const { browser } = this.helpers.Playwright;
|
|
263
|
+
await browser.pages(); // List of pages in the browser
|
|
264
|
+
|
|
265
|
+
// get current page
|
|
266
|
+
const { page } = this.helpers.Playwright;
|
|
267
|
+
await page.url(); // Get the url of the current page
|
|
268
|
+
|
|
269
|
+
const { browserContext } = this.helpers.Playwright;
|
|
270
|
+
await browserContext.cookies(); // get current browser context
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Parameters
|
|
274
|
+
|
|
275
|
+
- `config`
|
|
276
|
+
|
|
277
|
+
### _addPopupListener
|
|
278
|
+
|
|
279
|
+
Add the 'dialog' event listener to a page
|
|
280
|
+
|
|
281
|
+
#### Parameters
|
|
282
|
+
|
|
283
|
+
- `page`
|
|
284
|
+
|
|
285
|
+
### _contextLocator
|
|
286
|
+
|
|
287
|
+
Grab Locator if called within Context
|
|
288
|
+
|
|
289
|
+
#### Parameters
|
|
290
|
+
|
|
291
|
+
- `locator` **any**
|
|
292
|
+
|
|
293
|
+
### _createContextPage
|
|
294
|
+
|
|
295
|
+
Create a new browser context with a page.
|
|
296
|
+
Usually it should be run from a custom helper after call of `_startBrowser()`
|
|
297
|
+
|
|
298
|
+
#### Parameters
|
|
299
|
+
|
|
300
|
+
- `contextOptions` **[object][6]?** See [https://playwright.dev/docs/api/class-browser#browser-new-context][7]
|
|
301
|
+
|
|
302
|
+
### _getPageUrl
|
|
303
|
+
|
|
304
|
+
Gets page URL including hash.
|
|
305
|
+
|
|
306
|
+
### _locate
|
|
307
|
+
|
|
308
|
+
Get elements by different locator types, including strict locator
|
|
309
|
+
Should be used in custom helpers:
|
|
310
|
+
|
|
311
|
+
```js
|
|
312
|
+
const elements = await this.helpers['Playwright']._locate({name: 'password'});
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### Parameters
|
|
316
|
+
|
|
317
|
+
- `locator`
|
|
318
|
+
|
|
319
|
+
### _locateCheckable
|
|
320
|
+
|
|
321
|
+
Find a checkbox by providing human-readable text:
|
|
322
|
+
NOTE: Assumes the checkable element exists
|
|
323
|
+
|
|
324
|
+
```js
|
|
325
|
+
this.helpers['Playwright']._locateCheckable('I agree with terms and conditions').then // ...
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### Parameters
|
|
329
|
+
|
|
330
|
+
- `locator`
|
|
331
|
+
- `providedContext`
|
|
332
|
+
|
|
333
|
+
### _locateClickable
|
|
334
|
+
|
|
335
|
+
Find a clickable element by providing human-readable text:
|
|
336
|
+
|
|
337
|
+
```js
|
|
338
|
+
this.helpers['Playwright']._locateClickable('Next page').then // ...
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
#### Parameters
|
|
342
|
+
|
|
343
|
+
- `locator`
|
|
344
|
+
|
|
345
|
+
### _locateElement
|
|
346
|
+
|
|
347
|
+
Get the first element by different locator types, including strict locator
|
|
348
|
+
Should be used in custom helpers:
|
|
349
|
+
|
|
350
|
+
```js
|
|
351
|
+
const element = await this.helpers['Playwright']._locateElement({name: 'password'});
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
#### Parameters
|
|
355
|
+
|
|
356
|
+
- `locator`
|
|
357
|
+
|
|
358
|
+
### _locateFields
|
|
359
|
+
|
|
360
|
+
Find field elements by providing human-readable text:
|
|
361
|
+
|
|
362
|
+
```js
|
|
363
|
+
this.helpers['Playwright']._locateFields('Your email').then // ...
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
#### Parameters
|
|
367
|
+
|
|
368
|
+
- `locator`
|
|
369
|
+
|
|
370
|
+
### _setPage
|
|
371
|
+
|
|
372
|
+
Set current page
|
|
373
|
+
|
|
374
|
+
#### Parameters
|
|
375
|
+
|
|
376
|
+
- `page` **[object][6]** page to set
|
|
377
|
+
|
|
378
|
+
### acceptPopup
|
|
379
|
+
|
|
380
|
+
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
381
|
+
Don't confuse popups with modal windows, as created by [various
|
|
382
|
+
libraries][8].
|
|
383
|
+
|
|
384
|
+
### amAcceptingPopups
|
|
385
|
+
|
|
386
|
+
Set the automatic popup response to Accept.
|
|
387
|
+
This must be set before a popup is triggered.
|
|
388
|
+
|
|
389
|
+
```js
|
|
390
|
+
I.amAcceptingPopups();
|
|
391
|
+
I.click('#triggerPopup');
|
|
392
|
+
I.acceptPopup();
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### amCancellingPopups
|
|
396
|
+
|
|
397
|
+
Set the automatic popup response to Cancel/Dismiss.
|
|
398
|
+
This must be set before a popup is triggered.
|
|
399
|
+
|
|
400
|
+
```js
|
|
401
|
+
I.amCancellingPopups();
|
|
402
|
+
I.click('#triggerPopup');
|
|
403
|
+
I.cancelPopup();
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### amOnPage
|
|
407
|
+
|
|
408
|
+
Opens a web page in a browser. Requires relative or absolute url.
|
|
409
|
+
If url starts with `/`, opens a web page of a site defined in `url` config parameter.
|
|
410
|
+
|
|
411
|
+
```js
|
|
412
|
+
I.amOnPage('/'); // opens main page of website
|
|
413
|
+
I.amOnPage('https://github.com'); // opens github
|
|
414
|
+
I.amOnPage('/login'); // opens a login page
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### Parameters
|
|
418
|
+
|
|
419
|
+
- `url` **[string][9]** url path or global url.
|
|
420
|
+
|
|
421
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
422
|
+
|
|
423
|
+
### appendField
|
|
424
|
+
|
|
425
|
+
Appends text to a input field or textarea.
|
|
426
|
+
Field is located by name, label, CSS or XPath
|
|
427
|
+
|
|
428
|
+
```js
|
|
429
|
+
I.appendField('#myTextField', 'appended');
|
|
430
|
+
// typing secret
|
|
431
|
+
I.appendField('password', secret('123456'));
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
#### Parameters
|
|
435
|
+
|
|
436
|
+
- `field` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator
|
|
437
|
+
- `value` **[string][9]** text value to append.
|
|
438
|
+
|
|
439
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
440
|
+
|
|
441
|
+
### attachFile
|
|
442
|
+
|
|
443
|
+
Attaches a file to element located by label, name, CSS or XPath
|
|
444
|
+
Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
|
|
445
|
+
File will be uploaded to remote system (if tests are running remotely).
|
|
446
|
+
|
|
447
|
+
```js
|
|
448
|
+
I.attachFile('Avatar', 'data/avatar.jpg');
|
|
449
|
+
I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### Parameters
|
|
453
|
+
|
|
454
|
+
- `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
455
|
+
- `pathToFile` **[string][9]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
456
|
+
|
|
457
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
458
|
+
|
|
459
|
+
### blockTraffic
|
|
460
|
+
|
|
461
|
+
Blocks traffic of a given URL or a list of URLs.
|
|
462
|
+
|
|
463
|
+
Examples:
|
|
464
|
+
|
|
465
|
+
```js
|
|
466
|
+
I.blockTraffic('http://example.com/css/style.css');
|
|
467
|
+
I.blockTraffic('http://example.com/css/*.css');
|
|
468
|
+
I.blockTraffic('http://example.com/**');
|
|
469
|
+
I.blockTraffic(/.css$/);
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
```js
|
|
473
|
+
I.blockTraffic(['http://example.com/css/style.css', 'http://example.com/css/*.css']);
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
#### Parameters
|
|
477
|
+
|
|
478
|
+
- `urls` **([string][9] | [Array][10] | [RegExp][11])** URL or a list of URLs to block . URL can contain * for wildcards. Example: [https://www.example.com**][12] to block all traffic for that domain. Regexp are also supported.
|
|
479
|
+
|
|
480
|
+
### blur
|
|
481
|
+
|
|
482
|
+
Remove focus from a text input, button, etc.
|
|
483
|
+
Calls [blur][13] on the element.
|
|
484
|
+
|
|
485
|
+
Examples:
|
|
486
|
+
|
|
487
|
+
```js
|
|
488
|
+
I.blur('.text-area')
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
```js
|
|
492
|
+
//element `#product-tile` is focused
|
|
493
|
+
I.see('#add-to-cart-btn');
|
|
494
|
+
I.blur('#product-tile')
|
|
495
|
+
I.dontSee('#add-to-cart-btn');
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
#### Parameters
|
|
499
|
+
|
|
500
|
+
- `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
501
|
+
- `options` **any?** Playwright only: [Additional options][14] for available options object as 2nd argument.
|
|
502
|
+
|
|
503
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
504
|
+
|
|
505
|
+
### cancelPopup
|
|
506
|
+
|
|
507
|
+
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
508
|
+
|
|
509
|
+
### checkOption
|
|
510
|
+
|
|
511
|
+
[Additional options][15] for check available as 3rd argument.
|
|
512
|
+
|
|
513
|
+
Examples:
|
|
514
|
+
|
|
515
|
+
```js
|
|
516
|
+
// click on element at position
|
|
517
|
+
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
521
|
+
|
|
522
|
+
Selects a checkbox or radio button.
|
|
523
|
+
Element is located by label or name or CSS or XPath.
|
|
524
|
+
|
|
525
|
+
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
526
|
+
|
|
527
|
+
```js
|
|
528
|
+
I.checkOption('#agree');
|
|
529
|
+
I.checkOption('I Agree to Terms and Conditions');
|
|
530
|
+
I.checkOption('agree', '//form');
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
#### Parameters
|
|
534
|
+
|
|
535
|
+
- `field` **([string][9] | [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
536
|
+
- `context` **([string][9]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
537
|
+
- `options`
|
|
538
|
+
|
|
539
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
540
|
+
|
|
541
|
+
### clearCookie
|
|
542
|
+
|
|
543
|
+
Clears a cookie by name,
|
|
544
|
+
if none provided clears all cookies.
|
|
545
|
+
|
|
546
|
+
```js
|
|
547
|
+
I.clearCookie();
|
|
548
|
+
I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
#### Parameters
|
|
552
|
+
|
|
553
|
+
- `cookie` **[string][9]?** (optional, `null` by default) cookie name
|
|
554
|
+
|
|
555
|
+
### clearField
|
|
556
|
+
|
|
557
|
+
Clears the text input element: `<input>`, `<textarea>` or `[contenteditable]` .
|
|
558
|
+
|
|
559
|
+
Examples:
|
|
560
|
+
|
|
561
|
+
```js
|
|
562
|
+
I.clearField('.text-area')
|
|
563
|
+
|
|
564
|
+
// if this doesn't work use force option
|
|
565
|
+
I.clearField('#submit', { force: true })
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
Use `force` to bypass the [actionability][16] checks.
|
|
569
|
+
|
|
570
|
+
#### Parameters
|
|
571
|
+
|
|
572
|
+
- `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
573
|
+
- `options` **any?** [Additional options][17] for available options object as 2nd argument.
|
|
574
|
+
|
|
575
|
+
### click
|
|
576
|
+
|
|
577
|
+
Perform a click on a link or a button, given by a locator.
|
|
578
|
+
If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
579
|
+
For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
580
|
+
For images, the "alt" attribute and inner text of any parent links are searched.
|
|
581
|
+
|
|
582
|
+
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
583
|
+
|
|
584
|
+
```js
|
|
585
|
+
// simple link
|
|
586
|
+
I.click('Logout');
|
|
587
|
+
// button of form
|
|
588
|
+
I.click('Submit');
|
|
589
|
+
// CSS button
|
|
590
|
+
I.click('#form input[type=submit]');
|
|
591
|
+
// XPath
|
|
592
|
+
I.click('//form/*[@type=submit]');
|
|
593
|
+
// link in context
|
|
594
|
+
I.click('Logout', '#nav');
|
|
595
|
+
// using strict locator
|
|
596
|
+
I.click({css: 'nav a.login'});
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
#### Parameters
|
|
600
|
+
|
|
601
|
+
- `locator` **([string][9] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
602
|
+
- `context` **([string][9]? | [object][6] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
603
|
+
- `options` **any?** [Additional options][18] for click available as 3rd argument.
|
|
604
|
+
|
|
605
|
+
#### Examples
|
|
606
|
+
|
|
607
|
+
````javascript
|
|
608
|
+
```js
|
|
609
|
+
// click on element at position
|
|
610
|
+
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
611
|
+
|
|
612
|
+
// make ctrl-click
|
|
613
|
+
I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
614
|
+
```
|
|
615
|
+
````
|
|
616
|
+
|
|
617
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
618
|
+
|
|
619
|
+
### clickLink
|
|
620
|
+
|
|
621
|
+
Clicks link and waits for navigation (deprecated)
|
|
622
|
+
|
|
623
|
+
#### Parameters
|
|
624
|
+
|
|
625
|
+
- `locator`
|
|
626
|
+
- `context`
|
|
627
|
+
|
|
628
|
+
### closeCurrentTab
|
|
629
|
+
|
|
630
|
+
Close current tab and switches to previous.
|
|
631
|
+
|
|
632
|
+
```js
|
|
633
|
+
I.closeCurrentTab();
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
### closeOtherTabs
|
|
637
|
+
|
|
638
|
+
Close all tabs except for the current one.
|
|
639
|
+
|
|
640
|
+
```js
|
|
641
|
+
I.closeOtherTabs();
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
### dontSee
|
|
645
|
+
|
|
646
|
+
Opposite to `see`. Checks that a text is not present on a page.
|
|
647
|
+
Use context parameter to narrow down the search.
|
|
648
|
+
|
|
649
|
+
```js
|
|
650
|
+
I.dontSee('Login'); // assume we are already logged in.
|
|
651
|
+
I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
#### Parameters
|
|
655
|
+
|
|
656
|
+
- `text` **[string][9]** which is not present.
|
|
657
|
+
- `context` **([string][9] | [object][6])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
658
|
+
|
|
659
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
660
|
+
|
|
661
|
+
### dontSeeCheckboxIsChecked
|
|
662
|
+
|
|
663
|
+
Verifies that the specified checkbox is not checked.
|
|
664
|
+
|
|
665
|
+
```js
|
|
666
|
+
I.dontSeeCheckboxIsChecked('#agree'); // located by ID
|
|
667
|
+
I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label
|
|
668
|
+
I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
#### Parameters
|
|
672
|
+
|
|
673
|
+
- `field` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
674
|
+
|
|
675
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
676
|
+
|
|
677
|
+
### dontSeeCookie
|
|
678
|
+
|
|
679
|
+
Checks that cookie with given name does not exist.
|
|
680
|
+
|
|
681
|
+
```js
|
|
682
|
+
I.dontSeeCookie('auth'); // no auth cookie
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
#### Parameters
|
|
686
|
+
|
|
687
|
+
- `name` **[string][9]** cookie name.
|
|
688
|
+
|
|
689
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
690
|
+
|
|
691
|
+
### dontSeeCurrentUrlEquals
|
|
692
|
+
|
|
693
|
+
Checks that current url is not equal to provided one.
|
|
694
|
+
If a relative url provided, a configured url will be prepended to it.
|
|
695
|
+
|
|
696
|
+
```js
|
|
697
|
+
I.dontSeeCurrentUrlEquals('/login'); // relative url are ok
|
|
698
|
+
I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
#### Parameters
|
|
702
|
+
|
|
703
|
+
- `url` **[string][9]** value to check.
|
|
704
|
+
|
|
705
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
706
|
+
|
|
707
|
+
### dontSeeElement
|
|
708
|
+
|
|
709
|
+
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
710
|
+
|
|
711
|
+
```js
|
|
712
|
+
I.dontSeeElement('.modal'); // modal is not shown
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
#### Parameters
|
|
716
|
+
|
|
717
|
+
- `locator` **([string][9] | [object][6])** located by CSS|XPath|Strict locator.
|
|
718
|
+
|
|
719
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
720
|
+
|
|
721
|
+
### dontSeeElementInDOM
|
|
722
|
+
|
|
723
|
+
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
724
|
+
|
|
725
|
+
```js
|
|
726
|
+
I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
#### Parameters
|
|
730
|
+
|
|
731
|
+
- `locator` **([string][9] | [object][6])** located by CSS|XPath|Strict locator.
|
|
732
|
+
|
|
733
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
734
|
+
|
|
735
|
+
### dontSeeInCurrentUrl
|
|
736
|
+
|
|
737
|
+
Checks that current url does not contain a provided fragment.
|
|
738
|
+
|
|
739
|
+
#### Parameters
|
|
740
|
+
|
|
741
|
+
- `url` **[string][9]** value to check.
|
|
742
|
+
|
|
743
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
744
|
+
|
|
745
|
+
### dontSeeInField
|
|
746
|
+
|
|
747
|
+
Checks that value of input field or textarea doesn't equal to given value
|
|
748
|
+
Opposite to `seeInField`.
|
|
749
|
+
|
|
750
|
+
```js
|
|
751
|
+
I.dontSeeInField('email', 'user@user.com'); // field by name
|
|
752
|
+
I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
#### Parameters
|
|
756
|
+
|
|
757
|
+
- `field` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
758
|
+
- `value` **([string][9] | [object][6])** value to check.
|
|
759
|
+
|
|
760
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
761
|
+
|
|
762
|
+
### dontSeeInSource
|
|
763
|
+
|
|
764
|
+
Checks that the current page does not contains the given string in its raw source code.
|
|
765
|
+
|
|
766
|
+
```js
|
|
767
|
+
I.dontSeeInSource('<!--'); // no comments in source
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
#### Parameters
|
|
771
|
+
|
|
772
|
+
- `text`
|
|
773
|
+
- `value` **[string][9]** to check.
|
|
774
|
+
|
|
775
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
776
|
+
|
|
777
|
+
### dontSeeInTitle
|
|
778
|
+
|
|
779
|
+
Checks that title does not contain text.
|
|
780
|
+
|
|
781
|
+
```js
|
|
782
|
+
I.dontSeeInTitle('Error');
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
#### Parameters
|
|
786
|
+
|
|
787
|
+
- `text` **[string][9]** value to check.
|
|
788
|
+
|
|
789
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
790
|
+
|
|
791
|
+
### dontSeeTraffic
|
|
792
|
+
|
|
793
|
+
Verifies that a certain request is not part of network traffic.
|
|
794
|
+
|
|
795
|
+
Examples:
|
|
796
|
+
|
|
797
|
+
```js
|
|
798
|
+
I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
799
|
+
I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
#### Parameters
|
|
803
|
+
|
|
804
|
+
- `opts` **[Object][6]** options when checking the traffic network.
|
|
805
|
+
- `opts.name` **[string][9]** A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
806
|
+
- `opts.url` **([string][9] | [RegExp][11])** Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
807
|
+
|
|
808
|
+
### doubleClick
|
|
809
|
+
|
|
810
|
+
Performs a double-click on an element matched by link|button|label|CSS or XPath.
|
|
811
|
+
Context can be specified as second parameter to narrow search.
|
|
812
|
+
|
|
813
|
+
```js
|
|
814
|
+
I.doubleClick('Edit');
|
|
815
|
+
I.doubleClick('Edit', '.actions');
|
|
816
|
+
I.doubleClick({css: 'button.accept'});
|
|
817
|
+
I.doubleClick('.btn.edit');
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
#### Parameters
|
|
821
|
+
|
|
822
|
+
- `locator` **([string][9] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
823
|
+
- `context` **([string][9]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
824
|
+
|
|
825
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
826
|
+
|
|
827
|
+
### dragAndDrop
|
|
828
|
+
|
|
829
|
+
```js
|
|
830
|
+
// specify coordinates for source position
|
|
831
|
+
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
> When no option is set, custom drag and drop would be used, to use the dragAndDrop API from Playwright, please set options, for example `force: true`
|
|
835
|
+
|
|
836
|
+
Drag an item to a destination element.
|
|
837
|
+
|
|
838
|
+
```js
|
|
839
|
+
I.dragAndDrop('#dragHandle', '#container');
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
#### Parameters
|
|
843
|
+
|
|
844
|
+
- `srcElement` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
845
|
+
- `destElement` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
846
|
+
- `options` **any?** [Additional options][19] can be passed as 3rd argument.
|
|
847
|
+
|
|
848
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
849
|
+
|
|
850
|
+
### dragSlider
|
|
851
|
+
|
|
852
|
+
Drag the scrubber of a slider to a given position
|
|
853
|
+
For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
854
|
+
|
|
855
|
+
```js
|
|
856
|
+
I.dragSlider('#slider', 30);
|
|
857
|
+
I.dragSlider('#slider', -70);
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
#### Parameters
|
|
861
|
+
|
|
862
|
+
- `locator` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
863
|
+
- `offsetX` **[number][20]** position to drag.
|
|
864
|
+
|
|
865
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
866
|
+
|
|
867
|
+
### executeScript
|
|
868
|
+
|
|
869
|
+
Executes a script on the page:
|
|
870
|
+
|
|
871
|
+
```js
|
|
872
|
+
I.executeScript(() => window.alert('Hello world'));
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
Additional parameters of the function can be passed as an object argument:
|
|
876
|
+
|
|
877
|
+
```js
|
|
878
|
+
I.executeScript(({x, y}) => x + y, {x, y});
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
You can pass only one parameter into a function,
|
|
882
|
+
or you can pass in array or object.
|
|
883
|
+
|
|
884
|
+
```js
|
|
885
|
+
I.executeScript(([x, y]) => x + y, [x, y]);
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
If a function returns a Promise it will wait for its resolution.
|
|
889
|
+
|
|
890
|
+
#### Parameters
|
|
891
|
+
|
|
892
|
+
- `fn` **([string][9] | [function][21])** function to be executed in browser context.
|
|
893
|
+
- `arg` **any?** optional argument to pass to the function
|
|
894
|
+
|
|
895
|
+
Returns **[Promise][22]<any>**
|
|
896
|
+
|
|
897
|
+
### fillField
|
|
898
|
+
|
|
899
|
+
Fills a text field or textarea, after clearing its value, with the given string.
|
|
900
|
+
Field is located by name, label, CSS, or XPath.
|
|
901
|
+
|
|
902
|
+
```js
|
|
903
|
+
// by label
|
|
904
|
+
I.fillField('Email', 'hello@world.com');
|
|
905
|
+
// by name
|
|
906
|
+
I.fillField('password', secret('123456'));
|
|
907
|
+
// by CSS
|
|
908
|
+
I.fillField('form#login input[name=username]', 'John');
|
|
909
|
+
// or by strict locator
|
|
910
|
+
I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
#### Parameters
|
|
914
|
+
|
|
915
|
+
- `field` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
916
|
+
- `value` **([string][9] | [object][6])** text value to fill.
|
|
917
|
+
|
|
918
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
919
|
+
|
|
920
|
+
### flushNetworkTraffics
|
|
921
|
+
|
|
922
|
+
Resets all recorded network requests.
|
|
923
|
+
|
|
924
|
+
### flushWebSocketMessages
|
|
925
|
+
|
|
926
|
+
Resets all recorded WS messages.
|
|
927
|
+
|
|
928
|
+
### focus
|
|
929
|
+
|
|
930
|
+
Calls [focus][13] on the matching element.
|
|
931
|
+
|
|
932
|
+
Examples:
|
|
933
|
+
|
|
934
|
+
```js
|
|
935
|
+
I.dontSee('#add-to-cart-btn');
|
|
936
|
+
I.focus('#product-tile')
|
|
937
|
+
I.see('#add-to-cart-bnt');
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
#### Parameters
|
|
941
|
+
|
|
942
|
+
- `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
943
|
+
- `options` **any?** Playwright only: [Additional options][23] for available options object as 2nd argument.
|
|
944
|
+
|
|
945
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
946
|
+
|
|
947
|
+
### forceClick
|
|
948
|
+
|
|
949
|
+
Perform an emulated click on a link or a button, given by a locator.
|
|
950
|
+
Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
951
|
+
This works on hidden, animated or inactive elements as well.
|
|
952
|
+
|
|
953
|
+
If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
954
|
+
For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
955
|
+
For images, the "alt" attribute and inner text of any parent links are searched.
|
|
956
|
+
|
|
957
|
+
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
958
|
+
|
|
959
|
+
```js
|
|
960
|
+
// simple link
|
|
961
|
+
I.forceClick('Logout');
|
|
962
|
+
// button of form
|
|
963
|
+
I.forceClick('Submit');
|
|
964
|
+
// CSS button
|
|
965
|
+
I.forceClick('#form input[type=submit]');
|
|
966
|
+
// XPath
|
|
967
|
+
I.forceClick('//form/*[@type=submit]');
|
|
968
|
+
// link in context
|
|
969
|
+
I.forceClick('Logout', '#nav');
|
|
970
|
+
// using strict locator
|
|
971
|
+
I.forceClick({css: 'nav a.login'});
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
#### Parameters
|
|
975
|
+
|
|
976
|
+
- `locator` **([string][9] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
977
|
+
- `context` **([string][9]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
978
|
+
|
|
979
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
980
|
+
|
|
981
|
+
### grabAttributeFrom
|
|
982
|
+
|
|
983
|
+
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
984
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
985
|
+
If more than one element is found - attribute of first element is returned.
|
|
986
|
+
|
|
987
|
+
```js
|
|
988
|
+
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
#### Parameters
|
|
992
|
+
|
|
993
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
994
|
+
- `attr` **[string][9]** attribute name.
|
|
995
|
+
|
|
996
|
+
Returns **[Promise][22]<[string][9]>** attribute value
|
|
997
|
+
|
|
998
|
+
### grabAttributeFromAll
|
|
999
|
+
|
|
1000
|
+
Retrieves an array of attributes from elements located by CSS or XPath and returns it to test.
|
|
1001
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1002
|
+
|
|
1003
|
+
```js
|
|
1004
|
+
let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
#### Parameters
|
|
1008
|
+
|
|
1009
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1010
|
+
- `attr` **[string][9]** attribute name.
|
|
1011
|
+
|
|
1012
|
+
Returns **[Promise][22]<[Array][10]<[string][9]>>** attribute value
|
|
1013
|
+
|
|
1014
|
+
### grabBrowserLogs
|
|
1015
|
+
|
|
1016
|
+
Get JS log from browser.
|
|
1017
|
+
|
|
1018
|
+
```js
|
|
1019
|
+
const logs = await I.grabBrowserLogs();
|
|
1020
|
+
const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l.type === 'error');
|
|
1021
|
+
console.log(JSON.stringify(errors));
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
[Learn more about console messages][24]
|
|
1025
|
+
|
|
1026
|
+
Returns **[Promise][22]<[Array][10]<any>>**
|
|
1027
|
+
|
|
1028
|
+
### grabCheckedElementStatus
|
|
1029
|
+
|
|
1030
|
+
Return the checked status of given element.
|
|
1031
|
+
|
|
1032
|
+
#### Parameters
|
|
1033
|
+
|
|
1034
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1035
|
+
- `options` **[object][6]?** See [https://playwright.dev/docs/api/class-locator#locator-is-checked][25]
|
|
1036
|
+
|
|
1037
|
+
Returns **[Promise][22]<[boolean][26]>**
|
|
1038
|
+
|
|
1039
|
+
### grabCookie
|
|
1040
|
+
|
|
1041
|
+
Returns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
1042
|
+
|
|
1043
|
+
Gets a cookie object by name.
|
|
1044
|
+
If none provided gets all cookies.
|
|
1045
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1046
|
+
|
|
1047
|
+
```js
|
|
1048
|
+
let cookie = await I.grabCookie('auth');
|
|
1049
|
+
assert(cookie.value, '123456');
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
#### Parameters
|
|
1053
|
+
|
|
1054
|
+
- `name` **[string][9]?** cookie name.
|
|
1055
|
+
|
|
1056
|
+
Returns **any** attribute value
|
|
1057
|
+
|
|
1058
|
+
### grabCssPropertyFrom
|
|
1059
|
+
|
|
1060
|
+
Grab CSS property for given locator
|
|
1061
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1062
|
+
If more than one element is found - value of first element is returned.
|
|
1063
|
+
|
|
1064
|
+
```js
|
|
1065
|
+
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
#### Parameters
|
|
1069
|
+
|
|
1070
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1071
|
+
- `cssProperty` **[string][9]** CSS property name.
|
|
1072
|
+
|
|
1073
|
+
Returns **[Promise][22]<[string][9]>** CSS value
|
|
1074
|
+
|
|
1075
|
+
### grabCssPropertyFromAll
|
|
1076
|
+
|
|
1077
|
+
Grab array of CSS properties for given locator
|
|
1078
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1079
|
+
|
|
1080
|
+
```js
|
|
1081
|
+
const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
#### Parameters
|
|
1085
|
+
|
|
1086
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1087
|
+
- `cssProperty` **[string][9]** CSS property name.
|
|
1088
|
+
|
|
1089
|
+
Returns **[Promise][22]<[Array][10]<[string][9]>>** CSS value
|
|
1090
|
+
|
|
1091
|
+
### grabCurrentUrl
|
|
1092
|
+
|
|
1093
|
+
Get current URL from browser.
|
|
1094
|
+
Resumes test execution, so should be used inside an async function.
|
|
1095
|
+
|
|
1096
|
+
```js
|
|
1097
|
+
let url = await I.grabCurrentUrl();
|
|
1098
|
+
console.log(`Current URL is [${url}]`);
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
Returns **[Promise][22]<[string][9]>** current URL
|
|
1102
|
+
|
|
1103
|
+
### grabDataFromPerformanceTiming
|
|
1104
|
+
|
|
1105
|
+
Grab the data from performance timing using Navigation Timing API.
|
|
1106
|
+
The returned data will contain following things in ms:
|
|
1107
|
+
|
|
1108
|
+
- responseEnd,
|
|
1109
|
+
- domInteractive,
|
|
1110
|
+
- domContentLoadedEventEnd,
|
|
1111
|
+
- loadEventEnd
|
|
1112
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1113
|
+
|
|
1114
|
+
```js
|
|
1115
|
+
await I.amOnPage('https://example.com');
|
|
1116
|
+
let data = await I.grabDataFromPerformanceTiming();
|
|
1117
|
+
//Returned data
|
|
1118
|
+
{ // all results are in [ms]
|
|
1119
|
+
responseEnd: 23,
|
|
1120
|
+
domInteractive: 44,
|
|
1121
|
+
domContentLoadedEventEnd: 196,
|
|
1122
|
+
loadEventEnd: 241
|
|
1123
|
+
}
|
|
1124
|
+
```
|
|
1125
|
+
|
|
1126
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1127
|
+
|
|
1128
|
+
### grabDisabledElementStatus
|
|
1129
|
+
|
|
1130
|
+
Return the disabled status of given element.
|
|
1131
|
+
|
|
1132
|
+
#### Parameters
|
|
1133
|
+
|
|
1134
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1135
|
+
- `options` **[object][6]?** See [https://playwright.dev/docs/api/class-locator#locator-is-disabled][27]
|
|
1136
|
+
|
|
1137
|
+
Returns **[Promise][22]<[boolean][26]>**
|
|
1138
|
+
|
|
1139
|
+
### grabElementBoundingRect
|
|
1140
|
+
|
|
1141
|
+
Grab the width, height, location of given locator.
|
|
1142
|
+
Provide `width` or `height`as second param to get your desired prop.
|
|
1143
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1144
|
+
|
|
1145
|
+
Returns an object with `x`, `y`, `width`, `height` keys.
|
|
1146
|
+
|
|
1147
|
+
```js
|
|
1148
|
+
const value = await I.grabElementBoundingRect('h3');
|
|
1149
|
+
// value is like { x: 226.5, y: 89, width: 527, height: 220 }
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
To get only one metric use second parameter:
|
|
1153
|
+
|
|
1154
|
+
```js
|
|
1155
|
+
const width = await I.grabElementBoundingRect('h3', 'width');
|
|
1156
|
+
// width == 527
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
#### Parameters
|
|
1160
|
+
|
|
1161
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1162
|
+
- `prop`
|
|
1163
|
+
- `elementSize` **[string][9]?** x, y, width or height of the given element.
|
|
1164
|
+
|
|
1165
|
+
Returns **([Promise][22]<DOMRect> | [Promise][22]<[number][20]>)** Element bounding rectangle
|
|
1166
|
+
|
|
1167
|
+
### grabHTMLFrom
|
|
1168
|
+
|
|
1169
|
+
Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
|
|
1170
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1171
|
+
If more than one element is found - HTML of first element is returned.
|
|
1172
|
+
|
|
1173
|
+
```js
|
|
1174
|
+
let postHTML = await I.grabHTMLFrom('#post');
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
#### Parameters
|
|
1178
|
+
|
|
1179
|
+
- `locator`
|
|
1180
|
+
- `element` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1181
|
+
|
|
1182
|
+
Returns **[Promise][22]<[string][9]>** HTML code for an element
|
|
1183
|
+
|
|
1184
|
+
### grabHTMLFromAll
|
|
1185
|
+
|
|
1186
|
+
Retrieves all the innerHTML from elements located by CSS or XPath and returns it to test.
|
|
1187
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1188
|
+
|
|
1189
|
+
```js
|
|
1190
|
+
let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
#### Parameters
|
|
1194
|
+
|
|
1195
|
+
- `locator`
|
|
1196
|
+
- `element` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1197
|
+
|
|
1198
|
+
Returns **[Promise][22]<[Array][10]<[string][9]>>** HTML code for an element
|
|
1199
|
+
|
|
1200
|
+
### grabMetrics
|
|
1201
|
+
|
|
1202
|
+
Return a performance metric from the chrome cdp session.
|
|
1203
|
+
Note: Chrome-only
|
|
1204
|
+
|
|
1205
|
+
Examples:
|
|
1206
|
+
|
|
1207
|
+
```js
|
|
1208
|
+
const metrics = await I.grabMetrics();
|
|
1209
|
+
|
|
1210
|
+
// returned metrics
|
|
1211
|
+
|
|
1212
|
+
[
|
|
1213
|
+
{ name: 'Timestamp', value: 1584904.203473 },
|
|
1214
|
+
{ name: 'AudioHandlers', value: 0 },
|
|
1215
|
+
{ name: 'AudioWorkletProcessors', value: 0 },
|
|
1216
|
+
{ name: 'Documents', value: 22 },
|
|
1217
|
+
{ name: 'Frames', value: 10 },
|
|
1218
|
+
{ name: 'JSEventListeners', value: 366 },
|
|
1219
|
+
{ name: 'LayoutObjects', value: 1240 },
|
|
1220
|
+
{ name: 'MediaKeySessions', value: 0 },
|
|
1221
|
+
{ name: 'MediaKeys', value: 0 },
|
|
1222
|
+
{ name: 'Nodes', value: 4505 },
|
|
1223
|
+
{ name: 'Resources', value: 141 },
|
|
1224
|
+
{ name: 'ContextLifecycleStateObservers', value: 34 },
|
|
1225
|
+
{ name: 'V8PerContextDatas', value: 4 },
|
|
1226
|
+
{ name: 'WorkerGlobalScopes', value: 0 },
|
|
1227
|
+
{ name: 'UACSSResources', value: 0 },
|
|
1228
|
+
{ name: 'RTCPeerConnections', value: 0 },
|
|
1229
|
+
{ name: 'ResourceFetchers', value: 22 },
|
|
1230
|
+
{ name: 'AdSubframes', value: 0 },
|
|
1231
|
+
{ name: 'DetachedScriptStates', value: 2 },
|
|
1232
|
+
{ name: 'ArrayBufferContents', value: 1 },
|
|
1233
|
+
{ name: 'LayoutCount', value: 0 },
|
|
1234
|
+
{ name: 'RecalcStyleCount', value: 0 },
|
|
1235
|
+
{ name: 'LayoutDuration', value: 0 },
|
|
1236
|
+
{ name: 'RecalcStyleDuration', value: 0 },
|
|
1237
|
+
{ name: 'DevToolsCommandDuration', value: 0.000013 },
|
|
1238
|
+
{ name: 'ScriptDuration', value: 0 },
|
|
1239
|
+
{ name: 'V8CompileDuration', value: 0 },
|
|
1240
|
+
{ name: 'TaskDuration', value: 0.000014 },
|
|
1241
|
+
{ name: 'TaskOtherDuration', value: 0.000001 },
|
|
1242
|
+
{ name: 'ThreadTime', value: 0.000046 },
|
|
1243
|
+
{ name: 'ProcessTime', value: 0.616852 },
|
|
1244
|
+
{ name: 'JSHeapUsedSize', value: 19004908 },
|
|
1245
|
+
{ name: 'JSHeapTotalSize', value: 26820608 },
|
|
1246
|
+
{ name: 'FirstMeaningfulPaint', value: 0 },
|
|
1247
|
+
{ name: 'DomContentLoaded', value: 1584903.690491 },
|
|
1248
|
+
{ name: 'NavigationStart', value: 1584902.841845 }
|
|
1249
|
+
]
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1252
|
+
Returns **[Promise][22]<[Array][10]<[Object][6]>>**
|
|
1253
|
+
|
|
1254
|
+
### grabNumberOfOpenTabs
|
|
1255
|
+
|
|
1256
|
+
Grab number of open tabs.
|
|
1257
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1258
|
+
|
|
1259
|
+
```js
|
|
1260
|
+
let tabs = await I.grabNumberOfOpenTabs();
|
|
1261
|
+
```
|
|
1262
|
+
|
|
1263
|
+
Returns **[Promise][22]<[number][20]>** number of open tabs
|
|
1264
|
+
|
|
1265
|
+
### grabNumberOfVisibleElements
|
|
1266
|
+
|
|
1267
|
+
Grab number of visible elements by locator.
|
|
1268
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1269
|
+
|
|
1270
|
+
```js
|
|
1271
|
+
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
1272
|
+
```
|
|
1273
|
+
|
|
1274
|
+
#### Parameters
|
|
1275
|
+
|
|
1276
|
+
- `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1277
|
+
|
|
1278
|
+
Returns **[Promise][22]<[number][20]>** number of visible elements
|
|
1279
|
+
|
|
1280
|
+
### grabPageScrollPosition
|
|
1281
|
+
|
|
1282
|
+
Retrieves a page scroll position and returns it to test.
|
|
1283
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1284
|
+
|
|
1285
|
+
```js
|
|
1286
|
+
let { x, y } = await I.grabPageScrollPosition();
|
|
1287
|
+
```
|
|
1288
|
+
|
|
1289
|
+
Returns **[Promise][22]<PageScrollPosition>** scroll position
|
|
1290
|
+
|
|
1291
|
+
### grabPopupText
|
|
1292
|
+
|
|
1293
|
+
Grab the text within the popup. If no popup is visible then it will return null
|
|
1294
|
+
|
|
1295
|
+
```js
|
|
1296
|
+
await I.grabPopupText();
|
|
1297
|
+
```
|
|
1298
|
+
|
|
1299
|
+
Returns **[Promise][22]<([string][9] | null)>**
|
|
1300
|
+
|
|
1301
|
+
### grabRecordedNetworkTraffics
|
|
1302
|
+
|
|
1303
|
+
Grab the recording network traffics
|
|
1304
|
+
|
|
1305
|
+
```js
|
|
1306
|
+
const traffics = await I.grabRecordedNetworkTraffics();
|
|
1307
|
+
expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
1308
|
+
expect(traffics[0].response.status).to.equal(200);
|
|
1309
|
+
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
1310
|
+
```
|
|
1311
|
+
|
|
1312
|
+
Returns **[Promise][22]<[Array][10]<any>>**
|
|
1313
|
+
|
|
1314
|
+
### grabSource
|
|
1315
|
+
|
|
1316
|
+
Retrieves page source and returns it to test.
|
|
1317
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1318
|
+
|
|
1319
|
+
```js
|
|
1320
|
+
let pageSource = await I.grabSource();
|
|
1321
|
+
```
|
|
1322
|
+
|
|
1323
|
+
Returns **[Promise][22]<[string][9]>** source code
|
|
1324
|
+
|
|
1325
|
+
### grabTextFrom
|
|
1326
|
+
|
|
1327
|
+
Retrieves a text from an element located by CSS or XPath and returns it to test.
|
|
1328
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1329
|
+
|
|
1330
|
+
```js
|
|
1331
|
+
let pin = await I.grabTextFrom('#pin');
|
|
1332
|
+
```
|
|
1333
|
+
|
|
1334
|
+
If multiple elements found returns first element.
|
|
1335
|
+
|
|
1336
|
+
#### Parameters
|
|
1337
|
+
|
|
1338
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1339
|
+
|
|
1340
|
+
Returns **[Promise][22]<[string][9]>** attribute value
|
|
1341
|
+
|
|
1342
|
+
### grabTextFromAll
|
|
1343
|
+
|
|
1344
|
+
Retrieves all texts from an element located by CSS or XPath and returns it to test.
|
|
1345
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1346
|
+
|
|
1347
|
+
```js
|
|
1348
|
+
let pins = await I.grabTextFromAll('#pin li');
|
|
1349
|
+
```
|
|
1350
|
+
|
|
1351
|
+
#### Parameters
|
|
1352
|
+
|
|
1353
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1354
|
+
|
|
1355
|
+
Returns **[Promise][22]<[Array][10]<[string][9]>>** attribute value
|
|
1356
|
+
|
|
1357
|
+
### grabTitle
|
|
1358
|
+
|
|
1359
|
+
Retrieves a page title and returns it to test.
|
|
1360
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1361
|
+
|
|
1362
|
+
```js
|
|
1363
|
+
let title = await I.grabTitle();
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
Returns **[Promise][22]<[string][9]>** title
|
|
1367
|
+
|
|
1368
|
+
### grabTrafficUrl
|
|
1369
|
+
|
|
1370
|
+
Returns full URL of request matching parameter "urlMatch".
|
|
1371
|
+
|
|
1372
|
+
#### Parameters
|
|
1373
|
+
|
|
1374
|
+
- `urlMatch` **([string][9] | [RegExp][11])** Expected URL of request in network traffic. Can be a string or a regular expression.Examples:```js
|
|
1375
|
+
I.grabTrafficUrl('https://api.example.com/session');
|
|
1376
|
+
I.grabTrafficUrl(/session.*start/);
|
|
1377
|
+
```
|
|
1378
|
+
|
|
1379
|
+
Returns **[Promise][22]<any>**
|
|
1380
|
+
|
|
1381
|
+
### grabValueFrom
|
|
1382
|
+
|
|
1383
|
+
Retrieves a value from a form element located by CSS or XPath and returns it to test.
|
|
1384
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1385
|
+
If more than one element is found - value of first element is returned.
|
|
1386
|
+
|
|
1387
|
+
```js
|
|
1388
|
+
let email = await I.grabValueFrom('input[name=email]');
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
#### Parameters
|
|
1392
|
+
|
|
1393
|
+
- `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1394
|
+
|
|
1395
|
+
Returns **[Promise][22]<[string][9]>** attribute value
|
|
1396
|
+
|
|
1397
|
+
### grabValueFromAll
|
|
1398
|
+
|
|
1399
|
+
Retrieves an array of value from a form located by CSS or XPath and returns it to test.
|
|
1400
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1401
|
+
|
|
1402
|
+
```js
|
|
1403
|
+
let inputs = await I.grabValueFromAll('//form/input');
|
|
1404
|
+
```
|
|
1405
|
+
|
|
1406
|
+
#### Parameters
|
|
1407
|
+
|
|
1408
|
+
- `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1409
|
+
|
|
1410
|
+
Returns **[Promise][22]<[Array][10]<[string][9]>>** attribute value
|
|
1411
|
+
|
|
1412
|
+
### grabWebElement
|
|
1413
|
+
|
|
1414
|
+
Grab WebElement for given locator
|
|
1415
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1416
|
+
|
|
1417
|
+
```js
|
|
1418
|
+
const webElement = await I.grabWebElement('#button');
|
|
1419
|
+
```
|
|
1420
|
+
|
|
1421
|
+
#### Parameters
|
|
1422
|
+
|
|
1423
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1424
|
+
|
|
1425
|
+
Returns **[Promise][22]<any>** WebElement of being used Web helper
|
|
1426
|
+
|
|
1427
|
+
### grabWebElements
|
|
1428
|
+
|
|
1429
|
+
Grab WebElements for given locator
|
|
1430
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1431
|
+
|
|
1432
|
+
```js
|
|
1433
|
+
const webElements = await I.grabWebElements('#button');
|
|
1434
|
+
```
|
|
1435
|
+
|
|
1436
|
+
#### Parameters
|
|
1437
|
+
|
|
1438
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1439
|
+
|
|
1440
|
+
Returns **[Promise][22]<any>** WebElement of being used Web helper
|
|
1441
|
+
|
|
1442
|
+
### grabWebSocketMessages
|
|
1443
|
+
|
|
1444
|
+
Grab the recording WS messages
|
|
1445
|
+
|
|
1446
|
+
Returns **[Array][10]<any>**
|
|
1447
|
+
|
|
1448
|
+
### handleDownloads
|
|
1449
|
+
|
|
1450
|
+
Handles a file download. A file name is required to save the file on disk.
|
|
1451
|
+
Files are saved to "output" directory.
|
|
1452
|
+
|
|
1453
|
+
Should be used with [FileSystem helper][28] to check that file were downloaded correctly.
|
|
1454
|
+
|
|
1455
|
+
```js
|
|
1456
|
+
I.handleDownloads('downloads/avatar.jpg');
|
|
1457
|
+
I.click('Download Avatar');
|
|
1458
|
+
I.amInPath('output/downloads');
|
|
1459
|
+
I.waitForFile('avatar.jpg', 5);
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
#### Parameters
|
|
1463
|
+
|
|
1464
|
+
- `fileName` **[string][9]** set filename for downloaded file
|
|
1465
|
+
|
|
1466
|
+
Returns **[Promise][22]<void>**
|
|
1467
|
+
|
|
1468
|
+
### makeApiRequest
|
|
1469
|
+
|
|
1470
|
+
Performs [api request][29] using
|
|
1471
|
+
the cookies from the current browser session.
|
|
1472
|
+
|
|
1473
|
+
```js
|
|
1474
|
+
const users = await I.makeApiRequest('GET', '/api/users', { params: { page: 1 }});
|
|
1475
|
+
users[0]
|
|
1476
|
+
I.makeApiRequest('PATCH', )
|
|
1477
|
+
```
|
|
1478
|
+
|
|
1479
|
+
> This is Playwright's built-in alternative to using REST helper's sendGet, sendPost, etc methods.
|
|
1480
|
+
|
|
1481
|
+
#### Parameters
|
|
1482
|
+
|
|
1483
|
+
- `method` **[string][9]** HTTP method
|
|
1484
|
+
- `url` **[string][9]** endpoint
|
|
1485
|
+
- `options` **[object][6]** request options depending on method used
|
|
1486
|
+
|
|
1487
|
+
Returns **[Promise][22]<[object][6]>** response
|
|
1488
|
+
|
|
1489
|
+
### mockRoute
|
|
1490
|
+
|
|
1491
|
+
Mocks network request using [`browserContext.route`][30] of Playwright
|
|
1492
|
+
|
|
1493
|
+
```js
|
|
1494
|
+
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1495
|
+
```
|
|
1496
|
+
|
|
1497
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][31]
|
|
1498
|
+
|
|
1499
|
+
#### Parameters
|
|
1500
|
+
|
|
1501
|
+
- `url` **([string][9] | [RegExp][11])?** URL, regex or pattern for to match URL
|
|
1502
|
+
- `handler` **[function][21]?** a function to process reques
|
|
1503
|
+
|
|
1504
|
+
### mockTraffic
|
|
1505
|
+
|
|
1506
|
+
Mocks traffic for URL(s).
|
|
1507
|
+
This is a powerful feature to manipulate network traffic. Can be used e.g. to stabilize your tests, speed up your tests or as a last resort to make some test scenarios even possible.
|
|
1508
|
+
|
|
1509
|
+
Examples:
|
|
1510
|
+
|
|
1511
|
+
```js
|
|
1512
|
+
I.mockTraffic('/api/users/1', '{ id: 1, name: 'John Doe' }');
|
|
1513
|
+
I.mockTraffic('/api/users/*', JSON.stringify({ id: 1, name: 'John Doe' }));
|
|
1514
|
+
I.mockTraffic([/^https://api.example.com/v1/, 'https://api.example.com/v2/**'], 'Internal Server Error', 'text/html');
|
|
1515
|
+
```
|
|
1516
|
+
|
|
1517
|
+
#### Parameters
|
|
1518
|
+
|
|
1519
|
+
- `urls` string|Array These are the URL(s) to mock, e.g. "/fooapi/_" or "['/fooapi_1/_', '/barapi_2/*']". Regular expressions are also supported.
|
|
1520
|
+
- `responseString` string The string to return in fake response's body.
|
|
1521
|
+
- `contentType` Content type of fake response. If not specified default value 'application/json' is used.
|
|
1522
|
+
|
|
1523
|
+
### moveCursorTo
|
|
1524
|
+
|
|
1525
|
+
Moves cursor to element matched by locator.
|
|
1526
|
+
Extra shift can be set with offsetX and offsetY options.
|
|
1527
|
+
|
|
1528
|
+
```js
|
|
1529
|
+
I.moveCursorTo('.tooltip');
|
|
1530
|
+
I.moveCursorTo('#submit', 5,5);
|
|
1531
|
+
```
|
|
1532
|
+
|
|
1533
|
+
#### Parameters
|
|
1534
|
+
|
|
1535
|
+
- `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1536
|
+
- `offsetX` **[number][20]** (optional, `0` by default) X-axis offset.
|
|
1537
|
+
- `offsetY` **[number][20]** (optional, `0` by default) Y-axis offset.
|
|
1538
|
+
|
|
1539
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1540
|
+
|
|
1541
|
+
### openNewTab
|
|
1542
|
+
|
|
1543
|
+
Open new tab and automatically switched to new tab
|
|
1544
|
+
|
|
1545
|
+
```js
|
|
1546
|
+
I.openNewTab();
|
|
1547
|
+
```
|
|
1548
|
+
|
|
1549
|
+
You can pass in [page options][32] to emulate device on this page
|
|
1550
|
+
|
|
1551
|
+
```js
|
|
1552
|
+
// enable mobile
|
|
1553
|
+
I.openNewTab({ isMobile: true });
|
|
1554
|
+
```
|
|
1555
|
+
|
|
1556
|
+
#### Parameters
|
|
1557
|
+
|
|
1558
|
+
- `options`
|
|
1559
|
+
|
|
1560
|
+
### pressKey
|
|
1561
|
+
|
|
1562
|
+
_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][33]).
|
|
1563
|
+
|
|
1564
|
+
Presses a key in the browser (on a focused element).
|
|
1565
|
+
|
|
1566
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][34].
|
|
1567
|
+
|
|
1568
|
+
```js
|
|
1569
|
+
I.pressKey('Backspace');
|
|
1570
|
+
```
|
|
1571
|
+
|
|
1572
|
+
To press a key in combination with modifier keys, pass the sequence as an array. All modifier keys (`'Alt'`, `'Control'`, `'Meta'`, `'Shift'`) will be released afterwards.
|
|
1573
|
+
|
|
1574
|
+
```js
|
|
1575
|
+
I.pressKey(['Control', 'Z']);
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
For specifying operation modifier key based on operating system it is suggested to use `'CommandOrControl'`.
|
|
1579
|
+
This will press `'Command'` (also known as `'Meta'`) on macOS machines and `'Control'` on non-macOS machines.
|
|
1580
|
+
|
|
1581
|
+
```js
|
|
1582
|
+
I.pressKey(['CommandOrControl', 'Z']);
|
|
1583
|
+
```
|
|
1584
|
+
|
|
1585
|
+
Some of the supported key names are:
|
|
1586
|
+
|
|
1587
|
+
- `'AltLeft'` or `'Alt'`
|
|
1588
|
+
- `'AltRight'`
|
|
1589
|
+
- `'ArrowDown'`
|
|
1590
|
+
- `'ArrowLeft'`
|
|
1591
|
+
- `'ArrowRight'`
|
|
1592
|
+
- `'ArrowUp'`
|
|
1593
|
+
- `'Backspace'`
|
|
1594
|
+
- `'Clear'`
|
|
1595
|
+
- `'ControlLeft'` or `'Control'`
|
|
1596
|
+
- `'ControlRight'`
|
|
1597
|
+
- `'Command'`
|
|
1598
|
+
- `'CommandOrControl'`
|
|
1599
|
+
- `'Delete'`
|
|
1600
|
+
- `'End'`
|
|
1601
|
+
- `'Enter'`
|
|
1602
|
+
- `'Escape'`
|
|
1603
|
+
- `'F1'` to `'F12'`
|
|
1604
|
+
- `'Home'`
|
|
1605
|
+
- `'Insert'`
|
|
1606
|
+
- `'MetaLeft'` or `'Meta'`
|
|
1607
|
+
- `'MetaRight'`
|
|
1608
|
+
- `'Numpad0'` to `'Numpad9'`
|
|
1609
|
+
- `'NumpadAdd'`
|
|
1610
|
+
- `'NumpadDecimal'`
|
|
1611
|
+
- `'NumpadDivide'`
|
|
1612
|
+
- `'NumpadMultiply'`
|
|
1613
|
+
- `'NumpadSubtract'`
|
|
1614
|
+
- `'PageDown'`
|
|
1615
|
+
- `'PageUp'`
|
|
1616
|
+
- `'Pause'`
|
|
1617
|
+
- `'Return'`
|
|
1618
|
+
- `'ShiftLeft'` or `'Shift'`
|
|
1619
|
+
- `'ShiftRight'`
|
|
1620
|
+
- `'Space'`
|
|
1621
|
+
- `'Tab'`
|
|
1622
|
+
|
|
1623
|
+
#### Parameters
|
|
1624
|
+
|
|
1625
|
+
- `key` **([string][9] | [Array][10]<[string][9]>)** key or array of keys to press.
|
|
1626
|
+
|
|
1627
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1628
|
+
|
|
1629
|
+
### pressKeyDown
|
|
1630
|
+
|
|
1631
|
+
Presses a key in the browser and leaves it in a down state.
|
|
1632
|
+
|
|
1633
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][35]).
|
|
1634
|
+
|
|
1635
|
+
```js
|
|
1636
|
+
I.pressKeyDown('Control');
|
|
1637
|
+
I.click('#element');
|
|
1638
|
+
I.pressKeyUp('Control');
|
|
1639
|
+
```
|
|
1640
|
+
|
|
1641
|
+
#### Parameters
|
|
1642
|
+
|
|
1643
|
+
- `key` **[string][9]** name of key to press down.
|
|
1644
|
+
|
|
1645
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1646
|
+
|
|
1647
|
+
### pressKeyUp
|
|
1648
|
+
|
|
1649
|
+
Releases a key in the browser which was previously set to a down state.
|
|
1650
|
+
|
|
1651
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][35]).
|
|
1652
|
+
|
|
1653
|
+
```js
|
|
1654
|
+
I.pressKeyDown('Control');
|
|
1655
|
+
I.click('#element');
|
|
1656
|
+
I.pressKeyUp('Control');
|
|
1657
|
+
```
|
|
1658
|
+
|
|
1659
|
+
#### Parameters
|
|
1660
|
+
|
|
1661
|
+
- `key` **[string][9]** name of key to release.
|
|
1662
|
+
|
|
1663
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1664
|
+
|
|
1665
|
+
### refreshPage
|
|
1666
|
+
|
|
1667
|
+
Reload the current page.
|
|
1668
|
+
|
|
1669
|
+
```js
|
|
1670
|
+
I.refreshPage();
|
|
1671
|
+
```
|
|
1672
|
+
|
|
1673
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1674
|
+
|
|
1675
|
+
### replayFromHar
|
|
1676
|
+
|
|
1677
|
+
Replaying from HAR
|
|
1678
|
+
|
|
1679
|
+
```js
|
|
1680
|
+
// Replay API requests from HAR.
|
|
1681
|
+
// Either use a matching response from the HAR,
|
|
1682
|
+
// or abort the request if nothing matches.
|
|
1683
|
+
I.replayFromHar('./output/har/something.har', { url: "*/**/api/v1/fruits" });
|
|
1684
|
+
I.amOnPage('https://demo.playwright.dev/api-mocking');
|
|
1685
|
+
I.see('CodeceptJS');
|
|
1686
|
+
```
|
|
1687
|
+
|
|
1688
|
+
#### Parameters
|
|
1689
|
+
|
|
1690
|
+
- `harFilePath` **[string][9]** Path to recorded HAR file
|
|
1691
|
+
- `opts` **[object][6]?** [Options for replaying from HAR][36]
|
|
1692
|
+
|
|
1693
|
+
Returns **any** Promise<void>
|
|
1694
|
+
|
|
1695
|
+
### resizeWindow
|
|
1696
|
+
|
|
1697
|
+
Unlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1698
|
+
Playwright does not control the window of a browser, so it can't adjust its real size.
|
|
1699
|
+
It also can't maximize a window.
|
|
1700
|
+
|
|
1701
|
+
Update configuration to change real window size on start:
|
|
1702
|
+
|
|
1703
|
+
```js
|
|
1704
|
+
// inside codecept.conf.js
|
|
1705
|
+
// @codeceptjs/configure package must be installed
|
|
1706
|
+
{ setWindowSize } = require('@codeceptjs/configure');
|
|
1707
|
+
```
|
|
1708
|
+
|
|
1709
|
+
Resize the current window to provided width and height.
|
|
1710
|
+
First parameter can be set to `maximize`.
|
|
1711
|
+
|
|
1712
|
+
#### Parameters
|
|
1713
|
+
|
|
1714
|
+
- `width` **[number][20]** width in pixels or `maximize`.
|
|
1715
|
+
- `height` **[number][20]** height in pixels.
|
|
1716
|
+
|
|
1717
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1718
|
+
|
|
1719
|
+
### restartBrowser
|
|
1720
|
+
|
|
1721
|
+
Restart browser with a new context and a new page
|
|
1722
|
+
|
|
1723
|
+
```js
|
|
1724
|
+
// Restart browser and use a new timezone
|
|
1725
|
+
I.restartBrowser({ timezoneId: 'America/Phoenix' });
|
|
1726
|
+
// Open URL in a new page in changed timezone
|
|
1727
|
+
I.amOnPage('/');
|
|
1728
|
+
// Restart browser, allow reading/copying of text from/into clipboard in Chrome
|
|
1729
|
+
I.restartBrowser({ permissions: ['clipboard-read', 'clipboard-write'] });
|
|
1730
|
+
```
|
|
1731
|
+
|
|
1732
|
+
#### Parameters
|
|
1733
|
+
|
|
1734
|
+
- `contextOptions` **[object][6]?** [Options for browser context][7] when starting new browser
|
|
1735
|
+
|
|
1736
|
+
### rightClick
|
|
1737
|
+
|
|
1738
|
+
Performs right click on a clickable element matched by semantic locator, CSS or XPath.
|
|
1739
|
+
|
|
1740
|
+
```js
|
|
1741
|
+
// right click element with id el
|
|
1742
|
+
I.rightClick('#el');
|
|
1743
|
+
// right click link or button with text "Click me"
|
|
1744
|
+
I.rightClick('Click me');
|
|
1745
|
+
// right click button with text "Click me" inside .context
|
|
1746
|
+
I.rightClick('Click me', '.context');
|
|
1747
|
+
```
|
|
1748
|
+
|
|
1749
|
+
#### Parameters
|
|
1750
|
+
|
|
1751
|
+
- `locator` **([string][9] | [object][6])** clickable element located by CSS|XPath|strict locator.
|
|
1752
|
+
- `context` **([string][9]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1753
|
+
|
|
1754
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1755
|
+
|
|
1756
|
+
### saveElementScreenshot
|
|
1757
|
+
|
|
1758
|
+
Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
1759
|
+
Filename is relative to output folder.
|
|
1760
|
+
|
|
1761
|
+
```js
|
|
1762
|
+
I.saveElementScreenshot(`#submit`,'debug.png');
|
|
1763
|
+
```
|
|
1764
|
+
|
|
1765
|
+
#### Parameters
|
|
1766
|
+
|
|
1767
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1768
|
+
- `fileName` **[string][9]** file name to save.
|
|
1769
|
+
|
|
1770
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1771
|
+
|
|
1772
|
+
### saveScreenshot
|
|
1773
|
+
|
|
1774
|
+
Saves a screenshot to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
1775
|
+
Filename is relative to output folder.
|
|
1776
|
+
Optionally resize the window to the full available page `scrollHeight` and `scrollWidth` to capture the entire page by passing `true` in as the second argument.
|
|
1777
|
+
|
|
1778
|
+
```js
|
|
1779
|
+
I.saveScreenshot('debug.png');
|
|
1780
|
+
I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scrollWidth before taking screenshot
|
|
1781
|
+
```
|
|
1782
|
+
|
|
1783
|
+
#### Parameters
|
|
1784
|
+
|
|
1785
|
+
- `fileName` **[string][9]** file name to save.
|
|
1786
|
+
- `fullPage` **[boolean][26]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1787
|
+
|
|
1788
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1789
|
+
|
|
1790
|
+
### scrollPageToBottom
|
|
1791
|
+
|
|
1792
|
+
Scroll page to the bottom.
|
|
1793
|
+
|
|
1794
|
+
```js
|
|
1795
|
+
I.scrollPageToBottom();
|
|
1796
|
+
```
|
|
1797
|
+
|
|
1798
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1799
|
+
|
|
1800
|
+
### scrollPageToTop
|
|
1801
|
+
|
|
1802
|
+
Scroll page to the top.
|
|
1803
|
+
|
|
1804
|
+
```js
|
|
1805
|
+
I.scrollPageToTop();
|
|
1806
|
+
```
|
|
1807
|
+
|
|
1808
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1809
|
+
|
|
1810
|
+
### scrollTo
|
|
1811
|
+
|
|
1812
|
+
Scrolls to element matched by locator.
|
|
1813
|
+
Extra shift can be set with offsetX and offsetY options.
|
|
1814
|
+
|
|
1815
|
+
```js
|
|
1816
|
+
I.scrollTo('footer');
|
|
1817
|
+
I.scrollTo('#submit', 5, 5);
|
|
1818
|
+
```
|
|
1819
|
+
|
|
1820
|
+
#### Parameters
|
|
1821
|
+
|
|
1822
|
+
- `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1823
|
+
- `offsetX` **[number][20]** (optional, `0` by default) X-axis offset.
|
|
1824
|
+
- `offsetY` **[number][20]** (optional, `0` by default) Y-axis offset.
|
|
1825
|
+
|
|
1826
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1827
|
+
|
|
1828
|
+
### see
|
|
1829
|
+
|
|
1830
|
+
Checks that a page contains a visible text.
|
|
1831
|
+
Use context parameter to narrow down the search.
|
|
1832
|
+
|
|
1833
|
+
```js
|
|
1834
|
+
I.see('Welcome'); // text welcome on a page
|
|
1835
|
+
I.see('Welcome', '.content'); // text inside .content div
|
|
1836
|
+
I.see('Register', {css: 'form.register'}); // use strict locator
|
|
1837
|
+
```
|
|
1838
|
+
|
|
1839
|
+
#### Parameters
|
|
1840
|
+
|
|
1841
|
+
- `text` **[string][9]** expected on page.
|
|
1842
|
+
- `context` **([string][9]? | [object][6])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1843
|
+
|
|
1844
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1845
|
+
|
|
1846
|
+
### seeAttributesOnElements
|
|
1847
|
+
|
|
1848
|
+
Checks that all elements with given locator have given attributes.
|
|
1849
|
+
|
|
1850
|
+
```js
|
|
1851
|
+
I.seeAttributesOnElements('//form', { method: "post"});
|
|
1852
|
+
```
|
|
1853
|
+
|
|
1854
|
+
#### Parameters
|
|
1855
|
+
|
|
1856
|
+
- `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1857
|
+
- `attributes` **[object][6]** attributes and their values to check.
|
|
1858
|
+
|
|
1859
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1860
|
+
|
|
1861
|
+
### seeCheckboxIsChecked
|
|
1862
|
+
|
|
1863
|
+
Verifies that the specified checkbox is checked.
|
|
1864
|
+
|
|
1865
|
+
```js
|
|
1866
|
+
I.seeCheckboxIsChecked('Agree');
|
|
1867
|
+
I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
|
|
1868
|
+
I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
1869
|
+
```
|
|
1870
|
+
|
|
1871
|
+
#### Parameters
|
|
1872
|
+
|
|
1873
|
+
- `field` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
1874
|
+
|
|
1875
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1876
|
+
|
|
1877
|
+
### seeCookie
|
|
1878
|
+
|
|
1879
|
+
Checks that cookie with given name exists.
|
|
1880
|
+
|
|
1881
|
+
```js
|
|
1882
|
+
I.seeCookie('Auth');
|
|
1883
|
+
```
|
|
1884
|
+
|
|
1885
|
+
#### Parameters
|
|
1886
|
+
|
|
1887
|
+
- `name` **[string][9]** cookie name.
|
|
1888
|
+
|
|
1889
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1890
|
+
|
|
1891
|
+
### seeCssPropertiesOnElements
|
|
1892
|
+
|
|
1893
|
+
Checks that all elements with given locator have given CSS properties.
|
|
1894
|
+
|
|
1895
|
+
```js
|
|
1896
|
+
I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
1897
|
+
```
|
|
1898
|
+
|
|
1899
|
+
#### Parameters
|
|
1900
|
+
|
|
1901
|
+
- `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1902
|
+
- `cssProperties` **[object][6]** object with CSS properties and their values to check.
|
|
1903
|
+
|
|
1904
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1905
|
+
|
|
1906
|
+
### seeCurrentUrlEquals
|
|
1907
|
+
|
|
1908
|
+
Checks that current url is equal to provided one.
|
|
1909
|
+
If a relative url provided, a configured url will be prepended to it.
|
|
1910
|
+
So both examples will work:
|
|
1911
|
+
|
|
1912
|
+
```js
|
|
1913
|
+
I.seeCurrentUrlEquals('/register');
|
|
1914
|
+
I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
1915
|
+
```
|
|
1916
|
+
|
|
1917
|
+
#### Parameters
|
|
1918
|
+
|
|
1919
|
+
- `url` **[string][9]** value to check.
|
|
1920
|
+
|
|
1921
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1922
|
+
|
|
1923
|
+
### seeElement
|
|
1924
|
+
|
|
1925
|
+
Checks that a given Element is visible
|
|
1926
|
+
Element is located by CSS or XPath.
|
|
1927
|
+
|
|
1928
|
+
```js
|
|
1929
|
+
I.seeElement('#modal');
|
|
1930
|
+
```
|
|
1931
|
+
|
|
1932
|
+
#### Parameters
|
|
1933
|
+
|
|
1934
|
+
- `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1935
|
+
|
|
1936
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1937
|
+
|
|
1938
|
+
### seeElementInDOM
|
|
1939
|
+
|
|
1940
|
+
Checks that a given Element is present in the DOM
|
|
1941
|
+
Element is located by CSS or XPath.
|
|
1942
|
+
|
|
1943
|
+
```js
|
|
1944
|
+
I.seeElementInDOM('#modal');
|
|
1945
|
+
```
|
|
1946
|
+
|
|
1947
|
+
#### Parameters
|
|
1948
|
+
|
|
1949
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1950
|
+
|
|
1951
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1952
|
+
|
|
1953
|
+
### seeInCurrentUrl
|
|
1954
|
+
|
|
1955
|
+
Checks that current url contains a provided fragment.
|
|
1956
|
+
|
|
1957
|
+
```js
|
|
1958
|
+
I.seeInCurrentUrl('/register'); // we are on registration page
|
|
1959
|
+
```
|
|
1960
|
+
|
|
1961
|
+
#### Parameters
|
|
1962
|
+
|
|
1963
|
+
- `url` **[string][9]** a fragment to check
|
|
1964
|
+
|
|
1965
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1966
|
+
|
|
1967
|
+
### seeInField
|
|
1968
|
+
|
|
1969
|
+
Checks that the given input field or textarea equals to given value.
|
|
1970
|
+
For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
1971
|
+
|
|
1972
|
+
```js
|
|
1973
|
+
I.seeInField('Username', 'davert');
|
|
1974
|
+
I.seeInField({css: 'form textarea'},'Type your comment here');
|
|
1975
|
+
I.seeInField('form input[type=hidden]','hidden_value');
|
|
1976
|
+
I.seeInField('#searchform input','Search');
|
|
1977
|
+
```
|
|
1978
|
+
|
|
1979
|
+
#### Parameters
|
|
1980
|
+
|
|
1981
|
+
- `field` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
1982
|
+
- `value` **([string][9] | [object][6])** value to check.
|
|
1983
|
+
|
|
1984
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1985
|
+
|
|
1986
|
+
### seeInPopup
|
|
1987
|
+
|
|
1988
|
+
Checks that the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`, contains the
|
|
1989
|
+
given string.
|
|
1990
|
+
|
|
1991
|
+
```js
|
|
1992
|
+
I.seeInPopup('Popup text');
|
|
1993
|
+
```
|
|
1994
|
+
|
|
1995
|
+
#### Parameters
|
|
1996
|
+
|
|
1997
|
+
- `text` **[string][9]** value to check.
|
|
1998
|
+
|
|
1999
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2000
|
+
|
|
2001
|
+
### seeInSource
|
|
2002
|
+
|
|
2003
|
+
Checks that the current page contains the given string in its raw source code.
|
|
2004
|
+
|
|
2005
|
+
```js
|
|
2006
|
+
I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
2007
|
+
```
|
|
2008
|
+
|
|
2009
|
+
#### Parameters
|
|
2010
|
+
|
|
2011
|
+
- `text` **[string][9]** value to check.
|
|
2012
|
+
|
|
2013
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2014
|
+
|
|
2015
|
+
### seeInTitle
|
|
2016
|
+
|
|
2017
|
+
Checks that title contains text.
|
|
2018
|
+
|
|
2019
|
+
```js
|
|
2020
|
+
I.seeInTitle('Home Page');
|
|
2021
|
+
```
|
|
2022
|
+
|
|
2023
|
+
#### Parameters
|
|
2024
|
+
|
|
2025
|
+
- `text` **[string][9]** text value to check.
|
|
2026
|
+
|
|
2027
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2028
|
+
|
|
2029
|
+
### seeNumberOfElements
|
|
2030
|
+
|
|
2031
|
+
Asserts that an element appears a given number of times in the DOM.
|
|
2032
|
+
Element is located by label or name or CSS or XPath.
|
|
2033
|
+
|
|
2034
|
+
```js
|
|
2035
|
+
I.seeNumberOfElements('#submitBtn', 1);
|
|
2036
|
+
```
|
|
2037
|
+
|
|
2038
|
+
#### Parameters
|
|
2039
|
+
|
|
2040
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2041
|
+
- `num` **[number][20]** number of elements.
|
|
2042
|
+
|
|
2043
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2044
|
+
|
|
2045
|
+
### seeNumberOfVisibleElements
|
|
2046
|
+
|
|
2047
|
+
Asserts that an element is visible a given number of times.
|
|
2048
|
+
Element is located by CSS or XPath.
|
|
2049
|
+
|
|
2050
|
+
```js
|
|
2051
|
+
I.seeNumberOfVisibleElements('.buttons', 3);
|
|
2052
|
+
```
|
|
2053
|
+
|
|
2054
|
+
#### Parameters
|
|
2055
|
+
|
|
2056
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2057
|
+
- `num` **[number][20]** number of elements.
|
|
2058
|
+
|
|
2059
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2060
|
+
|
|
2061
|
+
### seeTextEquals
|
|
2062
|
+
|
|
2063
|
+
Checks that text is equal to provided one.
|
|
2064
|
+
|
|
2065
|
+
```js
|
|
2066
|
+
I.seeTextEquals('text', 'h1');
|
|
2067
|
+
```
|
|
2068
|
+
|
|
2069
|
+
#### Parameters
|
|
2070
|
+
|
|
2071
|
+
- `text` **[string][9]** element value to check.
|
|
2072
|
+
- `context` **([string][9] | [object][6])?** element located by CSS|XPath|strict locator.
|
|
2073
|
+
|
|
2074
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2075
|
+
|
|
2076
|
+
### seeTitleEquals
|
|
2077
|
+
|
|
2078
|
+
Checks that title is equal to provided one.
|
|
2079
|
+
|
|
2080
|
+
```js
|
|
2081
|
+
I.seeTitleEquals('Test title.');
|
|
2082
|
+
```
|
|
2083
|
+
|
|
2084
|
+
#### Parameters
|
|
2085
|
+
|
|
2086
|
+
- `text` **[string][9]** value to check.
|
|
2087
|
+
|
|
2088
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2089
|
+
|
|
2090
|
+
### seeTraffic
|
|
2091
|
+
|
|
2092
|
+
Verifies that a certain request is part of network traffic.
|
|
2093
|
+
|
|
2094
|
+
```js
|
|
2095
|
+
// checking the request url contains certain query strings
|
|
2096
|
+
I.amOnPage('https://openai.com/blog/chatgpt');
|
|
2097
|
+
I.startRecordingTraffic();
|
|
2098
|
+
await I.seeTraffic({
|
|
2099
|
+
name: 'sentry event',
|
|
2100
|
+
url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
2101
|
+
parameters: {
|
|
2102
|
+
width: '1919',
|
|
2103
|
+
height: '1138',
|
|
2104
|
+
},
|
|
2105
|
+
});
|
|
2106
|
+
```
|
|
2107
|
+
|
|
2108
|
+
```js
|
|
2109
|
+
// checking the request url contains certain post data
|
|
2110
|
+
I.amOnPage('https://openai.com/blog/chatgpt');
|
|
2111
|
+
I.startRecordingTraffic();
|
|
2112
|
+
await I.seeTraffic({
|
|
2113
|
+
name: 'event',
|
|
2114
|
+
url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
2115
|
+
requestPostData: {
|
|
2116
|
+
st: 2,
|
|
2117
|
+
},
|
|
2118
|
+
});
|
|
2119
|
+
```
|
|
2120
|
+
|
|
2121
|
+
#### Parameters
|
|
2122
|
+
|
|
2123
|
+
- `opts` **[Object][6]** options when checking the traffic network.
|
|
2124
|
+
- `opts.name` **[string][9]** A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
2125
|
+
- `opts.url` **[string][9]** Expected URL of request in network traffic
|
|
2126
|
+
- `opts.parameters` **[Object][6]?** Expected parameters of that request in network traffic
|
|
2127
|
+
- `opts.requestPostData` **[Object][6]?** Expected that request contains post data in network traffic
|
|
2128
|
+
- `opts.timeout` **[number][20]?** Timeout to wait for request in seconds. Default is 10 seconds.
|
|
2129
|
+
|
|
2130
|
+
Returns **[Promise][22]<any>**
|
|
2131
|
+
|
|
2132
|
+
### selectOption
|
|
2133
|
+
|
|
2134
|
+
Selects an option in a drop-down select.
|
|
2135
|
+
Field is searched by label | name | CSS | XPath.
|
|
2136
|
+
Option is selected by visible text or by value.
|
|
2137
|
+
|
|
2138
|
+
```js
|
|
2139
|
+
I.selectOption('Choose Plan', 'Monthly'); // select by label
|
|
2140
|
+
I.selectOption('subscription', 'Monthly'); // match option by text
|
|
2141
|
+
I.selectOption('subscription', '0'); // or by value
|
|
2142
|
+
I.selectOption('//form/select[@name=account]','Premium');
|
|
2143
|
+
I.selectOption('form select[name=account]', 'Premium');
|
|
2144
|
+
I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
2145
|
+
```
|
|
2146
|
+
|
|
2147
|
+
Provide an array for the second argument to select multiple options.
|
|
2148
|
+
|
|
2149
|
+
```js
|
|
2150
|
+
I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
2151
|
+
```
|
|
2152
|
+
|
|
2153
|
+
#### Parameters
|
|
2154
|
+
|
|
2155
|
+
- `select` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
2156
|
+
- `option` **([string][9] | [Array][10]<any>)** visible text or value of option.
|
|
2157
|
+
|
|
2158
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2159
|
+
|
|
2160
|
+
### setCookie
|
|
2161
|
+
|
|
2162
|
+
Sets cookie(s).
|
|
2163
|
+
|
|
2164
|
+
Can be a single cookie object or an array of cookies:
|
|
2165
|
+
|
|
2166
|
+
```js
|
|
2167
|
+
I.setCookie({name: 'auth', value: true});
|
|
2168
|
+
|
|
2169
|
+
// as array
|
|
2170
|
+
I.setCookie([
|
|
2171
|
+
{name: 'auth', value: true},
|
|
2172
|
+
{name: 'agree', value: true}
|
|
2173
|
+
]);
|
|
2174
|
+
```
|
|
2175
|
+
|
|
2176
|
+
#### Parameters
|
|
2177
|
+
|
|
2178
|
+
- `cookie` **(Cookie | [Array][10]<Cookie>)** a cookie object or array of cookie objects.
|
|
2179
|
+
|
|
2180
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2181
|
+
|
|
2182
|
+
### setPlaywrightRequestHeaders
|
|
2183
|
+
|
|
2184
|
+
Set headers for all next requests
|
|
2185
|
+
|
|
2186
|
+
```js
|
|
2187
|
+
I.setPlaywrightRequestHeaders({
|
|
2188
|
+
'X-Sent-By': 'CodeceptJS',
|
|
2189
|
+
});
|
|
2190
|
+
```
|
|
2191
|
+
|
|
2192
|
+
#### Parameters
|
|
2193
|
+
|
|
2194
|
+
- `customHeaders` **[object][6]** headers to set
|
|
2195
|
+
|
|
2196
|
+
### startRecordingTraffic
|
|
2197
|
+
|
|
2198
|
+
Starts recording the network traffics.
|
|
2199
|
+
This also resets recorded network requests.
|
|
2200
|
+
|
|
2201
|
+
```js
|
|
2202
|
+
I.startRecordingTraffic();
|
|
2203
|
+
```
|
|
2204
|
+
|
|
2205
|
+
Returns **void**
|
|
2206
|
+
|
|
2207
|
+
### startRecordingWebSocketMessages
|
|
2208
|
+
|
|
2209
|
+
Starts recording of websocket messages.
|
|
2210
|
+
This also resets recorded websocket messages.
|
|
2211
|
+
|
|
2212
|
+
```js
|
|
2213
|
+
await I.startRecordingWebSocketMessages();
|
|
2214
|
+
```
|
|
2215
|
+
|
|
2216
|
+
### stopMockingRoute
|
|
2217
|
+
|
|
2218
|
+
Stops network mocking created by `mockRoute`.
|
|
2219
|
+
|
|
2220
|
+
```js
|
|
2221
|
+
I.stopMockingRoute(/(.png$)|(.jpg$)/);
|
|
2222
|
+
I.stopMockingRoute(/(.png$)|(.jpg$)/, previouslySetHandler);
|
|
2223
|
+
```
|
|
2224
|
+
|
|
2225
|
+
If no handler is passed, all mock requests for the rote are disabled.
|
|
2226
|
+
|
|
2227
|
+
#### Parameters
|
|
2228
|
+
|
|
2229
|
+
- `url` **([string][9] | [RegExp][11])?** URL, regex or pattern for to match URL
|
|
2230
|
+
- `handler` **[function][21]?** a function to process reques
|
|
2231
|
+
|
|
2232
|
+
### stopRecordingTraffic
|
|
2233
|
+
|
|
2234
|
+
Stops recording of network traffic. Recorded traffic is not flashed.
|
|
2235
|
+
|
|
2236
|
+
```js
|
|
2237
|
+
I.stopRecordingTraffic();
|
|
2238
|
+
```
|
|
2239
|
+
|
|
2240
|
+
### stopRecordingWebSocketMessages
|
|
2241
|
+
|
|
2242
|
+
Stops recording WS messages. Recorded WS messages is not flashed.
|
|
2243
|
+
|
|
2244
|
+
```js
|
|
2245
|
+
await I.stopRecordingWebSocketMessages();
|
|
2246
|
+
```
|
|
2247
|
+
|
|
2248
|
+
### switchTo
|
|
2249
|
+
|
|
2250
|
+
Switches frame or in case of null locator reverts to parent.
|
|
2251
|
+
|
|
2252
|
+
```js
|
|
2253
|
+
I.switchTo('iframe'); // switch to first iframe
|
|
2254
|
+
I.switchTo(); // switch back to main page
|
|
2255
|
+
```
|
|
2256
|
+
|
|
2257
|
+
#### Parameters
|
|
2258
|
+
|
|
2259
|
+
- `locator` **([string][9]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
2260
|
+
|
|
2261
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2262
|
+
|
|
2263
|
+
### switchToNextTab
|
|
2264
|
+
|
|
2265
|
+
Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
2266
|
+
|
|
2267
|
+
```js
|
|
2268
|
+
I.switchToNextTab();
|
|
2269
|
+
I.switchToNextTab(2);
|
|
2270
|
+
```
|
|
2271
|
+
|
|
2272
|
+
#### Parameters
|
|
2273
|
+
|
|
2274
|
+
- `num` **[number][20]**
|
|
2275
|
+
|
|
2276
|
+
### switchToPreviousTab
|
|
2277
|
+
|
|
2278
|
+
Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
2279
|
+
|
|
2280
|
+
```js
|
|
2281
|
+
I.switchToPreviousTab();
|
|
2282
|
+
I.switchToPreviousTab(2);
|
|
2283
|
+
```
|
|
2284
|
+
|
|
2285
|
+
#### Parameters
|
|
2286
|
+
|
|
2287
|
+
- `num` **[number][20]**
|
|
2288
|
+
|
|
2289
|
+
### type
|
|
2290
|
+
|
|
2291
|
+
Types out the given text into an active field.
|
|
2292
|
+
To slow down typing use a second parameter, to set interval between key presses.
|
|
2293
|
+
_Note:_ Should be used when [`fillField`][34] is not an option.
|
|
2294
|
+
|
|
2295
|
+
```js
|
|
2296
|
+
// passing in a string
|
|
2297
|
+
I.type('Type this out.');
|
|
2298
|
+
|
|
2299
|
+
// typing values with a 100ms interval
|
|
2300
|
+
I.type('4141555311111111', 100);
|
|
2301
|
+
|
|
2302
|
+
// passing in an array
|
|
2303
|
+
I.type(['T', 'E', 'X', 'T']);
|
|
2304
|
+
|
|
2305
|
+
// passing a secret
|
|
2306
|
+
I.type(secret('123456'));
|
|
2307
|
+
```
|
|
2308
|
+
|
|
2309
|
+
#### Parameters
|
|
2310
|
+
|
|
2311
|
+
- `keys`
|
|
2312
|
+
- `delay` **[number][20]?** (optional) delay in ms between key presses
|
|
2313
|
+
- `key` **([string][9] | [Array][10]<[string][9]>)** or array of keys to type.
|
|
2314
|
+
|
|
2315
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2316
|
+
|
|
2317
|
+
### uncheckOption
|
|
2318
|
+
|
|
2319
|
+
[Additional options][37] for uncheck available as 3rd argument.
|
|
2320
|
+
|
|
2321
|
+
Examples:
|
|
2322
|
+
|
|
2323
|
+
```js
|
|
2324
|
+
// click on element at position
|
|
2325
|
+
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
2326
|
+
```
|
|
2327
|
+
|
|
2328
|
+
> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
2329
|
+
|
|
2330
|
+
Unselects a checkbox or radio button.
|
|
2331
|
+
Element is located by label or name or CSS or XPath.
|
|
2332
|
+
|
|
2333
|
+
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
2334
|
+
|
|
2335
|
+
```js
|
|
2336
|
+
I.uncheckOption('#agree');
|
|
2337
|
+
I.uncheckOption('I Agree to Terms and Conditions');
|
|
2338
|
+
I.uncheckOption('agree', '//form');
|
|
2339
|
+
```
|
|
2340
|
+
|
|
2341
|
+
#### Parameters
|
|
2342
|
+
|
|
2343
|
+
- `field` **([string][9] | [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
2344
|
+
- `context` **([string][9]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2345
|
+
- `options`
|
|
2346
|
+
|
|
2347
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2348
|
+
|
|
2349
|
+
### usePlaywrightTo
|
|
2350
|
+
|
|
2351
|
+
Use Playwright API inside a test.
|
|
2352
|
+
|
|
2353
|
+
First argument is a description of an action.
|
|
2354
|
+
Second argument is async function that gets this helper as parameter.
|
|
2355
|
+
|
|
2356
|
+
{ [`page`][38], [`browserContext`][39] [`browser`][40] } objects from Playwright API are available.
|
|
2357
|
+
|
|
2358
|
+
```js
|
|
2359
|
+
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
2360
|
+
await browserContext.setOffline(true);
|
|
2361
|
+
});
|
|
2362
|
+
```
|
|
2363
|
+
|
|
2364
|
+
#### Parameters
|
|
2365
|
+
|
|
2366
|
+
- `description` **[string][9]** used to show in logs.
|
|
2367
|
+
- `fn` **[function][21]** async function that executed with Playwright helper as arguments
|
|
2368
|
+
|
|
2369
|
+
### wait
|
|
2370
|
+
|
|
2371
|
+
Pauses execution for a number of seconds.
|
|
2372
|
+
|
|
2373
|
+
```js
|
|
2374
|
+
I.wait(2); // wait 2 secs
|
|
2375
|
+
```
|
|
2376
|
+
|
|
2377
|
+
#### Parameters
|
|
2378
|
+
|
|
2379
|
+
- `sec` **[number][20]** number of second to wait.
|
|
2380
|
+
|
|
2381
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2382
|
+
|
|
2383
|
+
### waitForClickable
|
|
2384
|
+
|
|
2385
|
+
Waits for element to be clickable (by default waits for 1sec).
|
|
2386
|
+
Element can be located by CSS or XPath.
|
|
2387
|
+
|
|
2388
|
+
```js
|
|
2389
|
+
I.waitForClickable('.btn.continue');
|
|
2390
|
+
I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
2391
|
+
```
|
|
2392
|
+
|
|
2393
|
+
#### Parameters
|
|
2394
|
+
|
|
2395
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2396
|
+
- `waitTimeout`
|
|
2397
|
+
- `sec` **[number][20]?** (optional, `1` by default) time in seconds to wait
|
|
2398
|
+
|
|
2399
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2400
|
+
|
|
2401
|
+
### waitForDetached
|
|
2402
|
+
|
|
2403
|
+
Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
2404
|
+
Element can be located by CSS or XPath.
|
|
2405
|
+
|
|
2406
|
+
```js
|
|
2407
|
+
I.waitForDetached('#popup');
|
|
2408
|
+
```
|
|
2409
|
+
|
|
2410
|
+
#### Parameters
|
|
2411
|
+
|
|
2412
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2413
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2414
|
+
|
|
2415
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2416
|
+
|
|
2417
|
+
### waitForElement
|
|
2418
|
+
|
|
2419
|
+
Waits for element to be present on page (by default waits for 1sec).
|
|
2420
|
+
Element can be located by CSS or XPath.
|
|
2421
|
+
|
|
2422
|
+
```js
|
|
2423
|
+
I.waitForElement('.btn.continue');
|
|
2424
|
+
I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
2425
|
+
```
|
|
2426
|
+
|
|
2427
|
+
#### Parameters
|
|
2428
|
+
|
|
2429
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2430
|
+
- `sec` **[number][20]?** (optional, `1` by default) time in seconds to wait
|
|
2431
|
+
|
|
2432
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2433
|
+
|
|
2434
|
+
### waitForEnabled
|
|
2435
|
+
|
|
2436
|
+
Waits for element to become enabled (by default waits for 1sec).
|
|
2437
|
+
Element can be located by CSS or XPath.
|
|
2438
|
+
|
|
2439
|
+
#### Parameters
|
|
2440
|
+
|
|
2441
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2442
|
+
- `sec` **[number][20]** (optional) time in seconds to wait, 1 by default.
|
|
2443
|
+
|
|
2444
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2445
|
+
|
|
2446
|
+
### waitForFunction
|
|
2447
|
+
|
|
2448
|
+
Waits for a function to return true (waits for 1 sec by default).
|
|
2449
|
+
Running in browser context.
|
|
2450
|
+
|
|
2451
|
+
```js
|
|
2452
|
+
I.waitForFunction(fn[, [args[, timeout]])
|
|
2453
|
+
```
|
|
2454
|
+
|
|
2455
|
+
```js
|
|
2456
|
+
I.waitForFunction(() => window.requests == 0);
|
|
2457
|
+
I.waitForFunction(() => window.requests == 0, 5); // waits for 5 sec
|
|
2458
|
+
I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and wait for 5 sec
|
|
2459
|
+
```
|
|
2460
|
+
|
|
2461
|
+
#### Parameters
|
|
2462
|
+
|
|
2463
|
+
- `fn` **([string][9] | [function][21])** to be executed in browser context.
|
|
2464
|
+
- `argsOrSec` **([Array][10]<any> | [number][20])?** (optional, `1` by default) arguments for function or seconds.
|
|
2465
|
+
- `sec` **[number][20]?** (optional, `1` by default) time in seconds to wait
|
|
2466
|
+
|
|
2467
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2468
|
+
|
|
2469
|
+
### waitForInvisible
|
|
2470
|
+
|
|
2471
|
+
Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
|
|
2472
|
+
Element can be located by CSS or XPath.
|
|
2473
|
+
|
|
2474
|
+
```js
|
|
2475
|
+
I.waitForInvisible('#popup');
|
|
2476
|
+
```
|
|
2477
|
+
|
|
2478
|
+
#### Parameters
|
|
2479
|
+
|
|
2480
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2481
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2482
|
+
|
|
2483
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2484
|
+
|
|
2485
|
+
### waitForNavigation
|
|
2486
|
+
|
|
2487
|
+
Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
2488
|
+
|
|
2489
|
+
See [Playwright's reference][41]
|
|
2490
|
+
|
|
2491
|
+
#### Parameters
|
|
2492
|
+
|
|
2493
|
+
- `options` **any**
|
|
2494
|
+
|
|
2495
|
+
### waitForNumberOfTabs
|
|
2496
|
+
|
|
2497
|
+
Waits for number of tabs.
|
|
2498
|
+
|
|
2499
|
+
```js
|
|
2500
|
+
I.waitForNumberOfTabs(2);
|
|
2501
|
+
```
|
|
2502
|
+
|
|
2503
|
+
#### Parameters
|
|
2504
|
+
|
|
2505
|
+
- `expectedTabs` **[number][20]** expecting the number of tabs.
|
|
2506
|
+
- `sec` **[number][20]** number of secs to wait.
|
|
2507
|
+
|
|
2508
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2509
|
+
|
|
2510
|
+
### waitForRequest
|
|
2511
|
+
|
|
2512
|
+
Waits for a network request.
|
|
2513
|
+
|
|
2514
|
+
```js
|
|
2515
|
+
I.waitForRequest('http://example.com/resource');
|
|
2516
|
+
I.waitForRequest(request => request.url() === 'http://example.com' && request.method() === 'GET');
|
|
2517
|
+
```
|
|
2518
|
+
|
|
2519
|
+
#### Parameters
|
|
2520
|
+
|
|
2521
|
+
- `urlOrPredicate` **([string][9] | [function][21])**
|
|
2522
|
+
- `sec` **[number][20]?** seconds to wait
|
|
2523
|
+
|
|
2524
|
+
### waitForResponse
|
|
2525
|
+
|
|
2526
|
+
Waits for a network response.
|
|
2527
|
+
|
|
2528
|
+
```js
|
|
2529
|
+
I.waitForResponse('http://example.com/resource');
|
|
2530
|
+
I.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200);
|
|
2531
|
+
```
|
|
2532
|
+
|
|
2533
|
+
#### Parameters
|
|
2534
|
+
|
|
2535
|
+
- `urlOrPredicate` **([string][9] | [function][21])**
|
|
2536
|
+
- `sec` **[number][20]?** number of seconds to wait
|
|
2537
|
+
|
|
2538
|
+
### waitForText
|
|
2539
|
+
|
|
2540
|
+
Waits for a text to appear (by default waits for 1sec).
|
|
2541
|
+
Element can be located by CSS or XPath.
|
|
2542
|
+
Narrow down search results by providing context.
|
|
2543
|
+
|
|
2544
|
+
```js
|
|
2545
|
+
I.waitForText('Thank you, form has been submitted');
|
|
2546
|
+
I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
2547
|
+
```
|
|
2548
|
+
|
|
2549
|
+
#### Parameters
|
|
2550
|
+
|
|
2551
|
+
- `text` **[string][9]** to wait for.
|
|
2552
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2553
|
+
- `context` **([string][9] | [object][6])?** (optional) element located by CSS|XPath|strict locator.
|
|
2554
|
+
|
|
2555
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2556
|
+
|
|
2557
|
+
### waitForURL
|
|
2558
|
+
|
|
2559
|
+
Waits for page navigates to a new URL or reloads. By default, it takes configured `waitForNavigation` option.
|
|
2560
|
+
|
|
2561
|
+
See [Playwright's reference][42]
|
|
2562
|
+
|
|
2563
|
+
#### Parameters
|
|
2564
|
+
|
|
2565
|
+
- `url` **([string][9] | [RegExp][11])** A glob pattern, regex pattern or predicate receiving URL to match while waiting for the navigation. Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly equal to the string.
|
|
2566
|
+
- `options` **any**
|
|
2567
|
+
|
|
2568
|
+
### waitForValue
|
|
2569
|
+
|
|
2570
|
+
Waits for the specified value to be in value attribute.
|
|
2571
|
+
|
|
2572
|
+
```js
|
|
2573
|
+
I.waitForValue('//input', "GoodValue");
|
|
2574
|
+
```
|
|
2575
|
+
|
|
2576
|
+
#### Parameters
|
|
2577
|
+
|
|
2578
|
+
- `field` **([string][9] | [object][6])** input field.
|
|
2579
|
+
- `value` **[string][9]** expected value.
|
|
2580
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2581
|
+
|
|
2582
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2583
|
+
|
|
2584
|
+
### waitForVisible
|
|
2585
|
+
|
|
2586
|
+
This method accepts [React selectors][43].
|
|
2587
|
+
|
|
2588
|
+
Waits for an element to become visible on a page (by default waits for 1sec).
|
|
2589
|
+
Element can be located by CSS or XPath.
|
|
2590
|
+
|
|
2591
|
+
```js
|
|
2592
|
+
I.waitForVisible('#popup');
|
|
2593
|
+
```
|
|
2594
|
+
|
|
2595
|
+
#### Parameters
|
|
2596
|
+
|
|
2597
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2598
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2599
|
+
|
|
2600
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2601
|
+
|
|
2602
|
+
### waitInUrl
|
|
2603
|
+
|
|
2604
|
+
Waiting for the part of the URL to match the expected. Useful for SPA to understand that page was changed.
|
|
2605
|
+
|
|
2606
|
+
```js
|
|
2607
|
+
I.waitInUrl('/info', 2);
|
|
2608
|
+
```
|
|
2609
|
+
|
|
2610
|
+
#### Parameters
|
|
2611
|
+
|
|
2612
|
+
- `urlPart` **[string][9]** value to check.
|
|
2613
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2614
|
+
|
|
2615
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2616
|
+
|
|
2617
|
+
### waitNumberOfVisibleElements
|
|
2618
|
+
|
|
2619
|
+
Waits for a specified number of elements on the page.
|
|
2620
|
+
|
|
2621
|
+
```js
|
|
2622
|
+
I.waitNumberOfVisibleElements('a', 3);
|
|
2623
|
+
```
|
|
2624
|
+
|
|
2625
|
+
#### Parameters
|
|
2626
|
+
|
|
2627
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2628
|
+
- `num` **[number][20]** number of elements.
|
|
2629
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2630
|
+
|
|
2631
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2632
|
+
|
|
2633
|
+
### waitToHide
|
|
2634
|
+
|
|
2635
|
+
Waits for an element to hide (by default waits for 1sec).
|
|
2636
|
+
Element can be located by CSS or XPath.
|
|
2637
|
+
|
|
2638
|
+
```js
|
|
2639
|
+
I.waitToHide('#popup');
|
|
2640
|
+
```
|
|
2641
|
+
|
|
2642
|
+
#### Parameters
|
|
2643
|
+
|
|
2644
|
+
- `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2645
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2646
|
+
|
|
2647
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2648
|
+
|
|
2649
|
+
### waitUrlEquals
|
|
2650
|
+
|
|
2651
|
+
Waits for the entire URL to match the expected
|
|
2652
|
+
|
|
2653
|
+
```js
|
|
2654
|
+
I.waitUrlEquals('/info', 2);
|
|
2655
|
+
I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
2656
|
+
```
|
|
2657
|
+
|
|
2658
|
+
#### Parameters
|
|
2659
|
+
|
|
2660
|
+
- `urlPart` **[string][9]** value to check.
|
|
2661
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2662
|
+
|
|
2663
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2664
|
+
|
|
2665
|
+
[1]: https://github.com/microsoft/playwright
|
|
2666
|
+
|
|
2667
|
+
[2]: https://playwright.dev/docs/next/api/class-browser#browser-new-context
|
|
2668
|
+
|
|
2669
|
+
[3]: https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har
|
|
2670
|
+
|
|
2671
|
+
[4]: https://playwright.dev/docs/api/class-browsertype#browsertypeconnectparams
|
|
2672
|
+
|
|
2673
|
+
[5]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
2674
|
+
|
|
2675
|
+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
2676
|
+
|
|
2677
|
+
[7]: https://playwright.dev/docs/api/class-browser#browser-new-context
|
|
2678
|
+
|
|
2679
|
+
[8]: http://jster.net/category/windows-modals-popups
|
|
2680
|
+
|
|
2681
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2682
|
+
|
|
2683
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2684
|
+
|
|
2685
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2686
|
+
|
|
2687
|
+
[12]: https://www.example.com**
|
|
2688
|
+
|
|
2689
|
+
[13]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2690
|
+
|
|
2691
|
+
[14]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2692
|
+
|
|
2693
|
+
[15]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2694
|
+
|
|
2695
|
+
[16]: https://playwright.dev/docs/actionability
|
|
2696
|
+
|
|
2697
|
+
[17]: https://playwright.dev/docs/api/class-locator#locator-clear
|
|
2698
|
+
|
|
2699
|
+
[18]: https://playwright.dev/docs/api/class-page#page-click
|
|
2700
|
+
|
|
2701
|
+
[19]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2702
|
+
|
|
2703
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2704
|
+
|
|
2705
|
+
[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2706
|
+
|
|
2707
|
+
[22]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2708
|
+
|
|
2709
|
+
[23]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2710
|
+
|
|
2711
|
+
[24]: https://playwright.dev/docs/api/class-consolemessage
|
|
2712
|
+
|
|
2713
|
+
[25]: https://playwright.dev/docs/api/class-locator#locator-is-checked
|
|
2714
|
+
|
|
2715
|
+
[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2716
|
+
|
|
2717
|
+
[27]: https://playwright.dev/docs/api/class-locator#locator-is-disabled
|
|
2718
|
+
|
|
2719
|
+
[28]: https://codecept.io/helpers/FileSystem
|
|
2720
|
+
|
|
2721
|
+
[29]: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
|
|
2722
|
+
|
|
2723
|
+
[30]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
2724
|
+
|
|
2725
|
+
[31]: https://playwright.dev/docs/network#handle-requests
|
|
2726
|
+
|
|
2727
|
+
[32]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2728
|
+
|
|
2729
|
+
[33]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
2730
|
+
|
|
2731
|
+
[34]: #fillfield
|
|
2732
|
+
|
|
2733
|
+
[35]: #click
|
|
2734
|
+
|
|
2735
|
+
[36]: https://playwright.dev/docs/api/class-page#page-route-from-har
|
|
2736
|
+
|
|
2737
|
+
[37]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2738
|
+
|
|
2739
|
+
[38]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2740
|
+
|
|
2741
|
+
[39]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2742
|
+
|
|
2743
|
+
[40]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2744
|
+
|
|
2745
|
+
[41]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2746
|
+
|
|
2747
|
+
[42]: https://playwright.dev/docs/api/class-page#page-wait-for-url
|
|
2748
|
+
|
|
2749
|
+
[43]: https://codecept.io/react
|
|
2750
|
+
|
|
2751
|
+
[44]: https://playwright.dev/docs/api/class-browsercontext
|
|
2752
|
+
|
|
2753
|
+
[45]: https://playwright.dev/docs/api/class-page#page-set-default-timeout
|
|
2754
|
+
|
|
2755
|
+
[46]: https://playwright.dev/docs/trace-viewer
|
|
2756
|
+
|
|
2757
|
+
[47]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|
|
2758
|
+
|
|
2759
|
+
[48]: https://playwright.dev/docs/api/class-consolemessage#console-message-type
|