@@ -508,6 +508,17 @@ Dismisses the active JavaScript popup, as created by window.alert|window.confirm
508508
509509### checkOption
510510
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+
511522Selects a checkbox or radio button.
512523Element is located by label or name or CSS or XPath.
513524
@@ -525,10 +536,7 @@ I.checkOption('agree', '//form');
525536- ` context ` ** ([ string] [ 9 ] ? | [ object] [ 6 ] )** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
526537- ` options `
527538
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
532540
533541### clearCookie
534542
@@ -592,13 +600,19 @@ I.click({css: 'nav a.login'});
592600
593601- ` locator ` ** ([ string] [ 9 ] | [ object] [ 6 ] )** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
594602- ` 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
598606
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+ ````
602616
603617Returns ** void** automatically synchronized promise through #recorder
604618
@@ -812,6 +826,13 @@ Returns **void** automatically synchronized promise through #recorder
812826
813827### dragAndDrop
814828
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+
815836Drag an item to a destination element.
816837
817838``` js
@@ -822,10 +843,7 @@ I.dragAndDrop('#dragHandle', '#container');
822843
823844- ` srcElement ` ** ([ string] [ 9 ] | [ object] [ 6 ] )** located by CSS|XPath|strict locator.
824845- ` 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.
829847
830848Returns ** void** automatically synchronized promise through #recorder
831849
@@ -860,8 +878,8 @@ Additional parameters of the function can be passed as an object argument:
860878I .executeScript (({x, y}) => x + y, {x, y});
861879```
862880
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.
865883
866884``` js
867885I .executeScript (([x , y ]) => x + y, [x, y]);
@@ -1020,6 +1038,8 @@ Returns **[Promise][22]<[boolean][26]>**
10201038
10211039### grabCookie
10221040
1041+ Returns cookie in JSON format. If name not passed returns all cookies for this domain.
1042+
10231043Gets a cookie object by name.
10241044If none provided gets all cookies.
10251045Resumes test execution, so ** should be used inside async function with ` await ` ** operator.
@@ -1033,7 +1053,7 @@ assert(cookie.value, '123456');
10331053
10341054- ` name ` ** [ string] [ 9 ] ?** cookie name.
10351055
1036- Returns ** any** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
1056+ Returns ** any** attribute value
10371057
10381058### grabCssPropertyFrom
10391059
@@ -1539,9 +1559,11 @@ I.openNewTab({ isMobile: true });
15391559
15401560### pressKey
15411561
1562+ _ Note:_ Shortcuts like ` 'Meta' ` + ` 'A' ` do not work on macOS ([ GoogleChrome/Puppeteer #1313 ] [ 33 ] ).
1563+
15421564Presses a key in the browser (on a focused element).
15431565
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 ] .
15451567
15461568``` js
15471569I .pressKey (' Backspace' );
@@ -1602,7 +1624,7 @@ Some of the supported key names are:
16021624
16031625- ` key ` ** ([ string] [ 9 ] | [ Array] [ 10 ] < ; [ string] [ 9 ] >)** key or array of keys to press.
16041626
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
16061628
16071629### pressKeyDown
16081630
@@ -1672,6 +1694,18 @@ Returns **any** Promise<void>
16721694
16731695### resizeWindow
16741696
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+
16751709Resize the current window to provided width and height.
16761710First parameter can be set to ` maximize ` .
16771711
@@ -1680,13 +1714,7 @@ First parameter can be set to `maximize`.
16801714- ` width ` ** [ number] [ 20 ] ** width in pixels or ` maximize ` .
16811715- ` height ` ** [ number] [ 20 ] ** height in pixels.
16821716
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
16901718
16911719### restartBrowser
16921720
@@ -2262,7 +2290,7 @@ I.switchToPreviousTab(2);
22622290
22632291Types out the given text into an active field.
22642292To 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.
22662294
22672295``` js
22682296// passing in a string
@@ -2288,6 +2316,17 @@ Returns **void** automatically synchronized promise through #recorder
22882316
22892317### uncheckOption
22902318
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+
22912330Unselects a checkbox or radio button.
22922331Element is located by label or name or CSS or XPath.
22932332
@@ -2305,10 +2344,7 @@ I.uncheckOption('agree', '//form');
23052344- ` context ` ** ([ string] [ 9 ] ? | [ object] [ 6 ] )** (optional, ` null ` by default) element located by CSS | XPath | strict locator.
23062345- ` options `
23072346
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
23122348
23132349### usePlaywrightTo
23142350
@@ -2328,7 +2364,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
23282364#### Parameters
23292365
23302366- ` 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
23322368
23332369### wait
23342370
@@ -2532,6 +2568,8 @@ Returns **void** automatically synchronized promise through #recorder
25322568
25332569### waitForVisible
25342570
2571+ This method accepts [ React selectors] [ 43 ] .
2572+
25352573Waits for an element to become visible on a page (by default waits for 1sec).
25362574Element can be located by CSS or XPath.
25372575
@@ -2544,7 +2582,7 @@ I.waitForVisible('#popup');
25442582- ` locator ` ** ([ string] [ 9 ] | [ object] [ 6 ] )** element located by CSS|XPath|strict locator.
25452583- ` sec ` ** [ number] [ 20 ] ** (optional, ` 1 ` by default) time in seconds to wait
25462584
2547- Returns ** void** automatically synchronized promise through #recorderThis method accepts [ React selectors ] [ 43 ] .
2585+ Returns ** void** automatically synchronized promise through #recorder
25482586
25492587### waitInUrl
25502588
@@ -2673,9 +2711,9 @@ Returns **void** automatically synchronized promise through #recorder
26732711
26742712[ 32 ] : https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
26752713
2676- [ 33 ] : #fillfield
2714+ [ 33 ] : https://github.com/GoogleChrome/puppeteer/issues/1313
26772715
2678- [ 34 ] : https://github.com/GoogleChrome/puppeteer/issues/1313
2716+ [ 34 ] : #fillfield
26792717
26802718[ 35 ] : #click
26812719
0 commit comments