codeceptjs 3.5.0 → 3.5.1-2.beta.7

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