You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// retry 2 times if error with message 'Node not visible' happens
16
20
I.retry({
17
21
retries:2,
18
22
when:err=>err.message==='Node not visible'
19
23
}).seeElement('#user');
20
24
```
21
25
26
+
*`Scenario().injectDependencies` added to dynamically add objects into DI container by @Apshenkin. See [Dependency Injection section in PageObjects](https://codecept.io/pageobjects/#dependency-injection).
27
+
* Fixed using async/await functions inside `within`
28
+
*[WebDriverIO][Protractor][Puppeteer][Nightmare]**`waitUntilExists` deprecated** in favor of `waitForElement`
29
+
*[WebDriverIO][Protractor]**`waitForStalenessOf` deprecated** in favor of `waitForDetached`
Copy file name to clipboardExpand all lines: docs/helpers/Puppeteer.md
+34-27Lines changed: 34 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,18 @@ Requires `puppeteer` package to be installed.
10
10
11
11
This helper should be configured in codecept.json
12
12
13
-
-`url` - base url of website to be tested
14
-
-`show` (optional, default: false) - show Google Chrome window for debug.
15
-
-`disableScreenshots` (optional, default: false) - don't save screenshot on failure.
16
-
-`uniqueScreenshotNames` (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites.
13
+
-`url`: base url of website to be tested
14
+
-`show`: (optional, default: false) - show Google Chrome window for debug.
15
+
-`restart`: (optional, default: true) - restart browser between tests.
16
+
-`disableScreenshots`: (optional, default: false) - don't save screenshot on failure.
17
+
-`uniqueScreenshotNames`: (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites.
18
+
-`keepBrowserState`: (optional, default: false) - keep browser state between tests when `restart` is set to false.
19
+
-`keepCookies`: (optional, default: false) - keep cookies between tests when `restart` is set to false.
17
20
-`waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
18
21
-`waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
19
22
-`windowSize`: (optional) default window size. Set a dimension like `640x480`.
23
+
-`userAgent`: (optional) user-agent string.
24
+
-`manualStart`: (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
20
25
-`chrome`: (optional) pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). Example
21
26
22
27
```js
@@ -479,7 +484,7 @@ let hint = yield I.grabAttributeFrom('#tooltip', 'title');
479
484
Get JS log from browser.
480
485
481
486
```js
482
-
let logs =yieldI.grabBrowserLogs();
487
+
let logs =awaitI.grabBrowserLogs();
483
488
console.log(JSON.stringify(logs))
484
489
```
485
490
@@ -524,6 +529,14 @@ let postHTML = yield I.grabHTMLFrom('#post');
524
529
525
530
- `locator`
526
531
532
+
## grabNumberOfOpenTabs
533
+
534
+
Grab number of open tabs
535
+
536
+
```js
537
+
I.grabNumberOfOpenTabs();
538
+
```
539
+
527
540
## grabNumberOfVisibleElements
528
541
529
542
Grab number of visible elements by locator
@@ -546,16 +559,13 @@ await I.grabPopupText();
546
559
547
560
## grabSource
548
561
549
-
Checks that the current page contains the given string in its raw source code.
562
+
Retrieves page source and returns it to test.
563
+
Resumes test execution, so should be used inside an async function.
550
564
551
565
```js
552
-
I.seeInSource('<h1>Green eggs & ham</h1>');
566
+
let pageSource =awaitI.grabSource();
553
567
```
554
568
555
-
**Parameters**
556
-
557
-
- `text`
558
-
559
569
## grabTextFrom
560
570
561
571
Retrieves a text from an element located by CSS or XPath and returns it to test.
@@ -632,7 +642,7 @@ I.openNewTab();
632
642
## pressKey
633
643
634
644
Presses a key on a focused element.
635
-
Speical keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
645
+
Special keys like 'Enter', 'Control', [etc](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value)
636
646
will be replaced with corresponding unicode.
637
647
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
638
648
@@ -1026,6 +1036,18 @@ I.wait(2); // wait 2 secs
1026
1036
1027
1037
- `sec`
1028
1038
1039
+
## waitForDetached
1040
+
1041
+
Waits for an element to become not attached to the DOM on a page (by default waits for1sec).
1042
+
Element can be located by CSS or XPath.
1043
+
1044
+
I.waitForDetached('#popup');
1045
+
1046
+
**Parameters**
1047
+
1048
+
- `locator` element located by CSS|XPath|strict locator
1049
+
- `sec` time seconds to wait, 1 by default
1050
+
1029
1051
## waitForElement
1030
1052
1031
1053
Waits for element to be present on page (by default waits for1sec).
0 commit comments