codeceptjs 3.5.0 → 3.5.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 +20 -0
- package/README.md +3 -3
- package/docs/ai.md +11 -9
- package/docs/build/Playwright.js +59 -27
- package/docs/build/Puppeteer.js +56 -0
- package/docs/build/TestCafe.js +58 -1
- package/docs/build/WebDriver.js +55 -0
- package/docs/changelog.md +20 -0
- package/docs/helpers/Playwright.md +201 -166
- package/docs/helpers/Puppeteer.md +148 -102
- package/docs/helpers/TestCafe.md +95 -49
- package/docs/helpers/WebDriver.md +150 -104
- package/docs/plugins.md +1 -1
- package/docs/webapi/blur.mustache +17 -0
- package/docs/webapi/focus.mustache +12 -0
- package/lib/cli.js +9 -1
- package/lib/command/init.js +10 -0
- package/lib/event.js +2 -0
- package/lib/helper/Playwright.js +47 -44
- package/lib/helper/Puppeteer.js +27 -0
- package/lib/helper/TestCafe.js +29 -1
- package/lib/helper/WebDriver.js +26 -0
- package/lib/helper/scripts/blurElement.js +17 -0
- package/lib/helper/scripts/focusElement.js +17 -0
- package/lib/interfaces/gherkin.js +8 -0
- package/lib/plugin/heal.js +5 -7
- package/lib/recorder.js +7 -4
- package/lib/utils.js +13 -0
- package/package.json +3 -6
- package/typings/promiseBasedTypes.d.ts +130 -13
- package/typings/types.d.ts +134 -17
|
@@ -33,48 +33,48 @@ Using playwright-core package, will prevent the download of browser binaries and
|
|
|
33
33
|
|
|
34
34
|
## Configuration
|
|
35
35
|
|
|
36
|
-
This helper should be configured in codecept.conf.js
|
|
36
|
+
This helper should be configured in codecept.conf.(js|ts)
|
|
37
37
|
|
|
38
38
|
Type: [object][5]
|
|
39
39
|
|
|
40
40
|
### Properties
|
|
41
41
|
|
|
42
|
-
- `url` **[string][8]
|
|
42
|
+
- `url` **[string][8]?** base url of website to be tested
|
|
43
43
|
- `browser` **(`"chromium"` | `"firefox"` | `"webkit"` | `"electron"`)?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
44
|
-
- `show` **[boolean][
|
|
45
|
-
- `restart` **([string][8] | [boolean][
|
|
44
|
+
- `show` **[boolean][31]?** show browser window.
|
|
45
|
+
- `restart` **([string][8] | [boolean][31])?** restart strategy between tests. Possible values:- 'context' or **false** - restarts [browser context][38] but keeps running browser. Recommended by Playwright team to keep tests isolated.
|
|
46
46
|
- 'browser' or **true** - closes browser and opens it again between tests.
|
|
47
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][
|
|
49
|
-
- `disableScreenshots` **[boolean][
|
|
48
|
+
- `timeout` **[number][16]?** - [timeout][39] in ms of all Playwright actions .
|
|
49
|
+
- `disableScreenshots` **[boolean][31]?** don't save screenshot on failure.
|
|
50
50
|
- `emulate` **any?** browser in device emulation mode.
|
|
51
|
-
- `video` **[boolean][
|
|
52
|
-
- `keepVideoForPassedTests` **[boolean][
|
|
53
|
-
- `trace` **[boolean][
|
|
54
|
-
- `keepTraceForPassedTests` **[boolean][
|
|
55
|
-
- `fullPageScreenshots` **[boolean][
|
|
56
|
-
- `uniqueScreenshotNames` **[boolean][
|
|
57
|
-
- `keepBrowserState` **[boolean][
|
|
58
|
-
- `keepCookies` **[boolean][
|
|
59
|
-
- `waitForAction` **[number][
|
|
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][
|
|
61
|
-
- `pressKeyDelay` **[number][
|
|
62
|
-
- `getPageTimeout` **[number][
|
|
63
|
-
- `waitForTimeout` **[number][
|
|
51
|
+
- `video` **[boolean][31]?** enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
52
|
+
- `keepVideoForPassedTests` **[boolean][31]?** save videos for passed tests; videos are saved into `output/videos` folder
|
|
53
|
+
- `trace` **[boolean][31]?** record [tracing information][40] with screenshots and snapshots.
|
|
54
|
+
- `keepTraceForPassedTests` **[boolean][31]?** save trace for passed tests.
|
|
55
|
+
- `fullPageScreenshots` **[boolean][31]?** make full page screenshots on failure.
|
|
56
|
+
- `uniqueScreenshotNames` **[boolean][31]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
57
|
+
- `keepBrowserState` **[boolean][31]?** keep browser state between tests when `restart` is set to 'session'.
|
|
58
|
+
- `keepCookies` **[boolean][31]?** keep cookies between tests when `restart` is set to 'session'.
|
|
59
|
+
- `waitForAction` **[number][16]?** 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][41].
|
|
61
|
+
- `pressKeyDelay` **[number][16]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
62
|
+
- `getPageTimeout` **[number][16]?** config option to set maximum navigation time in milliseconds.
|
|
63
|
+
- `waitForTimeout` **[number][16]?** default wait* timeout in ms. Default: 1000.
|
|
64
64
|
- `basicAuth` **[object][5]?** the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
65
65
|
- `windowSize` **[string][8]?** default window size. Set a dimension like `640x480`.
|
|
66
66
|
- `colorScheme` **(`"dark"` | `"light"` | `"no-preference"`)?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
67
67
|
- `userAgent` **[string][8]?** user-agent string.
|
|
68
68
|
- `locale` **[string][8]?** locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
69
|
-
- `manualStart` **[boolean][
|
|
69
|
+
- `manualStart` **[boolean][31]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
70
70
|
- `chromium` **[object][5]?** pass additional chromium options
|
|
71
71
|
- `firefox` **[object][5]?** pass additional firefox options
|
|
72
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][
|
|
74
|
-
- `ignoreLog` **[Array][
|
|
75
|
-
- `ignoreHTTPSErrors` **[boolean][
|
|
76
|
-
- `bypassCSP` **[boolean][
|
|
77
|
-
- `highlightElement` **[boolean][
|
|
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][42].
|
|
74
|
+
- `ignoreLog` **[Array][20]<[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][43].
|
|
75
|
+
- `ignoreHTTPSErrors` **[boolean][31]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
76
|
+
- `bypassCSP` **[boolean][31]?** bypass Content Security Policy or CSP
|
|
77
|
+
- `highlightElement` **[boolean][31]?** highlight the interacting elements
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
@@ -217,6 +217,22 @@ const { devices } = require('playwright');
|
|
|
217
217
|
}
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
+
- #### Example #9: Launch electron test
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
{
|
|
224
|
+
helpers: {
|
|
225
|
+
Playwright: {
|
|
226
|
+
browser: 'electron',
|
|
227
|
+
electron: {
|
|
228
|
+
executablePath: require("electron"),
|
|
229
|
+
args: [path.join('../', "main.js")],
|
|
230
|
+
},
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
220
236
|
Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
221
237
|
|
|
222
238
|
## Access From Helpers
|
|
@@ -408,20 +424,26 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
408
424
|
|
|
409
425
|
### blur
|
|
410
426
|
|
|
411
|
-
Remove focus from a text input, button, etc
|
|
427
|
+
Remove focus from a text input, button, etc.
|
|
412
428
|
Calls [blur][9] on the element.
|
|
413
429
|
|
|
430
|
+
Examples:
|
|
431
|
+
|
|
432
|
+
```js
|
|
433
|
+
I.blur('.text-area')
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
```js
|
|
437
|
+
//element `#product-tile` is focused
|
|
438
|
+
I.see('#add-to-cart-btn');
|
|
439
|
+
I.blur('#product-tile')
|
|
440
|
+
I.dontSee('#add-to-cart-btn');
|
|
441
|
+
```
|
|
442
|
+
|
|
414
443
|
#### Parameters
|
|
415
444
|
|
|
416
445
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
417
|
-
- `options` **any?** [Additional options][
|
|
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
|
-
```
|
|
446
|
+
- `options` **any?** Playwright only: [Additional options][10] for available options object as 2nd argument.
|
|
425
447
|
|
|
426
448
|
### cancelPopup
|
|
427
449
|
|
|
@@ -444,7 +466,7 @@ I.checkOption('agree', '//form');
|
|
|
444
466
|
|
|
445
467
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
446
468
|
- `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][
|
|
469
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][11] for check available as 3rd argument.Examples:```js
|
|
448
470
|
// click on element at position
|
|
449
471
|
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
450
472
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -467,16 +489,23 @@ I.clearCookie('test');
|
|
|
467
489
|
|
|
468
490
|
### clearField
|
|
469
491
|
|
|
470
|
-
|
|
492
|
+
Clears the text input element: `<input>`, `<textarea>` or `[contenteditable]` .
|
|
493
|
+
|
|
494
|
+
Examples:
|
|
495
|
+
|
|
496
|
+
```js
|
|
497
|
+
I.clearField('.text-area')
|
|
498
|
+
|
|
499
|
+
// if this doesn't work use force option
|
|
500
|
+
I.clearField('#submit', { force: true })
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
Use `force` to bypass the [actionability][12] checks.
|
|
471
504
|
|
|
472
505
|
#### Parameters
|
|
473
506
|
|
|
474
507
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
475
|
-
- `options` **any?** [Additional options][
|
|
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
|
-
```
|
|
508
|
+
- `options` **any?** [Additional options][13] for available options object as 2nd argument.
|
|
480
509
|
|
|
481
510
|
### click
|
|
482
511
|
|
|
@@ -507,7 +536,7 @@ I.click({css: 'nav a.login'});
|
|
|
507
536
|
- `locator` **([string][8] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
508
537
|
- `context` **([string][8]? | [object][5] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
509
538
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
510
|
-
- `options` **any?** [Additional options][
|
|
539
|
+
- `options` **any?** [Additional options][14] for click available as 3rd argument.Examples:```js
|
|
511
540
|
// click on element at position
|
|
512
541
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
513
542
|
|
|
@@ -708,7 +737,7 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
708
737
|
- `srcElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
709
738
|
- `destElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
710
739
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
711
|
-
- `options` **any?** [Additional options][
|
|
740
|
+
- `options` **any?** [Additional options][15] can be passed as 3rd argument.```js
|
|
712
741
|
// specify coordinates for source position
|
|
713
742
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
714
743
|
```> 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`
|
|
@@ -726,7 +755,7 @@ I.dragSlider('#slider', -70);
|
|
|
726
755
|
#### Parameters
|
|
727
756
|
|
|
728
757
|
- `locator` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
729
|
-
- `offsetX` **[number][
|
|
758
|
+
- `offsetX` **[number][16]** position to drag.
|
|
730
759
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
731
760
|
|
|
732
761
|
### executeScript
|
|
@@ -754,10 +783,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
754
783
|
|
|
755
784
|
#### Parameters
|
|
756
785
|
|
|
757
|
-
- `fn` **([string][8] | [function][
|
|
786
|
+
- `fn` **([string][8] | [function][17])** function to be executed in browser context.
|
|
758
787
|
- `arg` **any?** optional argument to pass to the function
|
|
759
788
|
|
|
760
|
-
Returns **[Promise][
|
|
789
|
+
Returns **[Promise][18]<any>**
|
|
761
790
|
|
|
762
791
|
### fillField
|
|
763
792
|
|
|
@@ -783,16 +812,20 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
783
812
|
|
|
784
813
|
### focus
|
|
785
814
|
|
|
786
|
-
Calls [focus][
|
|
815
|
+
Calls [focus][9] on the matching element.
|
|
816
|
+
|
|
817
|
+
Examples:
|
|
818
|
+
|
|
819
|
+
```js
|
|
820
|
+
I.dontSee('#add-to-cart-btn');
|
|
821
|
+
I.focus('#product-tile')
|
|
822
|
+
I.see('#add-to-cart-bnt');
|
|
823
|
+
```
|
|
787
824
|
|
|
788
825
|
#### Parameters
|
|
789
826
|
|
|
790
827
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
791
|
-
- `options` **any?** [Additional options][
|
|
792
|
-
I.dontSee('#add-to-cart-btn');
|
|
793
|
-
I.focus('#product-tile')
|
|
794
|
-
I.see('#add-to-cart-bnt');
|
|
795
|
-
```
|
|
828
|
+
- `options` **any?** Playwright only: [Additional options][19] for available options object as 2nd argument.
|
|
796
829
|
|
|
797
830
|
### forceClick
|
|
798
831
|
|
|
@@ -842,7 +875,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
842
875
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
843
876
|
- `attr` **[string][8]** attribute name.
|
|
844
877
|
|
|
845
|
-
Returns **[Promise][
|
|
878
|
+
Returns **[Promise][18]<[string][8]>** attribute value
|
|
846
879
|
|
|
847
880
|
### grabAttributeFromAll
|
|
848
881
|
|
|
@@ -858,7 +891,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
858
891
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
859
892
|
- `attr` **[string][8]** attribute name.
|
|
860
893
|
|
|
861
|
-
Returns **[Promise][
|
|
894
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** attribute value
|
|
862
895
|
|
|
863
896
|
### grabBrowserLogs
|
|
864
897
|
|
|
@@ -870,9 +903,9 @@ const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l
|
|
|
870
903
|
console.log(JSON.stringify(errors));
|
|
871
904
|
```
|
|
872
905
|
|
|
873
|
-
[Learn more about console messages][
|
|
906
|
+
[Learn more about console messages][21]
|
|
874
907
|
|
|
875
|
-
Returns **[Promise][
|
|
908
|
+
Returns **[Promise][18]<[Array][20]<any>>**
|
|
876
909
|
|
|
877
910
|
### grabCookie
|
|
878
911
|
|
|
@@ -889,7 +922,7 @@ assert(cookie.value, '123456');
|
|
|
889
922
|
|
|
890
923
|
- `name` **[string][8]?** cookie name.
|
|
891
924
|
|
|
892
|
-
Returns **([Promise][
|
|
925
|
+
Returns **([Promise][18]<[string][8]> | [Promise][18]<[Array][20]<[string][8]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
893
926
|
|
|
894
927
|
### grabCssPropertyFrom
|
|
895
928
|
|
|
@@ -906,7 +939,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
906
939
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
907
940
|
- `cssProperty` **[string][8]** CSS property name.
|
|
908
941
|
|
|
909
|
-
Returns **[Promise][
|
|
942
|
+
Returns **[Promise][18]<[string][8]>** CSS value
|
|
910
943
|
|
|
911
944
|
### grabCssPropertyFromAll
|
|
912
945
|
|
|
@@ -922,7 +955,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
922
955
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
923
956
|
- `cssProperty` **[string][8]** CSS property name.
|
|
924
957
|
|
|
925
|
-
Returns **[Promise][
|
|
958
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** CSS value
|
|
926
959
|
|
|
927
960
|
### grabCurrentUrl
|
|
928
961
|
|
|
@@ -934,7 +967,7 @@ let url = await I.grabCurrentUrl();
|
|
|
934
967
|
console.log(`Current URL is [${url}]`);
|
|
935
968
|
```
|
|
936
969
|
|
|
937
|
-
Returns **[Promise][
|
|
970
|
+
Returns **[Promise][18]<[string][8]>** current URL
|
|
938
971
|
|
|
939
972
|
### grabDataFromPerformanceTiming
|
|
940
973
|
|
|
@@ -959,7 +992,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
959
992
|
}
|
|
960
993
|
```
|
|
961
994
|
|
|
962
|
-
Returns **[Promise][
|
|
995
|
+
Returns **[Promise][18]<any>** automatically synchronized promise through #recorder
|
|
963
996
|
|
|
964
997
|
### grabElementBoundingRect
|
|
965
998
|
|
|
@@ -987,7 +1020,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
987
1020
|
- `prop`
|
|
988
1021
|
- `elementSize` **[string][8]?** x, y, width or height of the given element.
|
|
989
1022
|
|
|
990
|
-
Returns **([Promise][
|
|
1023
|
+
Returns **([Promise][18]<DOMRect> | [Promise][18]<[number][16]>)** Element bounding rectangle
|
|
991
1024
|
|
|
992
1025
|
### grabHTMLFrom
|
|
993
1026
|
|
|
@@ -1004,7 +1037,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1004
1037
|
- `locator`
|
|
1005
1038
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1006
1039
|
|
|
1007
|
-
Returns **[Promise][
|
|
1040
|
+
Returns **[Promise][18]<[string][8]>** HTML code for an element
|
|
1008
1041
|
|
|
1009
1042
|
### grabHTMLFromAll
|
|
1010
1043
|
|
|
@@ -1020,7 +1053,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1020
1053
|
- `locator`
|
|
1021
1054
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1022
1055
|
|
|
1023
|
-
Returns **[Promise][
|
|
1056
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** HTML code for an element
|
|
1024
1057
|
|
|
1025
1058
|
### grabNumberOfOpenTabs
|
|
1026
1059
|
|
|
@@ -1031,7 +1064,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1031
1064
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1032
1065
|
```
|
|
1033
1066
|
|
|
1034
|
-
Returns **[Promise][
|
|
1067
|
+
Returns **[Promise][18]<[number][16]>** number of open tabs
|
|
1035
1068
|
|
|
1036
1069
|
### grabNumberOfVisibleElements
|
|
1037
1070
|
|
|
@@ -1046,7 +1079,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1046
1079
|
|
|
1047
1080
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1048
1081
|
|
|
1049
|
-
Returns **[Promise][
|
|
1082
|
+
Returns **[Promise][18]<[number][16]>** number of visible elements
|
|
1050
1083
|
|
|
1051
1084
|
### grabPageScrollPosition
|
|
1052
1085
|
|
|
@@ -1057,7 +1090,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1057
1090
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1058
1091
|
```
|
|
1059
1092
|
|
|
1060
|
-
Returns **[Promise][
|
|
1093
|
+
Returns **[Promise][18]<PageScrollPosition>** scroll position
|
|
1061
1094
|
|
|
1062
1095
|
### grabPopupText
|
|
1063
1096
|
|
|
@@ -1067,7 +1100,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1067
1100
|
await I.grabPopupText();
|
|
1068
1101
|
```
|
|
1069
1102
|
|
|
1070
|
-
Returns **[Promise][
|
|
1103
|
+
Returns **[Promise][18]<([string][8] | null)>**
|
|
1071
1104
|
|
|
1072
1105
|
### grabSource
|
|
1073
1106
|
|
|
@@ -1078,7 +1111,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1078
1111
|
let pageSource = await I.grabSource();
|
|
1079
1112
|
```
|
|
1080
1113
|
|
|
1081
|
-
Returns **[Promise][
|
|
1114
|
+
Returns **[Promise][18]<[string][8]>** source code
|
|
1082
1115
|
|
|
1083
1116
|
### grabTextFrom
|
|
1084
1117
|
|
|
@@ -1095,7 +1128,7 @@ If multiple elements found returns first element.
|
|
|
1095
1128
|
|
|
1096
1129
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1097
1130
|
|
|
1098
|
-
Returns **[Promise][
|
|
1131
|
+
Returns **[Promise][18]<[string][8]>** attribute value
|
|
1099
1132
|
|
|
1100
1133
|
### grabTextFromAll
|
|
1101
1134
|
|
|
@@ -1110,7 +1143,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1110
1143
|
|
|
1111
1144
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1112
1145
|
|
|
1113
|
-
Returns **[Promise][
|
|
1146
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** attribute value
|
|
1114
1147
|
|
|
1115
1148
|
### grabTitle
|
|
1116
1149
|
|
|
@@ -1121,7 +1154,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1121
1154
|
let title = await I.grabTitle();
|
|
1122
1155
|
```
|
|
1123
1156
|
|
|
1124
|
-
Returns **[Promise][
|
|
1157
|
+
Returns **[Promise][18]<[string][8]>** title
|
|
1125
1158
|
|
|
1126
1159
|
### grabValueFrom
|
|
1127
1160
|
|
|
@@ -1137,7 +1170,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1137
1170
|
|
|
1138
1171
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1139
1172
|
|
|
1140
|
-
Returns **[Promise][
|
|
1173
|
+
Returns **[Promise][18]<[string][8]>** attribute value
|
|
1141
1174
|
|
|
1142
1175
|
### grabValueFromAll
|
|
1143
1176
|
|
|
@@ -1152,14 +1185,14 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1152
1185
|
|
|
1153
1186
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1154
1187
|
|
|
1155
|
-
Returns **[Promise][
|
|
1188
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** attribute value
|
|
1156
1189
|
|
|
1157
1190
|
### handleDownloads
|
|
1158
1191
|
|
|
1159
1192
|
Handles a file download. A file name is required to save the file on disk.
|
|
1160
1193
|
Files are saved to "output" directory.
|
|
1161
1194
|
|
|
1162
|
-
Should be used with [FileSystem helper][
|
|
1195
|
+
Should be used with [FileSystem helper][22] to check that file were downloaded correctly.
|
|
1163
1196
|
|
|
1164
1197
|
```js
|
|
1165
1198
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1172,7 +1205,7 @@ I.waitForFile('avatar.jpg', 5);
|
|
|
1172
1205
|
|
|
1173
1206
|
- `fileName` **[string][8]** set filename for downloaded file
|
|
1174
1207
|
|
|
1175
|
-
Returns **[Promise][
|
|
1208
|
+
Returns **[Promise][18]<void>**
|
|
1176
1209
|
|
|
1177
1210
|
### haveRequestHeaders
|
|
1178
1211
|
|
|
@@ -1190,7 +1223,7 @@ I.haveRequestHeaders({
|
|
|
1190
1223
|
|
|
1191
1224
|
### makeApiRequest
|
|
1192
1225
|
|
|
1193
|
-
Performs [api request][
|
|
1226
|
+
Performs [api request][23] using
|
|
1194
1227
|
the cookies from the current browser session.
|
|
1195
1228
|
|
|
1196
1229
|
```js
|
|
@@ -1207,22 +1240,22 @@ I.makeApiRequest('PATCH', )
|
|
|
1207
1240
|
- `url` **[string][8]** endpoint
|
|
1208
1241
|
- `options` **[object][5]** request options depending on method used
|
|
1209
1242
|
|
|
1210
|
-
Returns **[Promise][
|
|
1243
|
+
Returns **[Promise][18]<[object][5]>** response
|
|
1211
1244
|
|
|
1212
1245
|
### mockRoute
|
|
1213
1246
|
|
|
1214
|
-
Mocks network request using [`browserContext.route`][
|
|
1247
|
+
Mocks network request using [`browserContext.route`][24] of Playwright
|
|
1215
1248
|
|
|
1216
1249
|
```js
|
|
1217
1250
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1218
1251
|
```
|
|
1219
1252
|
|
|
1220
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1253
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][25]
|
|
1221
1254
|
|
|
1222
1255
|
#### Parameters
|
|
1223
1256
|
|
|
1224
|
-
- `url` **([string][8] | [RegExp][
|
|
1225
|
-
- `handler` **[function][
|
|
1257
|
+
- `url` **([string][8] | [RegExp][26])?** URL, regex or pattern for to match URL
|
|
1258
|
+
- `handler` **[function][17]?** a function to process reques
|
|
1226
1259
|
|
|
1227
1260
|
### moveCursorTo
|
|
1228
1261
|
|
|
@@ -1237,8 +1270,8 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1237
1270
|
#### Parameters
|
|
1238
1271
|
|
|
1239
1272
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1240
|
-
- `offsetX` **[number][
|
|
1241
|
-
- `offsetY` **[number][
|
|
1273
|
+
- `offsetX` **[number][16]** (optional, `0` by default) X-axis offset.
|
|
1274
|
+
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1242
1275
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1243
1276
|
|
|
1244
1277
|
### openNewTab
|
|
@@ -1249,7 +1282,7 @@ Open new tab and automatically switched to new tab
|
|
|
1249
1282
|
I.openNewTab();
|
|
1250
1283
|
```
|
|
1251
1284
|
|
|
1252
|
-
You can pass in [page options][
|
|
1285
|
+
You can pass in [page options][27] to emulate device on this page
|
|
1253
1286
|
|
|
1254
1287
|
```js
|
|
1255
1288
|
// enable mobile
|
|
@@ -1264,7 +1297,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1264
1297
|
|
|
1265
1298
|
Presses a key in the browser (on a focused element).
|
|
1266
1299
|
|
|
1267
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1300
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][28].
|
|
1268
1301
|
|
|
1269
1302
|
```js
|
|
1270
1303
|
I.pressKey('Backspace');
|
|
@@ -1323,14 +1356,14 @@ Some of the supported key names are:
|
|
|
1323
1356
|
|
|
1324
1357
|
#### Parameters
|
|
1325
1358
|
|
|
1326
|
-
- `key` **([string][8] | [Array][
|
|
1327
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][
|
|
1359
|
+
- `key` **([string][8] | [Array][20]<[string][8]>)** key or array of keys to press.
|
|
1360
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][29]).
|
|
1328
1361
|
|
|
1329
1362
|
### pressKeyDown
|
|
1330
1363
|
|
|
1331
1364
|
Presses a key in the browser and leaves it in a down state.
|
|
1332
1365
|
|
|
1333
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1366
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][30]).
|
|
1334
1367
|
|
|
1335
1368
|
```js
|
|
1336
1369
|
I.pressKeyDown('Control');
|
|
@@ -1347,7 +1380,7 @@ I.pressKeyUp('Control');
|
|
|
1347
1380
|
|
|
1348
1381
|
Releases a key in the browser which was previously set to a down state.
|
|
1349
1382
|
|
|
1350
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1383
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][30]).
|
|
1351
1384
|
|
|
1352
1385
|
```js
|
|
1353
1386
|
I.pressKeyDown('Control');
|
|
@@ -1377,8 +1410,8 @@ First parameter can be set to `maximize`.
|
|
|
1377
1410
|
|
|
1378
1411
|
#### Parameters
|
|
1379
1412
|
|
|
1380
|
-
- `width` **[number][
|
|
1381
|
-
- `height` **[number][
|
|
1413
|
+
- `width` **[number][16]** width in pixels or `maximize`.
|
|
1414
|
+
- `height` **[number][16]** height in pixels.
|
|
1382
1415
|
⚠️ returns a _promise_ which is synchronized internally by recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1383
1416
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1384
1417
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
@@ -1452,7 +1485,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1452
1485
|
#### Parameters
|
|
1453
1486
|
|
|
1454
1487
|
- `fileName` **[string][8]** file name to save.
|
|
1455
|
-
- `fullPage` **[boolean][
|
|
1488
|
+
- `fullPage` **[boolean][31]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1456
1489
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1457
1490
|
|
|
1458
1491
|
### scrollPageToBottom
|
|
@@ -1488,8 +1521,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1488
1521
|
#### Parameters
|
|
1489
1522
|
|
|
1490
1523
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1491
|
-
- `offsetX` **[number][
|
|
1492
|
-
- `offsetY` **[number][
|
|
1524
|
+
- `offsetX` **[number][16]** (optional, `0` by default) X-axis offset.
|
|
1525
|
+
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1493
1526
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1494
1527
|
|
|
1495
1528
|
### see
|
|
@@ -1692,7 +1725,7 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1692
1725
|
#### Parameters
|
|
1693
1726
|
|
|
1694
1727
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1695
|
-
- `num` **[number][
|
|
1728
|
+
- `num` **[number][16]** number of elements.
|
|
1696
1729
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1697
1730
|
|
|
1698
1731
|
### seeNumberOfVisibleElements
|
|
@@ -1707,7 +1740,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1707
1740
|
#### Parameters
|
|
1708
1741
|
|
|
1709
1742
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1710
|
-
- `num` **[number][
|
|
1743
|
+
- `num` **[number][16]** number of elements.
|
|
1711
1744
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1712
1745
|
|
|
1713
1746
|
### seeTextEquals
|
|
@@ -1761,7 +1794,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1761
1794
|
#### Parameters
|
|
1762
1795
|
|
|
1763
1796
|
- `select` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1764
|
-
- `option` **([string][8] | [Array][
|
|
1797
|
+
- `option` **([string][8] | [Array][20]<any>)** visible text or value of option.
|
|
1765
1798
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1766
1799
|
|
|
1767
1800
|
### setCookie
|
|
@@ -1782,7 +1815,7 @@ I.setCookie([
|
|
|
1782
1815
|
|
|
1783
1816
|
#### Parameters
|
|
1784
1817
|
|
|
1785
|
-
- `cookie` **(Cookie | [Array][
|
|
1818
|
+
- `cookie` **(Cookie | [Array][20]<Cookie>)** a cookie object or array of cookie objects.
|
|
1786
1819
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1787
1820
|
|
|
1788
1821
|
### stopMockingRoute
|
|
@@ -1798,8 +1831,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1798
1831
|
|
|
1799
1832
|
#### Parameters
|
|
1800
1833
|
|
|
1801
|
-
- `url` **([string][8] | [RegExp][
|
|
1802
|
-
- `handler` **[function][
|
|
1834
|
+
- `url` **([string][8] | [RegExp][26])?** URL, regex or pattern for to match URL
|
|
1835
|
+
- `handler` **[function][17]?** a function to process reques
|
|
1803
1836
|
|
|
1804
1837
|
### switchTo
|
|
1805
1838
|
|
|
@@ -1826,7 +1859,7 @@ I.switchToNextTab(2);
|
|
|
1826
1859
|
|
|
1827
1860
|
#### Parameters
|
|
1828
1861
|
|
|
1829
|
-
- `num` **[number][
|
|
1862
|
+
- `num` **[number][16]**
|
|
1830
1863
|
|
|
1831
1864
|
### switchToPreviousTab
|
|
1832
1865
|
|
|
@@ -1839,13 +1872,13 @@ I.switchToPreviousTab(2);
|
|
|
1839
1872
|
|
|
1840
1873
|
#### Parameters
|
|
1841
1874
|
|
|
1842
|
-
- `num` **[number][
|
|
1875
|
+
- `num` **[number][16]**
|
|
1843
1876
|
|
|
1844
1877
|
### type
|
|
1845
1878
|
|
|
1846
1879
|
Types out the given text into an active field.
|
|
1847
1880
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1848
|
-
_Note:_ Should be used when [`fillField`][
|
|
1881
|
+
_Note:_ Should be used when [`fillField`][28] is not an option.
|
|
1849
1882
|
|
|
1850
1883
|
```js
|
|
1851
1884
|
// passing in a string
|
|
@@ -1864,9 +1897,9 @@ I.type(secret('123456'));
|
|
|
1864
1897
|
#### Parameters
|
|
1865
1898
|
|
|
1866
1899
|
- `keys`
|
|
1867
|
-
- `delay` **[number][
|
|
1900
|
+
- `delay` **[number][16]?** (optional) delay in ms between key presses
|
|
1868
1901
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1869
|
-
- `key` **([string][8] | [Array][
|
|
1902
|
+
- `key` **([string][8] | [Array][20]<[string][8]>)** or array of keys to type.
|
|
1870
1903
|
|
|
1871
1904
|
### uncheckOption
|
|
1872
1905
|
|
|
@@ -1885,7 +1918,7 @@ I.uncheckOption('agree', '//form');
|
|
|
1885
1918
|
|
|
1886
1919
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1887
1920
|
- `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][
|
|
1921
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][32] for uncheck available as 3rd argument.Examples:```js
|
|
1889
1922
|
// click on element at position
|
|
1890
1923
|
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1891
1924
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -1898,7 +1931,7 @@ Use Playwright API inside a test.
|
|
|
1898
1931
|
First argument is a description of an action.
|
|
1899
1932
|
Second argument is async function that gets this helper as parameter.
|
|
1900
1933
|
|
|
1901
|
-
{ [`page`][
|
|
1934
|
+
{ [`page`][33], [`browserContext`][34] [`browser`][35] } objects from Playwright API are available.
|
|
1902
1935
|
|
|
1903
1936
|
```js
|
|
1904
1937
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -1909,7 +1942,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
1909
1942
|
#### Parameters
|
|
1910
1943
|
|
|
1911
1944
|
- `description` **[string][8]** used to show in logs.
|
|
1912
|
-
- `fn` **[function][
|
|
1945
|
+
- `fn` **[function][17]** async function that executed with Playwright helper as argumen
|
|
1913
1946
|
|
|
1914
1947
|
### wait
|
|
1915
1948
|
|
|
@@ -1921,7 +1954,7 @@ I.wait(2); // wait 2 secs
|
|
|
1921
1954
|
|
|
1922
1955
|
#### Parameters
|
|
1923
1956
|
|
|
1924
|
-
- `sec` **[number][
|
|
1957
|
+
- `sec` **[number][16]** number of second to wait.
|
|
1925
1958
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1926
1959
|
|
|
1927
1960
|
### waitForClickable
|
|
@@ -1938,7 +1971,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1938
1971
|
|
|
1939
1972
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1940
1973
|
- `waitTimeout`
|
|
1941
|
-
- `sec` **[number][
|
|
1974
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1942
1975
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1943
1976
|
|
|
1944
1977
|
### waitForDetached
|
|
@@ -1953,7 +1986,7 @@ I.waitForDetached('#popup');
|
|
|
1953
1986
|
#### Parameters
|
|
1954
1987
|
|
|
1955
1988
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1956
|
-
- `sec` **[number][
|
|
1989
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1957
1990
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1958
1991
|
|
|
1959
1992
|
### waitForElement
|
|
@@ -1969,7 +2002,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1969
2002
|
#### Parameters
|
|
1970
2003
|
|
|
1971
2004
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1972
|
-
- `sec` **[number][
|
|
2005
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1973
2006
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1974
2007
|
|
|
1975
2008
|
### waitForEnabled
|
|
@@ -1980,7 +2013,7 @@ Element can be located by CSS or XPath.
|
|
|
1980
2013
|
#### Parameters
|
|
1981
2014
|
|
|
1982
2015
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1983
|
-
- `sec` **[number][
|
|
2016
|
+
- `sec` **[number][16]** (optional) time in seconds to wait, 1 by default.
|
|
1984
2017
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1985
2018
|
|
|
1986
2019
|
### waitForFunction
|
|
@@ -2000,9 +2033,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2000
2033
|
|
|
2001
2034
|
#### Parameters
|
|
2002
2035
|
|
|
2003
|
-
- `fn` **([string][8] | [function][
|
|
2004
|
-
- `argsOrSec` **([Array][
|
|
2005
|
-
- `sec` **[number][
|
|
2036
|
+
- `fn` **([string][8] | [function][17])** to be executed in browser context.
|
|
2037
|
+
- `argsOrSec` **([Array][20]<any> | [number][16])?** (optional, `1` by default) arguments for function or seconds.
|
|
2038
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
2006
2039
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2007
2040
|
|
|
2008
2041
|
### waitForInvisible
|
|
@@ -2017,14 +2050,14 @@ I.waitForInvisible('#popup');
|
|
|
2017
2050
|
#### Parameters
|
|
2018
2051
|
|
|
2019
2052
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2020
|
-
- `sec` **[number][
|
|
2053
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2021
2054
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2022
2055
|
|
|
2023
2056
|
### waitForNavigation
|
|
2024
2057
|
|
|
2025
2058
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
2026
2059
|
|
|
2027
|
-
See [Playwright's reference][
|
|
2060
|
+
See [Playwright's reference][36]
|
|
2028
2061
|
|
|
2029
2062
|
#### Parameters
|
|
2030
2063
|
|
|
@@ -2041,8 +2074,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2041
2074
|
|
|
2042
2075
|
#### Parameters
|
|
2043
2076
|
|
|
2044
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2045
|
-
- `sec` **[number][
|
|
2077
|
+
- `urlOrPredicate` **([string][8] | [function][17])**
|
|
2078
|
+
- `sec` **[number][16]?** seconds to wait
|
|
2046
2079
|
|
|
2047
2080
|
### waitForResponse
|
|
2048
2081
|
|
|
@@ -2055,8 +2088,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2055
2088
|
|
|
2056
2089
|
#### Parameters
|
|
2057
2090
|
|
|
2058
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2059
|
-
- `sec` **[number][
|
|
2091
|
+
- `urlOrPredicate` **([string][8] | [function][17])**
|
|
2092
|
+
- `sec` **[number][16]?** number of seconds to wait
|
|
2060
2093
|
|
|
2061
2094
|
### waitForText
|
|
2062
2095
|
|
|
@@ -2072,7 +2105,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2072
2105
|
#### Parameters
|
|
2073
2106
|
|
|
2074
2107
|
- `text` **[string][8]** to wait for.
|
|
2075
|
-
- `sec` **[number][
|
|
2108
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2076
2109
|
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
2077
2110
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2078
2111
|
|
|
@@ -2088,7 +2121,7 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2088
2121
|
|
|
2089
2122
|
- `field` **([string][8] | [object][5])** input field.
|
|
2090
2123
|
- `value` **[string][8]** expected value.
|
|
2091
|
-
- `sec` **[number][
|
|
2124
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2092
2125
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2093
2126
|
|
|
2094
2127
|
### waitForVisible
|
|
@@ -2103,8 +2136,8 @@ I.waitForVisible('#popup');
|
|
|
2103
2136
|
#### Parameters
|
|
2104
2137
|
|
|
2105
2138
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2106
|
-
- `sec` **[number][
|
|
2107
|
-
⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][
|
|
2139
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2140
|
+
⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][37].
|
|
2108
2141
|
|
|
2109
2142
|
### waitInUrl
|
|
2110
2143
|
|
|
@@ -2117,7 +2150,7 @@ I.waitInUrl('/info', 2);
|
|
|
2117
2150
|
#### Parameters
|
|
2118
2151
|
|
|
2119
2152
|
- `urlPart` **[string][8]** value to check.
|
|
2120
|
-
- `sec` **[number][
|
|
2153
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2121
2154
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2122
2155
|
|
|
2123
2156
|
### waitNumberOfVisibleElements
|
|
@@ -2131,8 +2164,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2131
2164
|
#### Parameters
|
|
2132
2165
|
|
|
2133
2166
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2134
|
-
- `num` **[number][
|
|
2135
|
-
- `sec` **[number][
|
|
2167
|
+
- `num` **[number][16]** number of elements.
|
|
2168
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2136
2169
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2137
2170
|
|
|
2138
2171
|
### waitToHide
|
|
@@ -2147,7 +2180,7 @@ I.waitToHide('#popup');
|
|
|
2147
2180
|
#### Parameters
|
|
2148
2181
|
|
|
2149
2182
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2150
|
-
- `sec` **[number][
|
|
2183
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2151
2184
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2152
2185
|
|
|
2153
2186
|
### waitUrlEquals
|
|
@@ -2162,7 +2195,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2162
2195
|
#### Parameters
|
|
2163
2196
|
|
|
2164
2197
|
- `urlPart` **[string][8]** value to check.
|
|
2165
|
-
- `sec` **[number][
|
|
2198
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2166
2199
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2167
2200
|
|
|
2168
2201
|
[1]: https://github.com/microsoft/playwright
|
|
@@ -2181,70 +2214,72 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2181
2214
|
|
|
2182
2215
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2183
2216
|
|
|
2184
|
-
[9]: https://
|
|
2217
|
+
[9]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2218
|
+
|
|
2219
|
+
[10]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2185
2220
|
|
|
2186
|
-
[
|
|
2221
|
+
[11]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2187
2222
|
|
|
2188
|
-
[
|
|
2223
|
+
[12]: https://playwright.dev/docs/actionability
|
|
2189
2224
|
|
|
2190
|
-
[
|
|
2225
|
+
[13]: https://playwright.dev/docs/api/class-locator#locator-clear
|
|
2191
2226
|
|
|
2192
|
-
[
|
|
2227
|
+
[14]: https://playwright.dev/docs/api/class-page#page-click
|
|
2193
2228
|
|
|
2194
|
-
[
|
|
2229
|
+
[15]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2195
2230
|
|
|
2196
|
-
[
|
|
2231
|
+
[16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2197
2232
|
|
|
2198
|
-
[
|
|
2233
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2199
2234
|
|
|
2200
|
-
[
|
|
2235
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2201
2236
|
|
|
2202
|
-
[
|
|
2237
|
+
[19]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2203
2238
|
|
|
2204
|
-
[
|
|
2239
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2205
2240
|
|
|
2206
|
-
[
|
|
2241
|
+
[21]: https://playwright.dev/docs/api/class-consolemessage
|
|
2207
2242
|
|
|
2208
|
-
[
|
|
2243
|
+
[22]: https://codecept.io/helpers/FileSystem
|
|
2209
2244
|
|
|
2210
|
-
[
|
|
2245
|
+
[23]: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
|
|
2211
2246
|
|
|
2212
|
-
[
|
|
2247
|
+
[24]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
2213
2248
|
|
|
2214
|
-
[
|
|
2249
|
+
[25]: https://playwright.dev/docs/network#handle-requests
|
|
2215
2250
|
|
|
2216
|
-
[
|
|
2251
|
+
[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2217
2252
|
|
|
2218
|
-
[
|
|
2253
|
+
[27]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2219
2254
|
|
|
2220
|
-
[
|
|
2255
|
+
[28]: #fillfield
|
|
2221
2256
|
|
|
2222
|
-
[
|
|
2257
|
+
[29]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
2223
2258
|
|
|
2224
|
-
[
|
|
2259
|
+
[30]: #click
|
|
2225
2260
|
|
|
2226
|
-
[
|
|
2261
|
+
[31]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2227
2262
|
|
|
2228
|
-
[
|
|
2263
|
+
[32]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2229
2264
|
|
|
2230
|
-
[
|
|
2265
|
+
[33]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2231
2266
|
|
|
2232
|
-
[
|
|
2267
|
+
[34]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2233
2268
|
|
|
2234
|
-
[
|
|
2269
|
+
[35]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2235
2270
|
|
|
2236
|
-
[
|
|
2271
|
+
[36]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2237
2272
|
|
|
2238
|
-
[
|
|
2273
|
+
[37]: https://codecept.io/react
|
|
2239
2274
|
|
|
2240
|
-
[
|
|
2275
|
+
[38]: https://playwright.dev/docs/api/class-browsercontext
|
|
2241
2276
|
|
|
2242
|
-
[
|
|
2277
|
+
[39]: https://playwright.dev/docs/api/class-page#page-set-default-timeout
|
|
2243
2278
|
|
|
2244
|
-
[
|
|
2279
|
+
[40]: https://playwright.dev/docs/trace-viewer
|
|
2245
2280
|
|
|
2246
|
-
[
|
|
2281
|
+
[41]: https://playwright.dev/docs/api/class-page#page-wait-for-navigation
|
|
2247
2282
|
|
|
2248
|
-
[
|
|
2283
|
+
[42]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|
|
2249
2284
|
|
|
2250
|
-
[
|
|
2285
|
+
[43]: https://playwright.dev/docs/api/class-consolemessage#console-message-type
|