codeceptjs 3.3.2 → 3.3.5-beta.1
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/CHANGELOG.md +44 -2
- package/docs/api.md +4 -0
- package/docs/basics.md +2 -0
- package/docs/bdd.md +12 -0
- package/docs/build/JSONResponse.js +44 -3
- package/docs/build/Playwright.js +63 -40
- package/docs/build/Puppeteer.js +54 -43
- package/docs/build/REST.js +23 -9
- package/docs/build/WebDriver.js +39 -30
- package/docs/changelog.md +6 -2
- package/docs/community-helpers.md +1 -0
- package/docs/configuration.md +21 -18
- package/docs/helpers/Appium.md +0 -723
- package/docs/helpers/JSONResponse.md +24 -0
- package/docs/helpers/Playwright.md +276 -264
- package/docs/helpers/Puppeteer.md +230 -222
- package/docs/helpers/REST.md +21 -6
- package/docs/helpers/WebDriver.md +265 -259
- package/docs/plugins.md +41 -1
- package/docs/reports.md +11 -0
- package/docs/secrets.md +30 -0
- package/docs/wiki/.git/FETCH_HEAD +1 -0
- package/docs/wiki/.git/HEAD +1 -0
- package/docs/wiki/.git/ORIG_HEAD +1 -0
- package/docs/wiki/.git/config +11 -0
- package/docs/wiki/.git/description +1 -0
- package/docs/wiki/.git/hooks/applypatch-msg.sample +15 -0
- package/docs/wiki/.git/hooks/commit-msg.sample +24 -0
- package/docs/wiki/.git/hooks/fsmonitor-watchman.sample +173 -0
- package/docs/wiki/.git/hooks/post-update.sample +8 -0
- package/docs/wiki/.git/hooks/pre-applypatch.sample +14 -0
- package/docs/wiki/.git/hooks/pre-commit.sample +49 -0
- package/docs/wiki/.git/hooks/pre-merge-commit.sample +13 -0
- package/docs/wiki/.git/hooks/pre-push.sample +53 -0
- package/docs/wiki/.git/hooks/pre-rebase.sample +169 -0
- package/docs/wiki/.git/hooks/pre-receive.sample +24 -0
- package/docs/wiki/.git/hooks/prepare-commit-msg.sample +42 -0
- package/docs/wiki/.git/hooks/push-to-checkout.sample +78 -0
- package/docs/wiki/.git/hooks/update.sample +128 -0
- package/docs/wiki/.git/index +0 -0
- package/docs/wiki/.git/info/exclude +6 -0
- package/docs/wiki/.git/logs/HEAD +1 -0
- package/docs/wiki/.git/logs/refs/heads/master +1 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/objects/pack/pack-5938044f9d30daf1c195fda4dec1d54850933935.idx +0 -0
- package/docs/wiki/.git/objects/pack/pack-5938044f9d30daf1c195fda4dec1d54850933935.pack +0 -0
- package/docs/wiki/.git/packed-refs +2 -0
- package/docs/wiki/.git/refs/heads/master +1 -0
- package/docs/wiki/.git/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/Community-Helpers-&-Plugins.md +7 -3
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +29 -0
- package/docs/wiki/Examples.md +39 -48
- package/docs/wiki/Release-Process.md +8 -8
- package/docs/wiki/Tests.md +62 -60
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +2 -2
- package/lib/cli.js +1 -1
- package/lib/command/generate.js +3 -0
- package/lib/command/init.js +83 -24
- package/lib/command/interactive.js +1 -1
- package/lib/command/run-workers.js +1 -1
- package/lib/command/workers/runTests.js +15 -0
- package/lib/helper/JSONResponse.js +44 -3
- package/lib/helper/Playwright.js +63 -40
- package/lib/helper/Puppeteer.js +54 -43
- package/lib/helper/REST.js +23 -9
- package/lib/helper/WebDriver.js +39 -30
- package/lib/interfaces/gherkin.js +1 -1
- package/lib/output.js +4 -0
- package/lib/plugin/customLocator.js +50 -3
- package/lib/plugin/retryFailedStep.js +1 -1
- package/lib/plugin/retryTo.js +1 -8
- package/lib/secret.js +31 -1
- package/lib/step.js +22 -10
- package/lib/utils.js +1 -6
- package/package.json +4 -4
- package/typings/index.d.ts +158 -0
- package/typings/types.d.ts +367 -96
|
@@ -29,48 +29,56 @@ or
|
|
|
29
29
|
|
|
30
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
31
|
|
|
32
|
+
|
|
33
|
+
|
|
32
34
|
## Configuration
|
|
33
35
|
|
|
34
|
-
This helper should be configured in codecept.
|
|
36
|
+
This helper should be configured in codecept.conf.js
|
|
37
|
+
|
|
38
|
+
Type: [object][5]
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- `
|
|
39
|
-
- `
|
|
40
|
-
|
|
40
|
+
### Properties
|
|
41
|
+
|
|
42
|
+
- `url` **[string][7]** base url of website to be tested
|
|
43
|
+
- `browser` **[string][7]** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
44
|
+
- `show` **[boolean][25]?** show browser window.
|
|
45
|
+
- `restart` **([string][7] | [boolean][25])?** restart strategy between tests. Possible values:- 'context' or **false** - restarts [browser context][32] but keeps running browser. Recommended by Playwright team to keep tests isolated.
|
|
41
46
|
- 'browser' or **true** - closes browser and opens it again between tests.
|
|
42
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
|
|
43
|
-
- `timeout
|
|
44
|
-
- `disableScreenshots
|
|
45
|
-
- `emulate
|
|
46
|
-
- `video
|
|
47
|
-
- `trace
|
|
48
|
-
- `fullPageScreenshots`
|
|
49
|
-
- `uniqueScreenshotNames
|
|
50
|
-
- `keepBrowserState
|
|
51
|
-
- `keepCookies
|
|
52
|
-
- `waitForAction
|
|
53
|
-
- `waitForNavigation
|
|
54
|
-
- `pressKeyDelay
|
|
55
|
-
- `getPageTimeout`
|
|
56
|
-
- `waitForTimeout
|
|
57
|
-
- `basicAuth
|
|
58
|
-
- `windowSize
|
|
59
|
-
- `colorScheme
|
|
60
|
-
- `userAgent
|
|
61
|
-
- `locale
|
|
62
|
-
- `manualStart
|
|
63
|
-
- `chromium
|
|
64
|
-
- `electron
|
|
65
|
-
- `channel
|
|
48
|
+
- `timeout` **[number][11]?** - [timeout][33] in ms of all Playwright actions .
|
|
49
|
+
- `disableScreenshots` **[boolean][25]?** don't save screenshot on failure.
|
|
50
|
+
- `emulate` **any?** browser in device emulation mode.
|
|
51
|
+
- `video` **[boolean][25]?** enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
52
|
+
- `trace` **[boolean][25]?** record [tracing information][34] with screenshots and snapshots.
|
|
53
|
+
- `fullPageScreenshots` **[boolean][25]?** make full page screenshots on failure.
|
|
54
|
+
- `uniqueScreenshotNames` **[boolean][25]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
55
|
+
- `keepBrowserState` **[boolean][25]?** keep browser state between tests when `restart` is set to 'session'.
|
|
56
|
+
- `keepCookies` **[boolean][25]?** keep cookies between tests when `restart` is set to 'session'.
|
|
57
|
+
- `waitForAction` **[number][11]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
58
|
+
- `waitForNavigation` **[number][11]?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API][35].
|
|
59
|
+
- `pressKeyDelay` **[number][11]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
60
|
+
- `getPageTimeout` **[number][11]?** config option to set maximum navigation time in milliseconds.
|
|
61
|
+
- `waitForTimeout` **[number][11]?** default wait* timeout in ms. Default: 1000.
|
|
62
|
+
- `basicAuth` **[object][5]?** the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
63
|
+
- `windowSize` **[string][7]?** default window size. Set a dimension like `640x480`.
|
|
64
|
+
- `colorScheme` **[string][7]?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
65
|
+
- `userAgent` **[string][7]?** user-agent string.
|
|
66
|
+
- `locale` **[string][7]?** locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
67
|
+
- `manualStart` **[boolean][25]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
68
|
+
- `chromium` **[object][5]?** pass additional chromium options
|
|
69
|
+
- `electron` **[object][5]?** (pass additional electron options
|
|
70
|
+
- `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][36].
|
|
71
|
+
|
|
72
|
+
|
|
66
73
|
|
|
67
74
|
#### Video Recording Customization
|
|
68
75
|
|
|
69
76
|
By default, video is saved to `output/video` dir. You can customize this path by passing `dir` option to `recordVideo` option.
|
|
70
77
|
|
|
71
|
-
|
|
78
|
+
`video`: enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
79
|
+
|
|
72
80
|
- `keepVideoForPassedTests`: - save videos for passed tests
|
|
73
|
-
- `recordVideo`: [additional options for videos customization][
|
|
81
|
+
- `recordVideo`: [additional options for videos customization][2]
|
|
74
82
|
|
|
75
83
|
#### Trace Recording Customization
|
|
76
84
|
|
|
@@ -123,7 +131,7 @@ Traces will be saved to `output/trace`
|
|
|
123
131
|
}
|
|
124
132
|
```
|
|
125
133
|
|
|
126
|
-
#### Example #4: Connect to remote browser by specifying [websocket endpoint][
|
|
134
|
+
#### Example #4: Connect to remote browser by specifying [websocket endpoint][3]
|
|
127
135
|
|
|
128
136
|
```js
|
|
129
137
|
{
|
|
@@ -131,7 +139,8 @@ Traces will be saved to `output/trace`
|
|
|
131
139
|
Playwright: {
|
|
132
140
|
url: "http://localhost",
|
|
133
141
|
chromium: {
|
|
134
|
-
browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a'
|
|
142
|
+
browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a',
|
|
143
|
+
cdpConnection: false // default is false
|
|
135
144
|
}
|
|
136
145
|
}
|
|
137
146
|
}
|
|
@@ -140,7 +149,7 @@ Traces will be saved to `output/trace`
|
|
|
140
149
|
|
|
141
150
|
#### Example #5: Testing with Chromium extensions
|
|
142
151
|
|
|
143
|
-
[official docs][
|
|
152
|
+
[official docs][4]
|
|
144
153
|
|
|
145
154
|
```js
|
|
146
155
|
{
|
|
@@ -219,8 +228,6 @@ const { browserContext } = this.helpers.Playwright;
|
|
|
219
228
|
await browserContext.cookies(); // get current browser context
|
|
220
229
|
```
|
|
221
230
|
|
|
222
|
-
## Methods
|
|
223
|
-
|
|
224
231
|
### Parameters
|
|
225
232
|
|
|
226
233
|
- `config`
|
|
@@ -302,13 +309,13 @@ Set current page
|
|
|
302
309
|
|
|
303
310
|
#### Parameters
|
|
304
311
|
|
|
305
|
-
- `page` **[object][
|
|
312
|
+
- `page` **[object][5]** page to set
|
|
306
313
|
|
|
307
314
|
### acceptPopup
|
|
308
315
|
|
|
309
316
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
310
317
|
Don't confuse popups with modal windows, as created by [various
|
|
311
|
-
libraries][
|
|
318
|
+
libraries][6].
|
|
312
319
|
|
|
313
320
|
### amAcceptingPopups
|
|
314
321
|
|
|
@@ -345,7 +352,7 @@ I.amOnPage('/login'); // opens a login page
|
|
|
345
352
|
|
|
346
353
|
#### Parameters
|
|
347
354
|
|
|
348
|
-
- `url` **[string][
|
|
355
|
+
- `url` **[string][7]** url path or global url.
|
|
349
356
|
|
|
350
357
|
Returns **void** automatically synchronized promise with recorder #!
|
|
351
358
|
|
|
@@ -360,8 +367,8 @@ I.appendField('#myTextField', 'appended');
|
|
|
360
367
|
|
|
361
368
|
#### Parameters
|
|
362
369
|
|
|
363
|
-
- `field` **([string][
|
|
364
|
-
- `value` **[string][
|
|
370
|
+
- `field` **([string][7] | [object][5])** located by label|name|CSS|XPath|strict locator
|
|
371
|
+
- `value` **[string][7]** text value to append.
|
|
365
372
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
366
373
|
|
|
367
374
|
### attachFile
|
|
@@ -377,8 +384,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
377
384
|
|
|
378
385
|
#### Parameters
|
|
379
386
|
|
|
380
|
-
- `locator` **([string][
|
|
381
|
-
- `pathToFile` **[string][
|
|
387
|
+
- `locator` **([string][7] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
388
|
+
- `pathToFile` **[string][7]** local file path relative to codecept.json config file.
|
|
382
389
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
383
390
|
|
|
384
391
|
### cancelPopup
|
|
@@ -400,9 +407,9 @@ I.checkOption('agree', '//form');
|
|
|
400
407
|
|
|
401
408
|
#### Parameters
|
|
402
409
|
|
|
403
|
-
- `field` **([string][
|
|
404
|
-
- `context` **([string][
|
|
405
|
-
[!] returns a _promise_ which is synchronized internally by recorder[Additional options][
|
|
410
|
+
- `field` **([string][7] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
411
|
+
- `context` **([string][7]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
412
|
+
[!] returns a _promise_ which is synchronized internally by recorder[Additional options][8] for check available as 3rd argument.Examples:```js
|
|
406
413
|
// click on element at position
|
|
407
414
|
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
408
415
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -420,7 +427,7 @@ I.clearCookie('test');
|
|
|
420
427
|
|
|
421
428
|
#### Parameters
|
|
422
429
|
|
|
423
|
-
- `cookie` **[string][
|
|
430
|
+
- `cookie` **[string][7]?** (optional, `null` by default) cookie name
|
|
424
431
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
425
432
|
|
|
426
433
|
### clearField
|
|
@@ -436,7 +443,7 @@ I.clearField('#email');
|
|
|
436
443
|
#### Parameters
|
|
437
444
|
|
|
438
445
|
- `field`
|
|
439
|
-
- `editable` **([string][
|
|
446
|
+
- `editable` **([string][7] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
440
447
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
441
448
|
|
|
442
449
|
### click
|
|
@@ -465,10 +472,10 @@ I.click({css: 'nav a.login'});
|
|
|
465
472
|
|
|
466
473
|
#### Parameters
|
|
467
474
|
|
|
468
|
-
- `locator` **([string][
|
|
469
|
-
- `context` **([string][
|
|
475
|
+
- `locator` **([string][7] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
476
|
+
- `context` **([string][7]? | [object][5] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
470
477
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
471
|
-
- `opts` **any?** [Additional options][
|
|
478
|
+
- `opts` **any?** [Additional options][9] for click available as 3rd argument.Examples:```js
|
|
472
479
|
// click on element at position
|
|
473
480
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
474
481
|
|
|
@@ -513,8 +520,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
513
520
|
|
|
514
521
|
#### Parameters
|
|
515
522
|
|
|
516
|
-
- `text` **[string][
|
|
517
|
-
- `context` **([string][
|
|
523
|
+
- `text` **[string][7]** which is not present.
|
|
524
|
+
- `context` **([string][7] | [object][5])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
518
525
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
519
526
|
|
|
520
527
|
### dontSeeCheckboxIsChecked
|
|
@@ -529,7 +536,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
529
536
|
|
|
530
537
|
#### Parameters
|
|
531
538
|
|
|
532
|
-
- `field` **([string][
|
|
539
|
+
- `field` **([string][7] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
533
540
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
534
541
|
|
|
535
542
|
### dontSeeCookie
|
|
@@ -542,7 +549,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
542
549
|
|
|
543
550
|
#### Parameters
|
|
544
551
|
|
|
545
|
-
- `name` **[string][
|
|
552
|
+
- `name` **[string][7]** cookie name.
|
|
546
553
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
547
554
|
|
|
548
555
|
### dontSeeCurrentUrlEquals
|
|
@@ -557,7 +564,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
557
564
|
|
|
558
565
|
#### Parameters
|
|
559
566
|
|
|
560
|
-
- `url` **[string][
|
|
567
|
+
- `url` **[string][7]** value to check.
|
|
561
568
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
562
569
|
|
|
563
570
|
### dontSeeElement
|
|
@@ -570,7 +577,7 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
570
577
|
|
|
571
578
|
#### Parameters
|
|
572
579
|
|
|
573
|
-
- `locator` **([string][
|
|
580
|
+
- `locator` **([string][7] | [object][5])** located by CSS|XPath|Strict locator.
|
|
574
581
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
575
582
|
|
|
576
583
|
### dontSeeElementInDOM
|
|
@@ -583,7 +590,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
583
590
|
|
|
584
591
|
#### Parameters
|
|
585
592
|
|
|
586
|
-
- `locator` **([string][
|
|
593
|
+
- `locator` **([string][7] | [object][5])** located by CSS|XPath|Strict locator.
|
|
587
594
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
588
595
|
|
|
589
596
|
### dontSeeInCurrentUrl
|
|
@@ -592,7 +599,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
592
599
|
|
|
593
600
|
#### Parameters
|
|
594
601
|
|
|
595
|
-
- `url` **[string][
|
|
602
|
+
- `url` **[string][7]** value to check.
|
|
596
603
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
597
604
|
|
|
598
605
|
### dontSeeInField
|
|
@@ -607,8 +614,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
607
614
|
|
|
608
615
|
#### Parameters
|
|
609
616
|
|
|
610
|
-
- `field` **([string][
|
|
611
|
-
- `value` **[string][
|
|
617
|
+
- `field` **([string][7] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
618
|
+
- `value` **[string][7]** value to check.
|
|
612
619
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
613
620
|
|
|
614
621
|
### dontSeeInSource
|
|
@@ -622,7 +629,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
622
629
|
#### Parameters
|
|
623
630
|
|
|
624
631
|
- `text`
|
|
625
|
-
- `value` **[string][
|
|
632
|
+
- `value` **[string][7]** to check.
|
|
626
633
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
627
634
|
|
|
628
635
|
### dontSeeInTitle
|
|
@@ -635,7 +642,7 @@ I.dontSeeInTitle('Error');
|
|
|
635
642
|
|
|
636
643
|
#### Parameters
|
|
637
644
|
|
|
638
|
-
- `text` **[string][
|
|
645
|
+
- `text` **[string][7]** value to check.
|
|
639
646
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
640
647
|
|
|
641
648
|
### doubleClick
|
|
@@ -652,8 +659,8 @@ I.doubleClick('.btn.edit');
|
|
|
652
659
|
|
|
653
660
|
#### Parameters
|
|
654
661
|
|
|
655
|
-
- `locator` **([string][
|
|
656
|
-
- `context` **([string][
|
|
662
|
+
- `locator` **([string][7] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
663
|
+
- `context` **([string][7]? | [object][5])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
657
664
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
658
665
|
|
|
659
666
|
### dragAndDrop
|
|
@@ -666,10 +673,10 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
666
673
|
|
|
667
674
|
#### Parameters
|
|
668
675
|
|
|
669
|
-
- `srcElement` **([string][
|
|
670
|
-
- `destElement` **([string][
|
|
676
|
+
- `srcElement` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
677
|
+
- `destElement` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
671
678
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
672
|
-
- `options` **any?** [Additional options][
|
|
679
|
+
- `options` **any?** [Additional options][10] can be passed as 3rd argument.```js
|
|
673
680
|
// specify coordinates for source position
|
|
674
681
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
675
682
|
```> By default option `force: true` is set
|
|
@@ -686,8 +693,8 @@ I.dragSlider('#slider', -70);
|
|
|
686
693
|
|
|
687
694
|
#### Parameters
|
|
688
695
|
|
|
689
|
-
- `locator` **([string][
|
|
690
|
-
- `offsetX` **[number][
|
|
696
|
+
- `locator` **([string][7] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
697
|
+
- `offsetX` **[number][11]** position to drag.
|
|
691
698
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
692
699
|
|
|
693
700
|
### executeScript
|
|
@@ -715,7 +722,7 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
715
722
|
|
|
716
723
|
#### Parameters
|
|
717
724
|
|
|
718
|
-
- `fn` **([string][
|
|
725
|
+
- `fn` **([string][7] | [function][12])** function to be executed in browser context.
|
|
719
726
|
- `arg` **any?** optional argument to pass to the function
|
|
720
727
|
|
|
721
728
|
### fillField
|
|
@@ -736,8 +743,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
736
743
|
|
|
737
744
|
#### Parameters
|
|
738
745
|
|
|
739
|
-
- `field` **([string][
|
|
740
|
-
- `value` **([string][
|
|
746
|
+
- `field` **([string][7] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
747
|
+
- `value` **([string][7] | [object][5])** text value to fill.
|
|
741
748
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
742
749
|
|
|
743
750
|
### forceClick
|
|
@@ -769,8 +776,8 @@ I.forceClick({css: 'nav a.login'});
|
|
|
769
776
|
|
|
770
777
|
#### Parameters
|
|
771
778
|
|
|
772
|
-
- `locator` **([string][
|
|
773
|
-
- `context` **([string][
|
|
779
|
+
- `locator` **([string][7] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
780
|
+
- `context` **([string][7]? | [object][5])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
774
781
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
775
782
|
|
|
776
783
|
### grabAttributeFrom
|
|
@@ -785,10 +792,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
785
792
|
|
|
786
793
|
#### Parameters
|
|
787
794
|
|
|
788
|
-
- `locator` **([string][
|
|
789
|
-
- `attr` **[string][
|
|
795
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
796
|
+
- `attr` **[string][7]** attribute name.
|
|
790
797
|
|
|
791
|
-
Returns **[Promise][
|
|
798
|
+
Returns **[Promise][13]<[string][7]>** attribute value
|
|
792
799
|
|
|
793
800
|
### grabAttributeFromAll
|
|
794
801
|
|
|
@@ -801,21 +808,24 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
801
808
|
|
|
802
809
|
#### Parameters
|
|
803
810
|
|
|
804
|
-
- `locator` **([string][
|
|
805
|
-
- `attr` **[string][
|
|
811
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
812
|
+
- `attr` **[string][7]** attribute name.
|
|
806
813
|
|
|
807
|
-
Returns **[Promise][
|
|
814
|
+
Returns **[Promise][13]<[Array][14]<[string][7]>>** attribute value
|
|
808
815
|
|
|
809
816
|
### grabBrowserLogs
|
|
810
817
|
|
|
811
818
|
Get JS log from browser.
|
|
812
819
|
|
|
813
820
|
```js
|
|
814
|
-
|
|
815
|
-
|
|
821
|
+
const logs = await I.grabBrowserLogs();
|
|
822
|
+
const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l.type === 'error');
|
|
823
|
+
console.log(JSON.stringify(errors));
|
|
816
824
|
```
|
|
817
825
|
|
|
818
|
-
|
|
826
|
+
[Learn more about console messages][15]
|
|
827
|
+
|
|
828
|
+
Returns **[Promise][13]<[Array][14]<any>>**
|
|
819
829
|
|
|
820
830
|
### grabCookie
|
|
821
831
|
|
|
@@ -830,9 +840,9 @@ assert(cookie.value, '123456');
|
|
|
830
840
|
|
|
831
841
|
#### Parameters
|
|
832
842
|
|
|
833
|
-
- `name` **[string][
|
|
843
|
+
- `name` **[string][7]?** cookie name.
|
|
834
844
|
|
|
835
|
-
Returns **([Promise][
|
|
845
|
+
Returns **([Promise][13]<[string][7]> | [Promise][13]<[Array][14]<[string][7]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
836
846
|
|
|
837
847
|
### grabCssPropertyFrom
|
|
838
848
|
|
|
@@ -846,10 +856,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
846
856
|
|
|
847
857
|
#### Parameters
|
|
848
858
|
|
|
849
|
-
- `locator` **([string][
|
|
850
|
-
- `cssProperty` **[string][
|
|
859
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
860
|
+
- `cssProperty` **[string][7]** CSS property name.
|
|
851
861
|
|
|
852
|
-
Returns **[Promise][
|
|
862
|
+
Returns **[Promise][13]<[string][7]>** CSS value
|
|
853
863
|
|
|
854
864
|
### grabCssPropertyFromAll
|
|
855
865
|
|
|
@@ -862,10 +872,10 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
862
872
|
|
|
863
873
|
#### Parameters
|
|
864
874
|
|
|
865
|
-
- `locator` **([string][
|
|
866
|
-
- `cssProperty` **[string][
|
|
875
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
876
|
+
- `cssProperty` **[string][7]** CSS property name.
|
|
867
877
|
|
|
868
|
-
Returns **[Promise][
|
|
878
|
+
Returns **[Promise][13]<[Array][14]<[string][7]>>** CSS value
|
|
869
879
|
|
|
870
880
|
### grabCurrentUrl
|
|
871
881
|
|
|
@@ -877,7 +887,7 @@ let url = await I.grabCurrentUrl();
|
|
|
877
887
|
console.log(`Current URL is [${url}]`);
|
|
878
888
|
```
|
|
879
889
|
|
|
880
|
-
Returns **[Promise][
|
|
890
|
+
Returns **[Promise][13]<[string][7]>** current URL
|
|
881
891
|
|
|
882
892
|
### grabDataFromPerformanceTiming
|
|
883
893
|
|
|
@@ -902,7 +912,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
902
912
|
}
|
|
903
913
|
```
|
|
904
914
|
|
|
905
|
-
Returns **[Promise][
|
|
915
|
+
Returns **[Promise][13]<any>** automatically synchronized promise through #recorder
|
|
906
916
|
|
|
907
917
|
### grabElementBoundingRect
|
|
908
918
|
|
|
@@ -926,11 +936,11 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
926
936
|
|
|
927
937
|
#### Parameters
|
|
928
938
|
|
|
929
|
-
- `locator` **([string][
|
|
939
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
930
940
|
- `prop`
|
|
931
|
-
- `elementSize` **[string][
|
|
941
|
+
- `elementSize` **[string][7]?** x, y, width or height of the given element.
|
|
932
942
|
|
|
933
|
-
Returns **([Promise][
|
|
943
|
+
Returns **([Promise][13]<DOMRect> | [Promise][13]<[number][11]>)** Element bounding rectangle
|
|
934
944
|
|
|
935
945
|
### grabHTMLFrom
|
|
936
946
|
|
|
@@ -945,9 +955,9 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
945
955
|
#### Parameters
|
|
946
956
|
|
|
947
957
|
- `locator`
|
|
948
|
-
- `element` **([string][
|
|
958
|
+
- `element` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
949
959
|
|
|
950
|
-
Returns **[Promise][
|
|
960
|
+
Returns **[Promise][13]<[string][7]>** HTML code for an element
|
|
951
961
|
|
|
952
962
|
### grabHTMLFromAll
|
|
953
963
|
|
|
@@ -961,9 +971,9 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
961
971
|
#### Parameters
|
|
962
972
|
|
|
963
973
|
- `locator`
|
|
964
|
-
- `element` **([string][
|
|
974
|
+
- `element` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
965
975
|
|
|
966
|
-
Returns **[Promise][
|
|
976
|
+
Returns **[Promise][13]<[Array][14]<[string][7]>>** HTML code for an element
|
|
967
977
|
|
|
968
978
|
### grabNumberOfOpenTabs
|
|
969
979
|
|
|
@@ -974,7 +984,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
974
984
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
975
985
|
```
|
|
976
986
|
|
|
977
|
-
Returns **[Promise][
|
|
987
|
+
Returns **[Promise][13]<[number][11]>** number of open tabs
|
|
978
988
|
|
|
979
989
|
### grabNumberOfVisibleElements
|
|
980
990
|
|
|
@@ -987,9 +997,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
987
997
|
|
|
988
998
|
#### Parameters
|
|
989
999
|
|
|
990
|
-
- `locator` **([string][
|
|
1000
|
+
- `locator` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
991
1001
|
|
|
992
|
-
Returns **[Promise][
|
|
1002
|
+
Returns **[Promise][13]<[number][11]>** number of visible elements
|
|
993
1003
|
|
|
994
1004
|
### grabPageScrollPosition
|
|
995
1005
|
|
|
@@ -1000,7 +1010,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1000
1010
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1001
1011
|
```
|
|
1002
1012
|
|
|
1003
|
-
Returns **[Promise][
|
|
1013
|
+
Returns **[Promise][13]<PageScrollPosition>** scroll position
|
|
1004
1014
|
|
|
1005
1015
|
### grabPopupText
|
|
1006
1016
|
|
|
@@ -1010,7 +1020,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1010
1020
|
await I.grabPopupText();
|
|
1011
1021
|
```
|
|
1012
1022
|
|
|
1013
|
-
Returns **[Promise][
|
|
1023
|
+
Returns **[Promise][13]<([string][7] | null)>**
|
|
1014
1024
|
|
|
1015
1025
|
### grabSource
|
|
1016
1026
|
|
|
@@ -1021,7 +1031,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1021
1031
|
let pageSource = await I.grabSource();
|
|
1022
1032
|
```
|
|
1023
1033
|
|
|
1024
|
-
Returns **[Promise][
|
|
1034
|
+
Returns **[Promise][13]<[string][7]>** source code
|
|
1025
1035
|
|
|
1026
1036
|
### grabTextFrom
|
|
1027
1037
|
|
|
@@ -1036,9 +1046,9 @@ If multiple elements found returns first element.
|
|
|
1036
1046
|
|
|
1037
1047
|
#### Parameters
|
|
1038
1048
|
|
|
1039
|
-
- `locator` **([string][
|
|
1049
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1040
1050
|
|
|
1041
|
-
Returns **[Promise][
|
|
1051
|
+
Returns **[Promise][13]<[string][7]>** attribute value
|
|
1042
1052
|
|
|
1043
1053
|
### grabTextFromAll
|
|
1044
1054
|
|
|
@@ -1051,9 +1061,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1051
1061
|
|
|
1052
1062
|
#### Parameters
|
|
1053
1063
|
|
|
1054
|
-
- `locator` **([string][
|
|
1064
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1055
1065
|
|
|
1056
|
-
Returns **[Promise][
|
|
1066
|
+
Returns **[Promise][13]<[Array][14]<[string][7]>>** attribute value
|
|
1057
1067
|
|
|
1058
1068
|
### grabTitle
|
|
1059
1069
|
|
|
@@ -1064,7 +1074,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1064
1074
|
let title = await I.grabTitle();
|
|
1065
1075
|
```
|
|
1066
1076
|
|
|
1067
|
-
Returns **[Promise][
|
|
1077
|
+
Returns **[Promise][13]<[string][7]>** title
|
|
1068
1078
|
|
|
1069
1079
|
### grabValueFrom
|
|
1070
1080
|
|
|
@@ -1078,9 +1088,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1078
1088
|
|
|
1079
1089
|
#### Parameters
|
|
1080
1090
|
|
|
1081
|
-
- `locator` **([string][
|
|
1091
|
+
- `locator` **([string][7] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1082
1092
|
|
|
1083
|
-
Returns **[Promise][
|
|
1093
|
+
Returns **[Promise][13]<[string][7]>** attribute value
|
|
1084
1094
|
|
|
1085
1095
|
### grabValueFromAll
|
|
1086
1096
|
|
|
@@ -1093,16 +1103,16 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1093
1103
|
|
|
1094
1104
|
#### Parameters
|
|
1095
1105
|
|
|
1096
|
-
- `locator` **([string][
|
|
1106
|
+
- `locator` **([string][7] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1097
1107
|
|
|
1098
|
-
Returns **[Promise][
|
|
1108
|
+
Returns **[Promise][13]<[Array][14]<[string][7]>>** attribute value
|
|
1099
1109
|
|
|
1100
1110
|
### handleDownloads
|
|
1101
1111
|
|
|
1102
1112
|
Handles a file download.Aa file name is required to save the file on disk.
|
|
1103
1113
|
Files are saved to "output" directory.
|
|
1104
1114
|
|
|
1105
|
-
Should be used with [FileSystem helper][
|
|
1115
|
+
Should be used with [FileSystem helper][16] to check that file were downloaded correctly.
|
|
1106
1116
|
|
|
1107
1117
|
```js
|
|
1108
1118
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1113,9 +1123,9 @@ I.waitForFile('downloads/avatar.jpg', 5);
|
|
|
1113
1123
|
|
|
1114
1124
|
#### Parameters
|
|
1115
1125
|
|
|
1116
|
-
- `fileName` **[string][
|
|
1126
|
+
- `fileName` **[string][7]?** set filename for downloaded file
|
|
1117
1127
|
|
|
1118
|
-
Returns **[Promise][
|
|
1128
|
+
Returns **[Promise][13]<void>**
|
|
1119
1129
|
|
|
1120
1130
|
### haveRequestHeaders
|
|
1121
1131
|
|
|
@@ -1129,11 +1139,11 @@ I.haveRequestHeaders({
|
|
|
1129
1139
|
|
|
1130
1140
|
#### Parameters
|
|
1131
1141
|
|
|
1132
|
-
- `customHeaders` **[object][
|
|
1142
|
+
- `customHeaders` **[object][5]** headers to set
|
|
1133
1143
|
|
|
1134
1144
|
### makeApiRequest
|
|
1135
1145
|
|
|
1136
|
-
Performs [api request][
|
|
1146
|
+
Performs [api request][17] using
|
|
1137
1147
|
the cookies from the current browser session.
|
|
1138
1148
|
|
|
1139
1149
|
```js
|
|
@@ -1146,26 +1156,26 @@ I.makeApiRequest('PATCH', )
|
|
|
1146
1156
|
|
|
1147
1157
|
#### Parameters
|
|
1148
1158
|
|
|
1149
|
-
- `method` **[string][
|
|
1150
|
-
- `url` **[string][
|
|
1151
|
-
- `options` **[object][
|
|
1159
|
+
- `method` **[string][7]** HTTP method
|
|
1160
|
+
- `url` **[string][7]** endpoint
|
|
1161
|
+
- `options` **[object][5]** request options depending on method used
|
|
1152
1162
|
|
|
1153
|
-
Returns **[Promise][
|
|
1163
|
+
Returns **[Promise][13]<[object][5]>** response
|
|
1154
1164
|
|
|
1155
1165
|
### mockRoute
|
|
1156
1166
|
|
|
1157
|
-
Mocks network request using [`browserContext.route`][
|
|
1167
|
+
Mocks network request using [`browserContext.route`][18] of Playwright
|
|
1158
1168
|
|
|
1159
1169
|
```js
|
|
1160
1170
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1161
1171
|
```
|
|
1162
1172
|
|
|
1163
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1173
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][19]
|
|
1164
1174
|
|
|
1165
1175
|
#### Parameters
|
|
1166
1176
|
|
|
1167
|
-
- `url` **([string][
|
|
1168
|
-
- `handler` **[function][
|
|
1177
|
+
- `url` **([string][7] | [RegExp][20])?** URL, regex or pattern for to match URL
|
|
1178
|
+
- `handler` **[function][12]?** a function to process reques
|
|
1169
1179
|
|
|
1170
1180
|
### moveCursorTo
|
|
1171
1181
|
|
|
@@ -1179,9 +1189,9 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1179
1189
|
|
|
1180
1190
|
#### Parameters
|
|
1181
1191
|
|
|
1182
|
-
- `locator` **([string][
|
|
1183
|
-
- `offsetX` **[number][
|
|
1184
|
-
- `offsetY` **[number][
|
|
1192
|
+
- `locator` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
1193
|
+
- `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
|
|
1194
|
+
- `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
|
|
1185
1195
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1186
1196
|
|
|
1187
1197
|
### openNewTab
|
|
@@ -1192,7 +1202,7 @@ Open new tab and automatically switched to new tab
|
|
|
1192
1202
|
I.openNewTab();
|
|
1193
1203
|
```
|
|
1194
1204
|
|
|
1195
|
-
You can pass in [page options][
|
|
1205
|
+
You can pass in [page options][21] to emulate device on this page
|
|
1196
1206
|
|
|
1197
1207
|
```js
|
|
1198
1208
|
// enable mobile
|
|
@@ -1207,7 +1217,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1207
1217
|
|
|
1208
1218
|
Presses a key in the browser (on a focused element).
|
|
1209
1219
|
|
|
1210
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1220
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][22].
|
|
1211
1221
|
|
|
1212
1222
|
```js
|
|
1213
1223
|
I.pressKey('Backspace');
|
|
@@ -1266,14 +1276,14 @@ Some of the supported key names are:
|
|
|
1266
1276
|
|
|
1267
1277
|
#### Parameters
|
|
1268
1278
|
|
|
1269
|
-
- `key` **([string][
|
|
1270
|
-
[!] returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][
|
|
1279
|
+
- `key` **([string][7] | [Array][14]<[string][7]>)** key or array of keys to press.
|
|
1280
|
+
[!] returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][23]).
|
|
1271
1281
|
|
|
1272
1282
|
### pressKeyDown
|
|
1273
1283
|
|
|
1274
1284
|
Presses a key in the browser and leaves it in a down state.
|
|
1275
1285
|
|
|
1276
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1286
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][24]).
|
|
1277
1287
|
|
|
1278
1288
|
```js
|
|
1279
1289
|
I.pressKeyDown('Control');
|
|
@@ -1283,14 +1293,14 @@ I.pressKeyUp('Control');
|
|
|
1283
1293
|
|
|
1284
1294
|
#### Parameters
|
|
1285
1295
|
|
|
1286
|
-
- `key` **[string][
|
|
1296
|
+
- `key` **[string][7]** name of key to press down.
|
|
1287
1297
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1288
1298
|
|
|
1289
1299
|
### pressKeyUp
|
|
1290
1300
|
|
|
1291
1301
|
Releases a key in the browser which was previously set to a down state.
|
|
1292
1302
|
|
|
1293
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1303
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][24]).
|
|
1294
1304
|
|
|
1295
1305
|
```js
|
|
1296
1306
|
I.pressKeyDown('Control');
|
|
@@ -1300,7 +1310,7 @@ I.pressKeyUp('Control');
|
|
|
1300
1310
|
|
|
1301
1311
|
#### Parameters
|
|
1302
1312
|
|
|
1303
|
-
- `key` **[string][
|
|
1313
|
+
- `key` **[string][7]** name of key to release.
|
|
1304
1314
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1305
1315
|
|
|
1306
1316
|
### refreshPage
|
|
@@ -1320,8 +1330,8 @@ First parameter can be set to `maximize`.
|
|
|
1320
1330
|
|
|
1321
1331
|
#### Parameters
|
|
1322
1332
|
|
|
1323
|
-
- `width` **[number][
|
|
1324
|
-
- `height` **[number][
|
|
1333
|
+
- `width` **[number][11]** width in pixels or `maximize`.
|
|
1334
|
+
- `height` **[number][11]** height in pixels.
|
|
1325
1335
|
[!] returns a _promise_ which is synchronized internally by recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1326
1336
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1327
1337
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
@@ -1345,8 +1355,8 @@ I.rightClick('Click me', '.context');
|
|
|
1345
1355
|
|
|
1346
1356
|
#### Parameters
|
|
1347
1357
|
|
|
1348
|
-
- `locator` **([string][
|
|
1349
|
-
- `context` **([string][
|
|
1358
|
+
- `locator` **([string][7] | [object][5])** clickable element located by CSS|XPath|strict locator.
|
|
1359
|
+
- `context` **([string][7]? | [object][5])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1350
1360
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1351
1361
|
|
|
1352
1362
|
### saveElementScreenshot
|
|
@@ -1360,8 +1370,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1360
1370
|
|
|
1361
1371
|
#### Parameters
|
|
1362
1372
|
|
|
1363
|
-
- `locator` **([string][
|
|
1364
|
-
- `fileName` **[string][
|
|
1373
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1374
|
+
- `fileName` **[string][7]** file name to save.
|
|
1365
1375
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1366
1376
|
|
|
1367
1377
|
### saveScreenshot
|
|
@@ -1377,8 +1387,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1377
1387
|
|
|
1378
1388
|
#### Parameters
|
|
1379
1389
|
|
|
1380
|
-
- `fileName` **[string][
|
|
1381
|
-
- `fullPage` **[boolean][
|
|
1390
|
+
- `fileName` **[string][7]** file name to save.
|
|
1391
|
+
- `fullPage` **[boolean][25]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1382
1392
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1383
1393
|
|
|
1384
1394
|
### scrollPageToBottom
|
|
@@ -1413,9 +1423,9 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1413
1423
|
|
|
1414
1424
|
#### Parameters
|
|
1415
1425
|
|
|
1416
|
-
- `locator` **([string][
|
|
1417
|
-
- `offsetX` **[number][
|
|
1418
|
-
- `offsetY` **[number][
|
|
1426
|
+
- `locator` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
1427
|
+
- `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
|
|
1428
|
+
- `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
|
|
1419
1429
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1420
1430
|
|
|
1421
1431
|
### see
|
|
@@ -1431,8 +1441,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1431
1441
|
|
|
1432
1442
|
#### Parameters
|
|
1433
1443
|
|
|
1434
|
-
- `text` **[string][
|
|
1435
|
-
- `context` **([string][
|
|
1444
|
+
- `text` **[string][7]** expected on page.
|
|
1445
|
+
- `context` **([string][7]? | [object][5])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1436
1446
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1437
1447
|
|
|
1438
1448
|
### seeAttributesOnElements
|
|
@@ -1445,8 +1455,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1445
1455
|
|
|
1446
1456
|
#### Parameters
|
|
1447
1457
|
|
|
1448
|
-
- `locator` **([string][
|
|
1449
|
-
- `attributes` **[object][
|
|
1458
|
+
- `locator` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
1459
|
+
- `attributes` **[object][5]** attributes and their values to check.
|
|
1450
1460
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1451
1461
|
|
|
1452
1462
|
### seeCheckboxIsChecked
|
|
@@ -1461,7 +1471,7 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1461
1471
|
|
|
1462
1472
|
#### Parameters
|
|
1463
1473
|
|
|
1464
|
-
- `field` **([string][
|
|
1474
|
+
- `field` **([string][7] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
1465
1475
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1466
1476
|
|
|
1467
1477
|
### seeCookie
|
|
@@ -1474,7 +1484,7 @@ I.seeCookie('Auth');
|
|
|
1474
1484
|
|
|
1475
1485
|
#### Parameters
|
|
1476
1486
|
|
|
1477
|
-
- `name` **[string][
|
|
1487
|
+
- `name` **[string][7]** cookie name.
|
|
1478
1488
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1479
1489
|
|
|
1480
1490
|
### seeCssPropertiesOnElements
|
|
@@ -1487,8 +1497,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1487
1497
|
|
|
1488
1498
|
#### Parameters
|
|
1489
1499
|
|
|
1490
|
-
- `locator` **([string][
|
|
1491
|
-
- `cssProperties` **[object][
|
|
1500
|
+
- `locator` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
1501
|
+
- `cssProperties` **[object][5]** object with CSS properties and their values to check.
|
|
1492
1502
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1493
1503
|
|
|
1494
1504
|
### seeCurrentUrlEquals
|
|
@@ -1504,7 +1514,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1504
1514
|
|
|
1505
1515
|
#### Parameters
|
|
1506
1516
|
|
|
1507
|
-
- `url` **[string][
|
|
1517
|
+
- `url` **[string][7]** value to check.
|
|
1508
1518
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1509
1519
|
|
|
1510
1520
|
### seeElement
|
|
@@ -1518,7 +1528,7 @@ I.seeElement('#modal');
|
|
|
1518
1528
|
|
|
1519
1529
|
#### Parameters
|
|
1520
1530
|
|
|
1521
|
-
- `locator` **([string][
|
|
1531
|
+
- `locator` **([string][7] | [object][5])** located by CSS|XPath|strict locator.
|
|
1522
1532
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1523
1533
|
|
|
1524
1534
|
### seeElementInDOM
|
|
@@ -1532,7 +1542,7 @@ I.seeElementInDOM('#modal');
|
|
|
1532
1542
|
|
|
1533
1543
|
#### Parameters
|
|
1534
1544
|
|
|
1535
|
-
- `locator` **([string][
|
|
1545
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1536
1546
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1537
1547
|
|
|
1538
1548
|
### seeInCurrentUrl
|
|
@@ -1545,7 +1555,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1545
1555
|
|
|
1546
1556
|
#### Parameters
|
|
1547
1557
|
|
|
1548
|
-
- `url` **[string][
|
|
1558
|
+
- `url` **[string][7]** a fragment to check
|
|
1549
1559
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1550
1560
|
|
|
1551
1561
|
### seeInField
|
|
@@ -1562,8 +1572,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1562
1572
|
|
|
1563
1573
|
#### Parameters
|
|
1564
1574
|
|
|
1565
|
-
- `field` **([string][
|
|
1566
|
-
- `value` **[string][
|
|
1575
|
+
- `field` **([string][7] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
1576
|
+
- `value` **[string][7]** value to check.
|
|
1567
1577
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1568
1578
|
|
|
1569
1579
|
### seeInPopup
|
|
@@ -1577,7 +1587,7 @@ I.seeInPopup('Popup text');
|
|
|
1577
1587
|
|
|
1578
1588
|
#### Parameters
|
|
1579
1589
|
|
|
1580
|
-
- `text` **[string][
|
|
1590
|
+
- `text` **[string][7]** value to check.
|
|
1581
1591
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1582
1592
|
|
|
1583
1593
|
### seeInSource
|
|
@@ -1590,7 +1600,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1590
1600
|
|
|
1591
1601
|
#### Parameters
|
|
1592
1602
|
|
|
1593
|
-
- `text` **[string][
|
|
1603
|
+
- `text` **[string][7]** value to check.
|
|
1594
1604
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1595
1605
|
|
|
1596
1606
|
### seeInTitle
|
|
@@ -1603,7 +1613,7 @@ I.seeInTitle('Home Page');
|
|
|
1603
1613
|
|
|
1604
1614
|
#### Parameters
|
|
1605
1615
|
|
|
1606
|
-
- `text` **[string][
|
|
1616
|
+
- `text` **[string][7]** text value to check.
|
|
1607
1617
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1608
1618
|
|
|
1609
1619
|
### seeNumberOfElements
|
|
@@ -1617,8 +1627,8 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1617
1627
|
|
|
1618
1628
|
#### Parameters
|
|
1619
1629
|
|
|
1620
|
-
- `locator` **([string][
|
|
1621
|
-
- `num` **[number][
|
|
1630
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1631
|
+
- `num` **[number][11]** number of elements.
|
|
1622
1632
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1623
1633
|
|
|
1624
1634
|
### seeNumberOfVisibleElements
|
|
@@ -1632,8 +1642,8 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1632
1642
|
|
|
1633
1643
|
#### Parameters
|
|
1634
1644
|
|
|
1635
|
-
- `locator` **([string][
|
|
1636
|
-
- `num` **[number][
|
|
1645
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1646
|
+
- `num` **[number][11]** number of elements.
|
|
1637
1647
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1638
1648
|
|
|
1639
1649
|
### seeTextEquals
|
|
@@ -1646,8 +1656,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1646
1656
|
|
|
1647
1657
|
#### Parameters
|
|
1648
1658
|
|
|
1649
|
-
- `text` **[string][
|
|
1650
|
-
- `context` **([string][
|
|
1659
|
+
- `text` **[string][7]** element value to check.
|
|
1660
|
+
- `context` **([string][7] | [object][5])?** element located by CSS|XPath|strict locator.
|
|
1651
1661
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1652
1662
|
|
|
1653
1663
|
### seeTitleEquals
|
|
@@ -1660,7 +1670,7 @@ I.seeTitleEquals('Test title.');
|
|
|
1660
1670
|
|
|
1661
1671
|
#### Parameters
|
|
1662
1672
|
|
|
1663
|
-
- `text` **[string][
|
|
1673
|
+
- `text` **[string][7]** value to check.
|
|
1664
1674
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1665
1675
|
|
|
1666
1676
|
### selectOption
|
|
@@ -1686,8 +1696,8 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1686
1696
|
|
|
1687
1697
|
#### Parameters
|
|
1688
1698
|
|
|
1689
|
-
- `select` **([string][
|
|
1690
|
-
- `option` **([string][
|
|
1699
|
+
- `select` **([string][7] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1700
|
+
- `option` **([string][7] | [Array][14]<any>)** visible text or value of option.
|
|
1691
1701
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1692
1702
|
|
|
1693
1703
|
### setCookie
|
|
@@ -1708,7 +1718,7 @@ I.setCookie([
|
|
|
1708
1718
|
|
|
1709
1719
|
#### Parameters
|
|
1710
1720
|
|
|
1711
|
-
- `cookie` **(Cookie | [Array][
|
|
1721
|
+
- `cookie` **(Cookie | [Array][14]<Cookie>)** a cookie object or array of cookie objects.
|
|
1712
1722
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1713
1723
|
|
|
1714
1724
|
### stopMockingRoute
|
|
@@ -1724,8 +1734,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1724
1734
|
|
|
1725
1735
|
#### Parameters
|
|
1726
1736
|
|
|
1727
|
-
- `url` **([string][
|
|
1728
|
-
- `handler` **[function][
|
|
1737
|
+
- `url` **([string][7] | [RegExp][20])?** URL, regex or pattern for to match URL
|
|
1738
|
+
- `handler` **[function][12]?** a function to process reques
|
|
1729
1739
|
|
|
1730
1740
|
### switchTo
|
|
1731
1741
|
|
|
@@ -1738,7 +1748,7 @@ I.switchTo(); // switch back to main page
|
|
|
1738
1748
|
|
|
1739
1749
|
#### Parameters
|
|
1740
1750
|
|
|
1741
|
-
- `locator` **([string][
|
|
1751
|
+
- `locator` **([string][7]? | [object][5])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1742
1752
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1743
1753
|
|
|
1744
1754
|
### switchToNextTab
|
|
@@ -1752,7 +1762,7 @@ I.switchToNextTab(2);
|
|
|
1752
1762
|
|
|
1753
1763
|
#### Parameters
|
|
1754
1764
|
|
|
1755
|
-
- `num` **[number][
|
|
1765
|
+
- `num` **[number][11]**
|
|
1756
1766
|
|
|
1757
1767
|
### switchToPreviousTab
|
|
1758
1768
|
|
|
@@ -1765,13 +1775,13 @@ I.switchToPreviousTab(2);
|
|
|
1765
1775
|
|
|
1766
1776
|
#### Parameters
|
|
1767
1777
|
|
|
1768
|
-
- `num` **[number][
|
|
1778
|
+
- `num` **[number][11]**
|
|
1769
1779
|
|
|
1770
1780
|
### type
|
|
1771
1781
|
|
|
1772
1782
|
Types out the given text into an active field.
|
|
1773
1783
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1774
|
-
_Note:_ Should be used when [`fillField`][
|
|
1784
|
+
_Note:_ Should be used when [`fillField`][22] is not an option.
|
|
1775
1785
|
|
|
1776
1786
|
```js
|
|
1777
1787
|
// passing in a string
|
|
@@ -1787,9 +1797,9 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1787
1797
|
#### Parameters
|
|
1788
1798
|
|
|
1789
1799
|
- `keys`
|
|
1790
|
-
- `delay` **[number][
|
|
1800
|
+
- `delay` **[number][11]?** (optional) delay in ms between key presses
|
|
1791
1801
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1792
|
-
- `key` **([string][
|
|
1802
|
+
- `key` **([string][7] | [Array][14]<[string][7]>)** or array of keys to type.
|
|
1793
1803
|
|
|
1794
1804
|
### uncheckOption
|
|
1795
1805
|
|
|
@@ -1806,9 +1816,9 @@ I.uncheckOption('agree', '//form');
|
|
|
1806
1816
|
|
|
1807
1817
|
#### Parameters
|
|
1808
1818
|
|
|
1809
|
-
- `field` **([string][
|
|
1810
|
-
- `context` **([string][
|
|
1811
|
-
[!] returns a _promise_ which is synchronized internally by recorder[Additional options][
|
|
1819
|
+
- `field` **([string][7] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1820
|
+
- `context` **([string][7]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1821
|
+
[!] returns a _promise_ which is synchronized internally by recorder[Additional options][26] for uncheck available as 3rd argument.Examples:```js
|
|
1812
1822
|
// click on element at position
|
|
1813
1823
|
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1814
1824
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -1821,7 +1831,7 @@ Use Playwright API inside a test.
|
|
|
1821
1831
|
First argument is a description of an action.
|
|
1822
1832
|
Second argument is async function that gets this helper as parameter.
|
|
1823
1833
|
|
|
1824
|
-
{ [`page`][
|
|
1834
|
+
{ [`page`][27], [`browserContext`][28] [`browser`][29] } objects from Playwright API are available.
|
|
1825
1835
|
|
|
1826
1836
|
```js
|
|
1827
1837
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -1831,8 +1841,8 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
1831
1841
|
|
|
1832
1842
|
#### Parameters
|
|
1833
1843
|
|
|
1834
|
-
- `description` **[string][
|
|
1835
|
-
- `fn` **[function][
|
|
1844
|
+
- `description` **[string][7]** used to show in logs.
|
|
1845
|
+
- `fn` **[function][12]** async function that executed with Playwright helper as argumen
|
|
1836
1846
|
|
|
1837
1847
|
### wait
|
|
1838
1848
|
|
|
@@ -1844,7 +1854,7 @@ I.wait(2); // wait 2 secs
|
|
|
1844
1854
|
|
|
1845
1855
|
#### Parameters
|
|
1846
1856
|
|
|
1847
|
-
- `sec` **[number][
|
|
1857
|
+
- `sec` **[number][11]** number of second to wait.
|
|
1848
1858
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1849
1859
|
|
|
1850
1860
|
### waitForClickable
|
|
@@ -1859,9 +1869,9 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1859
1869
|
|
|
1860
1870
|
#### Parameters
|
|
1861
1871
|
|
|
1862
|
-
- `locator` **([string][
|
|
1872
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1863
1873
|
- `waitTimeout`
|
|
1864
|
-
- `sec` **[number][
|
|
1874
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1865
1875
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1866
1876
|
|
|
1867
1877
|
### waitForDetached
|
|
@@ -1875,8 +1885,8 @@ I.waitForDetached('#popup');
|
|
|
1875
1885
|
|
|
1876
1886
|
#### Parameters
|
|
1877
1887
|
|
|
1878
|
-
- `locator` **([string][
|
|
1879
|
-
- `sec` **[number][
|
|
1888
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1889
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1880
1890
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1881
1891
|
|
|
1882
1892
|
### waitForElement
|
|
@@ -1891,8 +1901,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1891
1901
|
|
|
1892
1902
|
#### Parameters
|
|
1893
1903
|
|
|
1894
|
-
- `locator` **([string][
|
|
1895
|
-
- `sec` **[number][
|
|
1904
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1905
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1896
1906
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1897
1907
|
|
|
1898
1908
|
### waitForEnabled
|
|
@@ -1902,8 +1912,8 @@ Element can be located by CSS or XPath.
|
|
|
1902
1912
|
|
|
1903
1913
|
#### Parameters
|
|
1904
1914
|
|
|
1905
|
-
- `locator` **([string][
|
|
1906
|
-
- `sec` **[number][
|
|
1915
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1916
|
+
- `sec` **[number][11]** (optional) time in seconds to wait, 1 by default.
|
|
1907
1917
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1908
1918
|
|
|
1909
1919
|
### waitForFunction
|
|
@@ -1923,9 +1933,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1923
1933
|
|
|
1924
1934
|
#### Parameters
|
|
1925
1935
|
|
|
1926
|
-
- `fn` **([string][
|
|
1927
|
-
- `argsOrSec` **([Array][
|
|
1928
|
-
- `sec` **[number][
|
|
1936
|
+
- `fn` **([string][7] | [function][12])** to be executed in browser context.
|
|
1937
|
+
- `argsOrSec` **([Array][14]<any> | [number][11])?** (optional, `1` by default) arguments for function or seconds.
|
|
1938
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1929
1939
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1930
1940
|
|
|
1931
1941
|
### waitForInvisible
|
|
@@ -1939,15 +1949,15 @@ I.waitForInvisible('#popup');
|
|
|
1939
1949
|
|
|
1940
1950
|
#### Parameters
|
|
1941
1951
|
|
|
1942
|
-
- `locator` **([string][
|
|
1943
|
-
- `sec` **[number][
|
|
1952
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1953
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1944
1954
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1945
1955
|
|
|
1946
1956
|
### waitForNavigation
|
|
1947
1957
|
|
|
1948
1958
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1949
1959
|
|
|
1950
|
-
See [Playwright's reference][
|
|
1960
|
+
See [Playwright's reference][30]
|
|
1951
1961
|
|
|
1952
1962
|
#### Parameters
|
|
1953
1963
|
|
|
@@ -1964,8 +1974,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1964
1974
|
|
|
1965
1975
|
#### Parameters
|
|
1966
1976
|
|
|
1967
|
-
- `urlOrPredicate` **([string][
|
|
1968
|
-
- `sec` **[number][
|
|
1977
|
+
- `urlOrPredicate` **([string][7] | [function][12])**
|
|
1978
|
+
- `sec` **[number][11]?** seconds to wait
|
|
1969
1979
|
|
|
1970
1980
|
### waitForResponse
|
|
1971
1981
|
|
|
@@ -1978,8 +1988,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
1978
1988
|
|
|
1979
1989
|
#### Parameters
|
|
1980
1990
|
|
|
1981
|
-
- `urlOrPredicate` **([string][
|
|
1982
|
-
- `sec` **[number][
|
|
1991
|
+
- `urlOrPredicate` **([string][7] | [function][12])**
|
|
1992
|
+
- `sec` **[number][11]?** number of seconds to wait
|
|
1983
1993
|
|
|
1984
1994
|
### waitForText
|
|
1985
1995
|
|
|
@@ -1994,9 +2004,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1994
2004
|
|
|
1995
2005
|
#### Parameters
|
|
1996
2006
|
|
|
1997
|
-
- `text` **[string][
|
|
1998
|
-
- `sec` **[number][
|
|
1999
|
-
- `context` **([string][
|
|
2007
|
+
- `text` **[string][7]** to wait for.
|
|
2008
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2009
|
+
- `context` **([string][7] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
2000
2010
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2001
2011
|
|
|
2002
2012
|
### waitForValue
|
|
@@ -2009,9 +2019,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2009
2019
|
|
|
2010
2020
|
#### Parameters
|
|
2011
2021
|
|
|
2012
|
-
- `field` **([string][
|
|
2013
|
-
- `value` **[string][
|
|
2014
|
-
- `sec` **[number][
|
|
2022
|
+
- `field` **([string][7] | [object][5])** input field.
|
|
2023
|
+
- `value` **[string][7]** expected value.
|
|
2024
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2015
2025
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2016
2026
|
|
|
2017
2027
|
### waitForVisible
|
|
@@ -2025,9 +2035,9 @@ I.waitForVisible('#popup');
|
|
|
2025
2035
|
|
|
2026
2036
|
#### Parameters
|
|
2027
2037
|
|
|
2028
|
-
- `locator` **([string][
|
|
2029
|
-
- `sec` **[number][
|
|
2030
|
-
[!] returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][
|
|
2038
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2039
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2040
|
+
[!] returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][31].
|
|
2031
2041
|
|
|
2032
2042
|
### waitInUrl
|
|
2033
2043
|
|
|
@@ -2039,8 +2049,8 @@ I.waitInUrl('/info', 2);
|
|
|
2039
2049
|
|
|
2040
2050
|
#### Parameters
|
|
2041
2051
|
|
|
2042
|
-
- `urlPart` **[string][
|
|
2043
|
-
- `sec` **[number][
|
|
2052
|
+
- `urlPart` **[string][7]** value to check.
|
|
2053
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2044
2054
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2045
2055
|
|
|
2046
2056
|
### waitNumberOfVisibleElements
|
|
@@ -2053,9 +2063,9 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2053
2063
|
|
|
2054
2064
|
#### Parameters
|
|
2055
2065
|
|
|
2056
|
-
- `locator` **([string][
|
|
2057
|
-
- `num` **[number][
|
|
2058
|
-
- `sec` **[number][
|
|
2066
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2067
|
+
- `num` **[number][11]** number of elements.
|
|
2068
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2059
2069
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2060
2070
|
|
|
2061
2071
|
### waitToHide
|
|
@@ -2069,8 +2079,8 @@ I.waitToHide('#popup');
|
|
|
2069
2079
|
|
|
2070
2080
|
#### Parameters
|
|
2071
2081
|
|
|
2072
|
-
- `locator` **([string][
|
|
2073
|
-
- `sec` **[number][
|
|
2082
|
+
- `locator` **([string][7] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2083
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2074
2084
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2075
2085
|
|
|
2076
2086
|
### waitUrlEquals
|
|
@@ -2084,76 +2094,78 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2084
2094
|
|
|
2085
2095
|
#### Parameters
|
|
2086
2096
|
|
|
2087
|
-
- `urlPart` **[string][
|
|
2088
|
-
- `sec` **[number][
|
|
2097
|
+
- `urlPart` **[string][7]** value to check.
|
|
2098
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2089
2099
|
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2090
2100
|
|
|
2091
|
-
|
|
2101
|
+
: https://github.com/microsoft/playwright
|
|
2102
|
+
|
|
2103
|
+
[2]: https://playwright.dev/docs/next/api/class-browser#browser-new-context
|
|
2092
2104
|
|
|
2093
|
-
[
|
|
2105
|
+
[3]: https://playwright.dev/docs/api/class-browsertype#browsertypeconnectparams
|
|
2094
2106
|
|
|
2095
|
-
[
|
|
2107
|
+
[4]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
2096
2108
|
|
|
2097
|
-
[
|
|
2109
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
2098
2110
|
|
|
2099
|
-
[
|
|
2111
|
+
[6]: http://jster.net/category/windows-modals-popups
|
|
2100
2112
|
|
|
2101
|
-
[
|
|
2113
|
+
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2102
2114
|
|
|
2103
|
-
[
|
|
2115
|
+
[8]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2104
2116
|
|
|
2105
|
-
[
|
|
2117
|
+
[9]: https://playwright.dev/docs/api/class-page#page-click
|
|
2106
2118
|
|
|
2107
|
-
[
|
|
2119
|
+
[10]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2108
2120
|
|
|
2109
|
-
[
|
|
2121
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2110
2122
|
|
|
2111
|
-
[
|
|
2123
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2112
2124
|
|
|
2113
|
-
[
|
|
2125
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2114
2126
|
|
|
2115
|
-
[
|
|
2127
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2116
2128
|
|
|
2117
|
-
[
|
|
2129
|
+
[15]: https://playwright.dev/docs/api/class-consolemessage
|
|
2118
2130
|
|
|
2119
|
-
[
|
|
2131
|
+
[16]: https://codecept.io/helpers/FileSystem
|
|
2120
2132
|
|
|
2121
|
-
[
|
|
2133
|
+
[17]: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
|
|
2122
2134
|
|
|
2123
|
-
[
|
|
2135
|
+
[18]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
2124
2136
|
|
|
2125
|
-
[
|
|
2137
|
+
[19]: https://playwright.dev/docs/network#handle-requests
|
|
2126
2138
|
|
|
2127
|
-
[
|
|
2139
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2128
2140
|
|
|
2129
|
-
[
|
|
2141
|
+
[21]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2130
2142
|
|
|
2131
|
-
[
|
|
2143
|
+
[22]: #fillfield
|
|
2132
2144
|
|
|
2133
|
-
[
|
|
2145
|
+
[23]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
2134
2146
|
|
|
2135
|
-
[
|
|
2147
|
+
[24]: #click
|
|
2136
2148
|
|
|
2137
|
-
[
|
|
2149
|
+
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2138
2150
|
|
|
2139
|
-
[
|
|
2151
|
+
[26]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2140
2152
|
|
|
2141
|
-
[
|
|
2153
|
+
[27]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2142
2154
|
|
|
2143
|
-
[
|
|
2155
|
+
[28]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2144
2156
|
|
|
2145
|
-
[
|
|
2157
|
+
[29]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2146
2158
|
|
|
2147
|
-
[
|
|
2159
|
+
[30]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2148
2160
|
|
|
2149
|
-
[
|
|
2161
|
+
[31]: https://codecept.io/react
|
|
2150
2162
|
|
|
2151
|
-
[
|
|
2163
|
+
[32]: https://playwright.dev/docs/api/class-browsercontext
|
|
2152
2164
|
|
|
2153
|
-
[
|
|
2165
|
+
[33]: https://playwright.dev/docs/api/class-page#page-set-default-timeout
|
|
2154
2166
|
|
|
2155
|
-
[
|
|
2167
|
+
[34]: https://playwright.dev/docs/trace-viewer
|
|
2156
2168
|
|
|
2157
|
-
[
|
|
2169
|
+
[35]: https://github.com/microsoft/playwright/blob/main/docs/api.md#pagewaitfornavigationoptions
|
|
2158
2170
|
|
|
2159
|
-
[
|
|
2171
|
+
[36]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|