@@ -508,6 +508,17 @@ Dismisses the active JavaScript popup, as created by window.alert|window.confirm
508
508
509
509
### checkOption
510
510
511
+ [ Additional options] [ 15 ] for check available as 3rd argument.
512
+
513
+ Examples:
514
+
515
+ ``` js
516
+ // click on element at position
517
+ I .checkOption (' Agree' , ' .signup' , { position: { x: 5 , y: 5 } })
518
+ ```
519
+
520
+ > ⚠️ To avoid flakiness, option ` force: true ` is set by default
521
+
511
522
Selects a checkbox or radio button.
512
523
Element is located by label or name or CSS or XPath.
513
524
@@ -525,10 +536,7 @@ I.checkOption('agree', '//form');
525
536
- ` context ` ** ([ string] [ 9 ] ? | [ object] [ 6 ] )** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
526
537
- ` options `
527
538
528
- Returns ** void** automatically synchronized promise through #recorder[ Additional options] [ 15 ] for check available as 3rd argument.Examples:```js
529
- // click on element at position
530
- I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
531
- ```> ⚠️ To avoid flakiness, option ` force: true ` is set by default
539
+ Returns ** void** automatically synchronized promise through #recorder
532
540
533
541
### clearCookie
534
542
@@ -592,13 +600,19 @@ I.click({css: 'nav a.login'});
592
600
593
601
- ` locator ` ** ([ string] [ 9 ] | [ object] [ 6 ] )** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
594
602
- ` context ` ** ([ string] [ 9 ] ? | [ object] [ 6 ] | null)** (optional, ` null ` by default) element to search in CSS|XPath|Strict locator.
595
- - ` options ` ** any?** [ Additional options] [ 18 ] for click available as 3rd argument.Examples:```js
596
- // click on element at position
597
- I.click('canvas', '.model', { position: { x: 20, y: 40 } })
603
+ - ` options ` ** any?** [ Additional options] [ 18 ] for click available as 3rd argument.
604
+
605
+ #### Examples
598
606
599
- // make ctrl-click
600
- I.click('.edit', null, { modifiers: [ 'Ctrl'] } )
601
- ```
607
+ ```` javascript
608
+ ` ` ` js
609
+ // click on element at position
610
+ I.click('canvas', '.model', { position: { x: 20, y: 40 } })
611
+
612
+ // make ctrl-click
613
+ I.click('.edit', null, { modifiers: ['Ctrl'] } )
614
+ ` ` `
615
+ ````
602
616
603
617
Returns ** void** automatically synchronized promise through #recorder
604
618
@@ -812,6 +826,13 @@ Returns **void** automatically synchronized promise through #recorder
812
826
813
827
### dragAndDrop
814
828
829
+ ``` js
830
+ // specify coordinates for source position
831
+ I .dragAndDrop (' img.src' , ' img.dst' , { sourcePosition: {x: 10 , y: 10 } })
832
+ ```
833
+
834
+ > When no option is set, custom drag and drop would be used, to use the dragAndDrop API from Playwright, please set options, for example ` force: true `
835
+
815
836
Drag an item to a destination element.
816
837
817
838
``` js
@@ -822,10 +843,7 @@ I.dragAndDrop('#dragHandle', '#container');
822
843
823
844
- ` srcElement ` ** ([ string] [ 9 ] | [ object] [ 6 ] )** located by CSS|XPath|strict locator.
824
845
- ` destElement ` ** ([ string] [ 9 ] | [ object] [ 6 ] )** located by CSS|XPath|strict locator.
825
- - ` options ` ** any?** [ Additional options] [ 19 ] can be passed as 3rd argument.```js
826
- // specify coordinates for source position
827
- I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
828
- ```> 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 `
846
+ - ` options ` ** any?** [ Additional options] [ 19 ] can be passed as 3rd argument.
829
847
830
848
Returns ** void** automatically synchronized promise through #recorder
831
849
@@ -860,8 +878,8 @@ Additional parameters of the function can be passed as an object argument:
860
878
I .executeScript (({x, y}) => x + y, {x, y});
861
879
```
862
880
863
- You can pass only one parameter into a function
864
- but you can pass in array or object.
881
+ You can pass only one parameter into a function,
882
+ or you can pass in array or object.
865
883
866
884
``` js
867
885
I .executeScript (([x , y ]) => x + y, [x, y]);
@@ -1020,6 +1038,8 @@ Returns **[Promise][22]<[boolean][26]>**
1020
1038
1021
1039
### grabCookie
1022
1040
1041
+ Returns cookie in JSON format. If name not passed returns all cookies for this domain.
1042
+
1023
1043
Gets a cookie object by name.
1024
1044
If none provided gets all cookies.
1025
1045
Resumes test execution, so ** should be used inside async function with ` await ` ** operator.
@@ -1033,7 +1053,7 @@ assert(cookie.value, '123456');
1033
1053
1034
1054
- ` name ` ** [ string] [ 9 ] ?** cookie name.
1035
1055
1036
- Returns ** any** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
1056
+ Returns ** any** attribute value
1037
1057
1038
1058
### grabCssPropertyFrom
1039
1059
@@ -1539,9 +1559,11 @@ I.openNewTab({ isMobile: true });
1539
1559
1540
1560
### pressKey
1541
1561
1562
+ _ Note:_ Shortcuts like ` 'Meta' ` + ` 'A' ` do not work on macOS ([ GoogleChrome/Puppeteer #1313 ] [ 33 ] ).
1563
+
1542
1564
Presses a key in the browser (on a focused element).
1543
1565
1544
- _ Hint:_ For populating text field or textarea, it is recommended to use [ ` fillField ` ] [ 33 ] .
1566
+ _ Hint:_ For populating text field or textarea, it is recommended to use [ ` fillField ` ] [ 34 ] .
1545
1567
1546
1568
``` js
1547
1569
I .pressKey (' Backspace' );
@@ -1602,7 +1624,7 @@ Some of the supported key names are:
1602
1624
1603
1625
- ` key ` ** ([ string] [ 9 ] | [ Array] [ 10 ] < ; [ string] [ 9 ] >)** key or array of keys to press.
1604
1626
1605
- Returns ** void** automatically synchronized promise through #recorder_Note: _ Shortcuts like ` 'Meta' ` + ` 'A' ` do not work on macOS ( [ GoogleChrome/Puppeteer # 1313 ] [ 34 ] ).
1627
+ Returns ** void** automatically synchronized promise through #recorder
1606
1628
1607
1629
### pressKeyDown
1608
1630
@@ -1672,6 +1694,18 @@ Returns **any** Promise<void>
1672
1694
1673
1695
### resizeWindow
1674
1696
1697
+ Unlike other drivers Playwright changes the size of a viewport, not the window!
1698
+ Playwright does not control the window of a browser, so it can't adjust its real size.
1699
+ It also can't maximize a window.
1700
+
1701
+ Update configuration to change real window size on start:
1702
+
1703
+ ``` js
1704
+ // inside codecept.conf.js
1705
+ // @codeceptjs/configure package must be installed
1706
+ { setWindowSize } = require (' @codeceptjs/configure' );
1707
+ ```
1708
+
1675
1709
Resize the current window to provided width and height.
1676
1710
First parameter can be set to ` maximize ` .
1677
1711
@@ -1680,13 +1714,7 @@ First parameter can be set to `maximize`.
1680
1714
- ` width ` ** [ number] [ 20 ] ** width in pixels or ` maximize ` .
1681
1715
- ` height ` ** [ number] [ 20 ] ** height in pixels.
1682
1716
1683
- Returns ** void** automatically synchronized promise through #recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
1684
- Playwright does not control the window of a browser so it can't adjust its real size.
1685
- It also can't maximize a window.Update configuration to change real window size on start:```js
1686
- // inside codecept.conf.js
1687
- // @codeceptjs/configure package must be installed
1688
- { setWindowSize } = require('@codeceptjs/configure ');
1689
- ```
1717
+ Returns ** void** automatically synchronized promise through #recorder
1690
1718
1691
1719
### restartBrowser
1692
1720
@@ -2262,7 +2290,7 @@ I.switchToPreviousTab(2);
2262
2290
2263
2291
Types out the given text into an active field.
2264
2292
To slow down typing use a second parameter, to set interval between key presses.
2265
- _ Note:_ Should be used when [ ` fillField ` ] [ 33 ] is not an option.
2293
+ _ Note:_ Should be used when [ ` fillField ` ] [ 34 ] is not an option.
2266
2294
2267
2295
``` js
2268
2296
// passing in a string
@@ -2288,6 +2316,17 @@ Returns **void** automatically synchronized promise through #recorder
2288
2316
2289
2317
### uncheckOption
2290
2318
2319
+ [ Additional options] [ 37 ] for uncheck available as 3rd argument.
2320
+
2321
+ Examples:
2322
+
2323
+ ``` js
2324
+ // click on element at position
2325
+ I .uncheckOption (' Agree' , ' .signup' , { position: { x: 5 , y: 5 } })
2326
+ ```
2327
+
2328
+ > ⚠️ To avoid flakiness, option ` force: true ` is set by default
2329
+
2291
2330
Unselects a checkbox or radio button.
2292
2331
Element is located by label or name or CSS or XPath.
2293
2332
@@ -2305,10 +2344,7 @@ I.uncheckOption('agree', '//form');
2305
2344
- ` context ` ** ([ string] [ 9 ] ? | [ object] [ 6 ] )** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
2306
2345
- ` options `
2307
2346
2308
- Returns ** void** automatically synchronized promise through #recorder[ Additional options] [ 37 ] for uncheck available as 3rd argument.Examples:```js
2309
- // click on element at position
2310
- I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
2311
- ```> ⚠️ To avoid flakiness, option ` force: true ` is set by default
2347
+ Returns ** void** automatically synchronized promise through #recorder
2312
2348
2313
2349
### usePlaywrightTo
2314
2350
@@ -2328,7 +2364,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
2328
2364
#### Parameters
2329
2365
2330
2366
- ` description ` ** [ string] [ 9 ] ** used to show in logs.
2331
- - ` fn ` ** [ function] [ 21 ] ** async function that executed with Playwright helper as argumen
2367
+ - ` fn ` ** [ function] [ 21 ] ** async function that executed with Playwright helper as arguments
2332
2368
2333
2369
### wait
2334
2370
@@ -2532,6 +2568,8 @@ Returns **void** automatically synchronized promise through #recorder
2532
2568
2533
2569
### waitForVisible
2534
2570
2571
+ This method accepts [ React selectors] [ 43 ] .
2572
+
2535
2573
Waits for an element to become visible on a page (by default waits for 1sec).
2536
2574
Element can be located by CSS or XPath.
2537
2575
@@ -2544,7 +2582,7 @@ I.waitForVisible('#popup');
2544
2582
- ` locator ` ** ([ string] [ 9 ] | [ object] [ 6 ] )** element located by CSS|XPath|strict locator.
2545
2583
- ` sec ` ** [ number] [ 20 ] ** (optional, ` 1 ` by default) time in seconds to wait
2546
2584
2547
- Returns ** void** automatically synchronized promise through #recorderThis method accepts [ React selectors ] [ 43 ] .
2585
+ Returns ** void** automatically synchronized promise through #recorder
2548
2586
2549
2587
### waitInUrl
2550
2588
@@ -2673,9 +2711,9 @@ Returns **void** automatically synchronized promise through #recorder
2673
2711
2674
2712
[ 32 ] : https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
2675
2713
2676
- [ 33 ] : #fillfield
2714
+ [ 33 ] : https://github.com/GoogleChrome/puppeteer/issues/1313
2677
2715
2678
- [ 34 ] : https://github.com/GoogleChrome/puppeteer/issues/1313
2716
+ [ 34 ] : #fillfield
2679
2717
2680
2718
[ 35 ] : #click
2681
2719
0 commit comments