codeceptjs 3.5.11 → 3.5.12-beta.2
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/README.md +3 -3
- package/docs/build/Appium.js +35 -35
- package/docs/build/Nightmare.js +50 -50
- package/docs/build/Playwright.js +100 -72
- package/docs/build/Protractor.js +59 -59
- package/docs/build/Puppeteer.js +96 -69
- package/docs/build/TestCafe.js +48 -48
- package/docs/build/WebDriver.js +223 -105
- package/docs/helpers/Playwright.md +15 -0
- package/docs/helpers/Puppeteer.md +15 -0
- package/docs/helpers/WebDriver.md +340 -266
- package/docs/locators.md +9 -1
- package/docs/webapi/waitForNumberOfTabs.mustache +9 -0
- package/docs/webdriver.md +52 -6
- package/lib/command/run-multiple.js +3 -1
- package/lib/command/run-workers.js +32 -1
- package/lib/command/workers/runTests.js +2 -2
- package/lib/css2xpath/js/css_to_xpath.js +20 -0
- package/lib/css2xpath/js/expression.js +23 -0
- package/lib/css2xpath/js/renderer.js +239 -0
- package/lib/helper/Playwright.js +21 -2
- package/lib/helper/Puppeteer.js +18 -0
- package/lib/helper/WebDriver.js +140 -31
- package/lib/locator.js +31 -4
- package/lib/plugin/retryFailedStep.js +5 -1
- package/lib/plugin/retryTo.js +2 -2
- package/package.json +24 -18
- package/typings/index.d.ts +9 -6
- package/typings/promiseBasedTypes.d.ts +84 -1
- package/typings/types.d.ts +102 -2
|
@@ -16,36 +16,45 @@ manipulate browser using Selenium WebDriver or PhantomJS.
|
|
|
16
16
|
|
|
17
17
|
WebDriver requires Selenium Server and ChromeDriver/GeckoDriver to be installed. Those tools can be easily installed via NPM. Please check [Testing with WebDriver][2] for more details.
|
|
18
18
|
|
|
19
|
+
With the release of WebdriverIO version v8.14.0, and onwards, all driver management hassles are now a thing of the past 🙌. Read more [here][3].
|
|
20
|
+
One of the significant advantages of this update is that you can now get rid of any driver services you previously had to manage, such as
|
|
21
|
+
`wdio-chromedriver-service`, `wdio-geckodriver-service`, `wdio-edgedriver-service`, `wdio-safaridriver-service`, and even `@wdio/selenium-standalone-service`.
|
|
22
|
+
|
|
23
|
+
For those who require custom driver options, fear not; WebDriver Helper allows you to pass in driver options through custom WebDriver configuration.
|
|
24
|
+
If you have a custom grid, use a cloud service, or prefer to run your own driver, there's no need to worry since WebDriver Helper will only start a driver when there are no other connection information settings like hostname or port specified.
|
|
25
|
+
|
|
19
26
|
|
|
20
27
|
|
|
21
28
|
## Configuration
|
|
22
29
|
|
|
23
30
|
This helper should be configured in codecept.conf.js
|
|
24
31
|
|
|
25
|
-
Type: [object][
|
|
32
|
+
Type: [object][17]
|
|
26
33
|
|
|
27
34
|
### Properties
|
|
28
35
|
|
|
29
|
-
- `url` **[string][
|
|
30
|
-
- `browser` **[string][
|
|
31
|
-
- `basicAuth` **[string][
|
|
32
|
-
- `host` **[string][
|
|
33
|
-
- `port` **[number][
|
|
34
|
-
- `protocol` **[string][
|
|
35
|
-
- `path` **[string][
|
|
36
|
-
- `restart` **[boolean][
|
|
37
|
-
- `smartWait` **([boolean][
|
|
38
|
-
- `disableScreenshots` **[boolean][
|
|
39
|
-
- `fullPageScreenshots` **[boolean][
|
|
40
|
-
- `uniqueScreenshotNames` **[boolean][
|
|
41
|
-
- `keepBrowserState` **[boolean][
|
|
42
|
-
- `keepCookies` **[boolean][
|
|
43
|
-
- `windowSize` **[string][
|
|
44
|
-
- `waitForTimeout` **[number][
|
|
45
|
-
- `desiredCapabilities` **[object][
|
|
46
|
-
- `manualStart` **[boolean][
|
|
47
|
-
- `timeouts` **[object][
|
|
48
|
-
- `highlightElement` **[boolean][
|
|
36
|
+
- `url` **[string][18]** base url of website to be tested.
|
|
37
|
+
- `browser` **[string][18]** Browser in which to perform testing.
|
|
38
|
+
- `basicAuth` **[string][18]?** (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
39
|
+
- `host` **[string][18]?** WebDriver host to connect.
|
|
40
|
+
- `port` **[number][23]?** WebDriver port to connect.
|
|
41
|
+
- `protocol` **[string][18]?** protocol for WebDriver server.
|
|
42
|
+
- `path` **[string][18]?** path to WebDriver server.
|
|
43
|
+
- `restart` **[boolean][33]?** restart browser between tests.
|
|
44
|
+
- `smartWait` **([boolean][33] | [number][23])?** **enables [SmartWait][37]**; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000.
|
|
45
|
+
- `disableScreenshots` **[boolean][33]?** don't save screenshots on failure.
|
|
46
|
+
- `fullPageScreenshots` **[boolean][33]?** (optional - make full page screenshots on failure.
|
|
47
|
+
- `uniqueScreenshotNames` **[boolean][33]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
48
|
+
- `keepBrowserState` **[boolean][33]?** keep browser state between tests when `restart` is set to false.
|
|
49
|
+
- `keepCookies` **[boolean][33]?** keep cookies between tests when `restart` set to false.
|
|
50
|
+
- `windowSize` **[string][18]?** default window size. Set to `maximize` or a dimension in the format `640x480`.
|
|
51
|
+
- `waitForTimeout` **[number][23]?** sets default wait time in _ms_ for all `wait*` functions.
|
|
52
|
+
- `desiredCapabilities` **[object][17]?** Selenium's [desired capabilities][7].
|
|
53
|
+
- `manualStart` **[boolean][33]?** do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
54
|
+
- `timeouts` **[object][17]?** [WebDriver timeouts][38] defined as hash.
|
|
55
|
+
- `highlightElement` **[boolean][33]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
56
|
+
- `logLevel` **[string][18]?** level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: [https://webdriver.io/docs/configuration/#loglevel][39]
|
|
57
|
+
- `devtoolsProtocol` **[boolean][33]?** enable devtools protocol. Default: false. More info: [https://webdriver.io/docs/automationProtocols/#devtools-protocol][40].
|
|
49
58
|
|
|
50
59
|
|
|
51
60
|
|
|
@@ -68,6 +77,27 @@ Example:
|
|
|
68
77
|
}
|
|
69
78
|
```
|
|
70
79
|
|
|
80
|
+
Testing Chrome locally is now more convenient than ever. You can define a browser channel, and WebDriver Helper will take care of downloading the specified browser version for you.
|
|
81
|
+
For example:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
{
|
|
85
|
+
helpers: {
|
|
86
|
+
WebDriver : {
|
|
87
|
+
smartWait: 5000,
|
|
88
|
+
browser: "chrome",
|
|
89
|
+
browserVersion: '116.0.5793.0', // or 'stable', 'beta', 'dev' or 'canary'
|
|
90
|
+
restart: false,
|
|
91
|
+
windowSize: "maximize",
|
|
92
|
+
timeouts: {
|
|
93
|
+
"script": 60000,
|
|
94
|
+
"page load": 10000
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
71
101
|
Example with basic authentication
|
|
72
102
|
|
|
73
103
|
```js
|
|
@@ -89,7 +119,7 @@ Example with basic authentication
|
|
|
89
119
|
```
|
|
90
120
|
|
|
91
121
|
Additional configuration params can be used from [webdriverio
|
|
92
|
-
website][
|
|
122
|
+
website][4].
|
|
93
123
|
|
|
94
124
|
### Headless Chrome
|
|
95
125
|
|
|
@@ -109,9 +139,28 @@ website][3].
|
|
|
109
139
|
}
|
|
110
140
|
```
|
|
111
141
|
|
|
142
|
+
### Running with devtools protocol
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
{
|
|
146
|
+
helpers: {
|
|
147
|
+
WebDriver : {
|
|
148
|
+
url: "http://localhost",
|
|
149
|
+
browser: "chrome",
|
|
150
|
+
devtoolsProtocol: true,
|
|
151
|
+
desiredCapabilities: {
|
|
152
|
+
chromeOptions: {
|
|
153
|
+
args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
112
161
|
### Internet Explorer
|
|
113
162
|
|
|
114
|
-
Additional configuration params can be used from [IE options][
|
|
163
|
+
Additional configuration params can be used from [IE options][5]
|
|
115
164
|
|
|
116
165
|
```js
|
|
117
166
|
{
|
|
@@ -133,7 +182,7 @@ Additional configuration params can be used from [IE options][4]
|
|
|
133
182
|
|
|
134
183
|
### Selenoid Options
|
|
135
184
|
|
|
136
|
-
[Selenoid][
|
|
185
|
+
[Selenoid][6] is a modern way to run Selenium inside Docker containers.
|
|
137
186
|
Selenoid is easy to set up and provides more features than original Selenium Server. Use `selenoidOptions` to set Selenoid capabilities
|
|
138
187
|
|
|
139
188
|
```js
|
|
@@ -199,13 +248,13 @@ For example,
|
|
|
199
248
|
}
|
|
200
249
|
```
|
|
201
250
|
|
|
202
|
-
Please refer to [Selenium - Proxy Object][
|
|
251
|
+
Please refer to [Selenium - Proxy Object][7] for more
|
|
203
252
|
information.
|
|
204
253
|
|
|
205
254
|
### Cloud Providers
|
|
206
255
|
|
|
207
256
|
WebDriver makes it possible to execute tests against services like `Sauce Labs` `BrowserStack` `TestingBot`
|
|
208
|
-
Check out their documentation on [available parameters][
|
|
257
|
+
Check out their documentation on [available parameters][8]
|
|
209
258
|
|
|
210
259
|
Connecting to `BrowserStack` and `Sauce Labs` is simple. All you need to do
|
|
211
260
|
is set the `user` and `key` parameters. WebDriver automatically know which
|
|
@@ -254,9 +303,9 @@ plugins: {
|
|
|
254
303
|
}
|
|
255
304
|
```
|
|
256
305
|
|
|
257
|
-
See [complete reference on webdriver.io][
|
|
306
|
+
See [complete reference on webdriver.io][9].
|
|
258
307
|
|
|
259
|
-
> Alternatively, use [codeceptjs-saucehelper][
|
|
308
|
+
> Alternatively, use [codeceptjs-saucehelper][10] for better reporting.
|
|
260
309
|
|
|
261
310
|
#### BrowserStack
|
|
262
311
|
|
|
@@ -280,13 +329,13 @@ plugins: {
|
|
|
280
329
|
}
|
|
281
330
|
```
|
|
282
331
|
|
|
283
|
-
See [complete reference on webdriver.io][
|
|
332
|
+
See [complete reference on webdriver.io][11].
|
|
284
333
|
|
|
285
|
-
> Alternatively, use [codeceptjs-bshelper][
|
|
334
|
+
> Alternatively, use [codeceptjs-bshelper][12] for better reporting.
|
|
286
335
|
|
|
287
336
|
#### TestingBot
|
|
288
337
|
|
|
289
|
-
> **Recommended**: use official [TestingBot Helper][
|
|
338
|
+
> **Recommended**: use official [TestingBot Helper][13].
|
|
290
339
|
|
|
291
340
|
Alternatively, TestingBot can be configured via wdio service, which should be installed additionally:
|
|
292
341
|
|
|
@@ -308,20 +357,20 @@ plugins: {
|
|
|
308
357
|
}
|
|
309
358
|
```
|
|
310
359
|
|
|
311
|
-
See [complete reference on webdriver.io][
|
|
360
|
+
See [complete reference on webdriver.io][14].
|
|
312
361
|
|
|
313
362
|
#### Applitools
|
|
314
363
|
|
|
315
364
|
Visual testing via Applitools service
|
|
316
365
|
|
|
317
|
-
> Use [CodeceptJS Applitools Helper][
|
|
366
|
+
> Use [CodeceptJS Applitools Helper][15] with Applitools wdio service.
|
|
318
367
|
|
|
319
368
|
### Multiremote Capabilities
|
|
320
369
|
|
|
321
370
|
This is a work in progress but you can control two browsers at a time right out of the box.
|
|
322
371
|
Individual control is something that is planned for a later version.
|
|
323
372
|
|
|
324
|
-
Here is the [webdriverio docs][
|
|
373
|
+
Here is the [webdriverio docs][16] on the subject
|
|
325
374
|
|
|
326
375
|
```js
|
|
327
376
|
{
|
|
@@ -365,7 +414,7 @@ Check if locator is type of "Shadow"
|
|
|
365
414
|
|
|
366
415
|
#### Parameters
|
|
367
416
|
|
|
368
|
-
- `locator` **[object][
|
|
417
|
+
- `locator` **[object][17]**
|
|
369
418
|
|
|
370
419
|
### _locate
|
|
371
420
|
|
|
@@ -378,7 +427,7 @@ this.helpers['WebDriver']._locate({name: 'password'}).then //...
|
|
|
378
427
|
|
|
379
428
|
#### Parameters
|
|
380
429
|
|
|
381
|
-
- `locator` **([string][
|
|
430
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
382
431
|
- `smartWait`
|
|
383
432
|
|
|
384
433
|
### _locateCheckable
|
|
@@ -391,7 +440,7 @@ this.helpers['WebDriver']._locateCheckable('I agree with terms and conditions').
|
|
|
391
440
|
|
|
392
441
|
#### Parameters
|
|
393
442
|
|
|
394
|
-
- `locator` **([string][
|
|
443
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
395
444
|
|
|
396
445
|
### _locateClickable
|
|
397
446
|
|
|
@@ -404,7 +453,7 @@ const els = await this.helpers.WebDriver._locateClickable('Next page', '.pages')
|
|
|
404
453
|
|
|
405
454
|
#### Parameters
|
|
406
455
|
|
|
407
|
-
- `locator` **([string][
|
|
456
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
408
457
|
- `context`
|
|
409
458
|
|
|
410
459
|
### _locateFields
|
|
@@ -417,7 +466,7 @@ this.helpers['WebDriver']._locateFields('Your email').then // ...
|
|
|
417
466
|
|
|
418
467
|
#### Parameters
|
|
419
468
|
|
|
420
|
-
- `locator` **([string][
|
|
469
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
421
470
|
|
|
422
471
|
### _locateShadow
|
|
423
472
|
|
|
@@ -425,7 +474,7 @@ Locate Element within the Shadow Dom
|
|
|
425
474
|
|
|
426
475
|
#### Parameters
|
|
427
476
|
|
|
428
|
-
- `locator` **[object][
|
|
477
|
+
- `locator` **[object][17]**
|
|
429
478
|
|
|
430
479
|
### _smartWait
|
|
431
480
|
|
|
@@ -433,13 +482,13 @@ Smart Wait to locate an element
|
|
|
433
482
|
|
|
434
483
|
#### Parameters
|
|
435
484
|
|
|
436
|
-
- `locator` **[object][
|
|
485
|
+
- `locator` **[object][17]**
|
|
437
486
|
|
|
438
487
|
### acceptPopup
|
|
439
488
|
|
|
440
489
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
441
490
|
Don't confuse popups with modal windows, as created by [various
|
|
442
|
-
libraries][
|
|
491
|
+
libraries][19].
|
|
443
492
|
|
|
444
493
|
### amOnPage
|
|
445
494
|
|
|
@@ -454,7 +503,7 @@ I.amOnPage('/login'); // opens a login page
|
|
|
454
503
|
|
|
455
504
|
#### Parameters
|
|
456
505
|
|
|
457
|
-
- `url` **[string][
|
|
506
|
+
- `url` **[string][18]** url path or global url.
|
|
458
507
|
|
|
459
508
|
Returns **void** automatically synchronized promise through #recorder
|
|
460
509
|
|
|
@@ -471,8 +520,8 @@ I.appendField('password', secret('123456'));
|
|
|
471
520
|
|
|
472
521
|
#### Parameters
|
|
473
522
|
|
|
474
|
-
- `field` **([string][
|
|
475
|
-
- `value` **[string][
|
|
523
|
+
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator
|
|
524
|
+
- `value` **[string][18]** text value to append.
|
|
476
525
|
|
|
477
526
|
Returns **void** automatically synchronized promise through #recorder
|
|
478
527
|
|
|
@@ -495,15 +544,15 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
495
544
|
|
|
496
545
|
#### Parameters
|
|
497
546
|
|
|
498
|
-
- `locator` **([string][
|
|
499
|
-
- `pathToFile` **[string][
|
|
547
|
+
- `locator` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
548
|
+
- `pathToFile` **[string][18]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
500
549
|
|
|
501
550
|
Returns **void** automatically synchronized promise through #recorder
|
|
502
551
|
|
|
503
552
|
### blur
|
|
504
553
|
|
|
505
554
|
Remove focus from a text input, button, etc.
|
|
506
|
-
Calls [blur][
|
|
555
|
+
Calls [blur][20] on the element.
|
|
507
556
|
|
|
508
557
|
Examples:
|
|
509
558
|
|
|
@@ -520,8 +569,8 @@ I.dontSee('#add-to-cart-btn');
|
|
|
520
569
|
|
|
521
570
|
#### Parameters
|
|
522
571
|
|
|
523
|
-
- `locator` **([string][
|
|
524
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
572
|
+
- `locator` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
573
|
+
- `options` **any?** Playwright only: [Additional options][21] for available options object as 2nd argument.
|
|
525
574
|
|
|
526
575
|
Returns **void** automatically synchronized promise through #recorder
|
|
527
576
|
|
|
@@ -545,8 +594,8 @@ I.checkOption('agree', '//form');
|
|
|
545
594
|
|
|
546
595
|
#### Parameters
|
|
547
596
|
|
|
548
|
-
- `field` **([string][
|
|
549
|
-
- `context` **([string][
|
|
597
|
+
- `field` **([string][18] | [object][17])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
598
|
+
- `context` **([string][18]? | [object][17])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
550
599
|
|
|
551
600
|
Returns **void** automatically synchronized promise through #recorder
|
|
552
601
|
|
|
@@ -562,7 +611,7 @@ I.clearCookie('test'); // Playwright currently doesn't support clear a particula
|
|
|
562
611
|
|
|
563
612
|
#### Parameters
|
|
564
613
|
|
|
565
|
-
- `cookie` **[string][
|
|
614
|
+
- `cookie` **[string][18]?** (optional, `null` by default) cookie name
|
|
566
615
|
|
|
567
616
|
### clearField
|
|
568
617
|
|
|
@@ -577,7 +626,7 @@ I.clearField('#email');
|
|
|
577
626
|
#### Parameters
|
|
578
627
|
|
|
579
628
|
- `field`
|
|
580
|
-
- `editable` **([string][
|
|
629
|
+
- `editable` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
581
630
|
|
|
582
631
|
Returns **void** automatically synchronized promise through #recorder.
|
|
583
632
|
|
|
@@ -607,8 +656,8 @@ I.click({css: 'nav a.login'});
|
|
|
607
656
|
|
|
608
657
|
#### Parameters
|
|
609
658
|
|
|
610
|
-
- `locator` **([string][
|
|
611
|
-
- `context` **([string][
|
|
659
|
+
- `locator` **([string][18] | [object][17])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
660
|
+
- `context` **([string][18]? | [object][17] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
612
661
|
|
|
613
662
|
Returns **void** automatically synchronized promise through #recorder
|
|
614
663
|
|
|
@@ -638,7 +687,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
638
687
|
|
|
639
688
|
### defineTimeout
|
|
640
689
|
|
|
641
|
-
Set [WebDriver timeouts][
|
|
690
|
+
Set [WebDriver timeouts][22] in realtime.
|
|
642
691
|
|
|
643
692
|
Timeouts are expected to be passed as object:
|
|
644
693
|
|
|
@@ -663,8 +712,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
663
712
|
|
|
664
713
|
#### Parameters
|
|
665
714
|
|
|
666
|
-
- `text` **[string][
|
|
667
|
-
- `context` **([string][
|
|
715
|
+
- `text` **[string][18]** which is not present.
|
|
716
|
+
- `context` **([string][18] | [object][17])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
668
717
|
|
|
669
718
|
Returns **void** automatically synchronized promise through #recorder
|
|
670
719
|
|
|
@@ -685,7 +734,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
685
734
|
|
|
686
735
|
#### Parameters
|
|
687
736
|
|
|
688
|
-
- `field` **([string][
|
|
737
|
+
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
689
738
|
|
|
690
739
|
Returns **void** automatically synchronized promise through #recorder
|
|
691
740
|
|
|
@@ -699,7 +748,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
699
748
|
|
|
700
749
|
#### Parameters
|
|
701
750
|
|
|
702
|
-
- `name` **[string][
|
|
751
|
+
- `name` **[string][18]** cookie name.
|
|
703
752
|
|
|
704
753
|
Returns **void** automatically synchronized promise through #recorder
|
|
705
754
|
|
|
@@ -715,7 +764,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
715
764
|
|
|
716
765
|
#### Parameters
|
|
717
766
|
|
|
718
|
-
- `url` **[string][
|
|
767
|
+
- `url` **[string][18]** value to check.
|
|
719
768
|
|
|
720
769
|
Returns **void** automatically synchronized promise through #recorder
|
|
721
770
|
|
|
@@ -729,7 +778,7 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
729
778
|
|
|
730
779
|
#### Parameters
|
|
731
780
|
|
|
732
|
-
- `locator` **([string][
|
|
781
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|Strict locator.
|
|
733
782
|
|
|
734
783
|
Returns **void** automatically synchronized promise through #recorder
|
|
735
784
|
|
|
@@ -747,7 +796,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
747
796
|
|
|
748
797
|
#### Parameters
|
|
749
798
|
|
|
750
|
-
- `locator` **([string][
|
|
799
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|Strict locator.
|
|
751
800
|
|
|
752
801
|
Returns **void** automatically synchronized promise through #recorder
|
|
753
802
|
|
|
@@ -757,7 +806,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
757
806
|
|
|
758
807
|
#### Parameters
|
|
759
808
|
|
|
760
|
-
- `url` **[string][
|
|
809
|
+
- `url` **[string][18]** value to check.
|
|
761
810
|
|
|
762
811
|
Returns **void** automatically synchronized promise through #recorder
|
|
763
812
|
|
|
@@ -773,8 +822,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
773
822
|
|
|
774
823
|
#### Parameters
|
|
775
824
|
|
|
776
|
-
- `field` **([string][
|
|
777
|
-
- `value` **([string][
|
|
825
|
+
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
826
|
+
- `value` **([string][18] | [object][17])** value to check.
|
|
778
827
|
|
|
779
828
|
Returns **void** automatically synchronized promise through #recorder
|
|
780
829
|
|
|
@@ -789,7 +838,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
789
838
|
#### Parameters
|
|
790
839
|
|
|
791
840
|
- `text`
|
|
792
|
-
- `value` **[string][
|
|
841
|
+
- `value` **[string][18]** to check.
|
|
793
842
|
|
|
794
843
|
Returns **void** automatically synchronized promise through #recorder
|
|
795
844
|
|
|
@@ -803,7 +852,7 @@ I.dontSeeInTitle('Error');
|
|
|
803
852
|
|
|
804
853
|
#### Parameters
|
|
805
854
|
|
|
806
|
-
- `text` **[string][
|
|
855
|
+
- `text` **[string][18]** value to check.
|
|
807
856
|
|
|
808
857
|
Returns **void** automatically synchronized promise through #recorder
|
|
809
858
|
|
|
@@ -821,8 +870,8 @@ I.doubleClick('.btn.edit');
|
|
|
821
870
|
|
|
822
871
|
#### Parameters
|
|
823
872
|
|
|
824
|
-
- `locator` **([string][
|
|
825
|
-
- `context` **([string][
|
|
873
|
+
- `locator` **([string][18] | [object][17])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
874
|
+
- `context` **([string][18]? | [object][17])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
826
875
|
|
|
827
876
|
Returns **void** automatically synchronized promise through #recorder
|
|
828
877
|
|
|
@@ -841,8 +890,8 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
841
890
|
|
|
842
891
|
#### Parameters
|
|
843
892
|
|
|
844
|
-
- `srcElement` **([string][
|
|
845
|
-
- `destElement` **([string][
|
|
893
|
+
- `srcElement` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
894
|
+
- `destElement` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
846
895
|
|
|
847
896
|
Returns **void** automatically synchronized promise through #recorder
|
|
848
897
|
|
|
@@ -858,8 +907,8 @@ I.dragSlider('#slider', -70);
|
|
|
858
907
|
|
|
859
908
|
#### Parameters
|
|
860
909
|
|
|
861
|
-
- `locator` **([string][
|
|
862
|
-
- `offsetX` **[number][
|
|
910
|
+
- `locator` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
911
|
+
- `offsetX` **[number][23]** position to drag.
|
|
863
912
|
|
|
864
913
|
Returns **void** automatically synchronized promise through #recorder
|
|
865
914
|
|
|
@@ -868,7 +917,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
868
917
|
Executes async script on page.
|
|
869
918
|
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
870
919
|
|
|
871
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][
|
|
920
|
+
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][24].
|
|
872
921
|
|
|
873
922
|
```js
|
|
874
923
|
I.executeAsyncScript(function(done) {
|
|
@@ -889,13 +938,13 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
889
938
|
#### Parameters
|
|
890
939
|
|
|
891
940
|
- `args` **...any** to be passed to function.
|
|
892
|
-
- `fn` **([string][
|
|
941
|
+
- `fn` **([string][18] | [function][25])** function to be executed in browser context.
|
|
893
942
|
|
|
894
|
-
Returns **[Promise][
|
|
943
|
+
Returns **[Promise][26]<any>** script return value
|
|
895
944
|
|
|
896
945
|
### executeScript
|
|
897
946
|
|
|
898
|
-
Wraps [execute][
|
|
947
|
+
Wraps [execute][27] command.
|
|
899
948
|
|
|
900
949
|
Executes sync script on a page.
|
|
901
950
|
Pass arguments to function as additional parameters.
|
|
@@ -924,9 +973,9 @@ let date = await I.executeScript(function(el) {
|
|
|
924
973
|
#### Parameters
|
|
925
974
|
|
|
926
975
|
- `args` **...any** to be passed to function.
|
|
927
|
-
- `fn` **([string][
|
|
976
|
+
- `fn` **([string][18] | [function][25])** function to be executed in browser context.
|
|
928
977
|
|
|
929
|
-
Returns **[Promise][
|
|
978
|
+
Returns **[Promise][26]<any>** script return value
|
|
930
979
|
|
|
931
980
|
### fillField
|
|
932
981
|
|
|
@@ -946,8 +995,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
946
995
|
|
|
947
996
|
#### Parameters
|
|
948
997
|
|
|
949
|
-
- `field` **([string][
|
|
950
|
-
- `value` **([string][
|
|
998
|
+
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
999
|
+
- `value` **([string][18] | [object][17])** text value to fill.
|
|
951
1000
|
|
|
952
1001
|
Returns **void** automatically synchronized promise through #recorder
|
|
953
1002
|
|
|
@@ -958,7 +1007,7 @@ This action supports [React locators](https://codecept.io/react#locators)
|
|
|
958
1007
|
|
|
959
1008
|
### focus
|
|
960
1009
|
|
|
961
|
-
Calls [focus][
|
|
1010
|
+
Calls [focus][20] on the matching element.
|
|
962
1011
|
|
|
963
1012
|
Examples:
|
|
964
1013
|
|
|
@@ -970,8 +1019,8 @@ I.see('#add-to-cart-bnt');
|
|
|
970
1019
|
|
|
971
1020
|
#### Parameters
|
|
972
1021
|
|
|
973
|
-
- `locator` **([string][
|
|
974
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
1022
|
+
- `locator` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
1023
|
+
- `options` **any?** Playwright only: [Additional options][28] for available options object as 2nd argument.
|
|
975
1024
|
|
|
976
1025
|
Returns **void** automatically synchronized promise through #recorder
|
|
977
1026
|
|
|
@@ -1004,8 +1053,8 @@ I.forceClick({css: 'nav a.login'});
|
|
|
1004
1053
|
|
|
1005
1054
|
#### Parameters
|
|
1006
1055
|
|
|
1007
|
-
- `locator` **([string][
|
|
1008
|
-
- `context` **([string][
|
|
1056
|
+
- `locator` **([string][18] | [object][17])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1057
|
+
- `context` **([string][18]? | [object][17])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1009
1058
|
|
|
1010
1059
|
Returns **void** automatically synchronized promise through #recorder
|
|
1011
1060
|
|
|
@@ -1032,8 +1081,8 @@ I.forceRightClick('Menu');
|
|
|
1032
1081
|
|
|
1033
1082
|
#### Parameters
|
|
1034
1083
|
|
|
1035
|
-
- `locator` **([string][
|
|
1036
|
-
- `context` **([string][
|
|
1084
|
+
- `locator` **([string][18] | [object][17])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1085
|
+
- `context` **([string][18]? | [object][17])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1037
1086
|
|
|
1038
1087
|
Returns **void** automatically synchronized promise through #recorder
|
|
1039
1088
|
|
|
@@ -1050,7 +1099,7 @@ Useful for referencing a specific handle when calling `I.switchToWindow(handle)`
|
|
|
1050
1099
|
const windows = await I.grabAllWindowHandles();
|
|
1051
1100
|
```
|
|
1052
1101
|
|
|
1053
|
-
Returns **[Promise][
|
|
1102
|
+
Returns **[Promise][26]<[Array][29]<[string][18]>>**
|
|
1054
1103
|
|
|
1055
1104
|
### grabAttributeFrom
|
|
1056
1105
|
|
|
@@ -1064,10 +1113,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
1064
1113
|
|
|
1065
1114
|
#### Parameters
|
|
1066
1115
|
|
|
1067
|
-
- `locator` **([string][
|
|
1068
|
-
- `attr` **[string][
|
|
1116
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1117
|
+
- `attr` **[string][18]** attribute name.
|
|
1069
1118
|
|
|
1070
|
-
Returns **[Promise][
|
|
1119
|
+
Returns **[Promise][26]<[string][18]>** attribute value
|
|
1071
1120
|
|
|
1072
1121
|
### grabAttributeFromAll
|
|
1073
1122
|
|
|
@@ -1080,10 +1129,10 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
1080
1129
|
|
|
1081
1130
|
#### Parameters
|
|
1082
1131
|
|
|
1083
|
-
- `locator` **([string][
|
|
1084
|
-
- `attr` **[string][
|
|
1132
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1133
|
+
- `attr` **[string][18]** attribute name.
|
|
1085
1134
|
|
|
1086
|
-
Returns **[Promise][
|
|
1135
|
+
Returns **[Promise][26]<[Array][29]<[string][18]>>** attribute value
|
|
1087
1136
|
|
|
1088
1137
|
### grabBrowserLogs
|
|
1089
1138
|
|
|
@@ -1095,7 +1144,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
1095
1144
|
console.log(JSON.stringify(logs))
|
|
1096
1145
|
```
|
|
1097
1146
|
|
|
1098
|
-
Returns **([Promise][
|
|
1147
|
+
Returns **([Promise][26]<[Array][29]<[object][17]>> | [undefined][30])** all browser logs
|
|
1099
1148
|
|
|
1100
1149
|
### grabCookie
|
|
1101
1150
|
|
|
@@ -1110,7 +1159,7 @@ assert(cookie.value, '123456');
|
|
|
1110
1159
|
|
|
1111
1160
|
#### Parameters
|
|
1112
1161
|
|
|
1113
|
-
- `name` **[string][
|
|
1162
|
+
- `name` **[string][18]?** cookie name.
|
|
1114
1163
|
|
|
1115
1164
|
Returns **any** attribute value
|
|
1116
1165
|
|
|
@@ -1126,10 +1175,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
1126
1175
|
|
|
1127
1176
|
#### Parameters
|
|
1128
1177
|
|
|
1129
|
-
- `locator` **([string][
|
|
1130
|
-
- `cssProperty` **[string][
|
|
1178
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1179
|
+
- `cssProperty` **[string][18]** CSS property name.
|
|
1131
1180
|
|
|
1132
|
-
Returns **[Promise][
|
|
1181
|
+
Returns **[Promise][26]<[string][18]>** CSS value
|
|
1133
1182
|
|
|
1134
1183
|
### grabCssPropertyFromAll
|
|
1135
1184
|
|
|
@@ -1142,10 +1191,10 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1142
1191
|
|
|
1143
1192
|
#### Parameters
|
|
1144
1193
|
|
|
1145
|
-
- `locator` **([string][
|
|
1146
|
-
- `cssProperty` **[string][
|
|
1194
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1195
|
+
- `cssProperty` **[string][18]** CSS property name.
|
|
1147
1196
|
|
|
1148
|
-
Returns **[Promise][
|
|
1197
|
+
Returns **[Promise][26]<[Array][29]<[string][18]>>** CSS value
|
|
1149
1198
|
|
|
1150
1199
|
### grabCurrentUrl
|
|
1151
1200
|
|
|
@@ -1157,7 +1206,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1157
1206
|
console.log(`Current URL is [${url}]`);
|
|
1158
1207
|
```
|
|
1159
1208
|
|
|
1160
|
-
Returns **[Promise][
|
|
1209
|
+
Returns **[Promise][26]<[string][18]>** current URL
|
|
1161
1210
|
|
|
1162
1211
|
### grabCurrentWindowHandle
|
|
1163
1212
|
|
|
@@ -1168,7 +1217,7 @@ Useful for referencing it when calling `I.switchToWindow(handle)`
|
|
|
1168
1217
|
const window = await I.grabCurrentWindowHandle();
|
|
1169
1218
|
```
|
|
1170
1219
|
|
|
1171
|
-
Returns **[Promise][
|
|
1220
|
+
Returns **[Promise][26]<[string][18]>**
|
|
1172
1221
|
|
|
1173
1222
|
### grabElementBoundingRect
|
|
1174
1223
|
|
|
@@ -1192,14 +1241,16 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1192
1241
|
|
|
1193
1242
|
#### Parameters
|
|
1194
1243
|
|
|
1195
|
-
- `locator` **([string][
|
|
1244
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1196
1245
|
- `prop`
|
|
1197
|
-
- `elementSize` **[string][
|
|
1246
|
+
- `elementSize` **[string][18]?** x, y, width or height of the given element.
|
|
1198
1247
|
|
|
1199
|
-
Returns **([Promise][
|
|
1248
|
+
Returns **([Promise][26]<DOMRect> | [Promise][26]<[number][23]>)** Element bounding rectangle
|
|
1200
1249
|
|
|
1201
1250
|
### grabGeoLocation
|
|
1202
1251
|
|
|
1252
|
+
This method is **deprecated**.
|
|
1253
|
+
|
|
1203
1254
|
Return the current geo location
|
|
1204
1255
|
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1205
1256
|
|
|
@@ -1207,7 +1258,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1207
1258
|
let geoLocation = await I.grabGeoLocation();
|
|
1208
1259
|
```
|
|
1209
1260
|
|
|
1210
|
-
Returns **[Promise][
|
|
1261
|
+
Returns **[Promise][26]<{latitude: [number][23], longitude: [number][23], altitude: [number][23]}>**
|
|
1211
1262
|
|
|
1212
1263
|
### grabHTMLFrom
|
|
1213
1264
|
|
|
@@ -1222,9 +1273,9 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1222
1273
|
#### Parameters
|
|
1223
1274
|
|
|
1224
1275
|
- `locator`
|
|
1225
|
-
- `element` **([string][
|
|
1276
|
+
- `element` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1226
1277
|
|
|
1227
|
-
Returns **[Promise][
|
|
1278
|
+
Returns **[Promise][26]<[string][18]>** HTML code for an element
|
|
1228
1279
|
|
|
1229
1280
|
### grabHTMLFromAll
|
|
1230
1281
|
|
|
@@ -1238,9 +1289,9 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1238
1289
|
#### Parameters
|
|
1239
1290
|
|
|
1240
1291
|
- `locator`
|
|
1241
|
-
- `element` **([string][
|
|
1292
|
+
- `element` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1242
1293
|
|
|
1243
|
-
Returns **[Promise][
|
|
1294
|
+
Returns **[Promise][26]<[Array][29]<[string][18]>>** HTML code for an element
|
|
1244
1295
|
|
|
1245
1296
|
### grabNumberOfOpenTabs
|
|
1246
1297
|
|
|
@@ -1251,7 +1302,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1251
1302
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1252
1303
|
```
|
|
1253
1304
|
|
|
1254
|
-
Returns **[Promise][
|
|
1305
|
+
Returns **[Promise][26]<[number][23]>** number of open tabs
|
|
1255
1306
|
|
|
1256
1307
|
### grabNumberOfVisibleElements
|
|
1257
1308
|
|
|
@@ -1264,9 +1315,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1264
1315
|
|
|
1265
1316
|
#### Parameters
|
|
1266
1317
|
|
|
1267
|
-
- `locator` **([string][
|
|
1318
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1268
1319
|
|
|
1269
|
-
Returns **[Promise][
|
|
1320
|
+
Returns **[Promise][26]<[number][23]>** number of visible elements
|
|
1270
1321
|
|
|
1271
1322
|
### grabPageScrollPosition
|
|
1272
1323
|
|
|
@@ -1277,7 +1328,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1277
1328
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1278
1329
|
```
|
|
1279
1330
|
|
|
1280
|
-
Returns **[Promise][
|
|
1331
|
+
Returns **[Promise][26]<PageScrollPosition>** scroll position
|
|
1281
1332
|
|
|
1282
1333
|
### grabPopupText
|
|
1283
1334
|
|
|
@@ -1287,7 +1338,7 @@ Grab the text within the popup. If no popup is visible then it will return null.
|
|
|
1287
1338
|
await I.grabPopupText();
|
|
1288
1339
|
```
|
|
1289
1340
|
|
|
1290
|
-
Returns **[Promise][
|
|
1341
|
+
Returns **[Promise][26]<[string][18]>**
|
|
1291
1342
|
|
|
1292
1343
|
### grabSource
|
|
1293
1344
|
|
|
@@ -1298,7 +1349,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1298
1349
|
let pageSource = await I.grabSource();
|
|
1299
1350
|
```
|
|
1300
1351
|
|
|
1301
|
-
Returns **[Promise][
|
|
1352
|
+
Returns **[Promise][26]<[string][18]>** source code
|
|
1302
1353
|
|
|
1303
1354
|
### grabTextFrom
|
|
1304
1355
|
|
|
@@ -1313,9 +1364,9 @@ If multiple elements found returns first element.
|
|
|
1313
1364
|
|
|
1314
1365
|
#### Parameters
|
|
1315
1366
|
|
|
1316
|
-
- `locator` **([string][
|
|
1367
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1317
1368
|
|
|
1318
|
-
Returns **[Promise][
|
|
1369
|
+
Returns **[Promise][26]<[string][18]>** attribute value
|
|
1319
1370
|
|
|
1320
1371
|
### grabTextFromAll
|
|
1321
1372
|
|
|
@@ -1328,9 +1379,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1328
1379
|
|
|
1329
1380
|
#### Parameters
|
|
1330
1381
|
|
|
1331
|
-
- `locator` **([string][
|
|
1382
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1332
1383
|
|
|
1333
|
-
Returns **[Promise][
|
|
1384
|
+
Returns **[Promise][26]<[Array][29]<[string][18]>>** attribute value
|
|
1334
1385
|
|
|
1335
1386
|
### grabTitle
|
|
1336
1387
|
|
|
@@ -1341,7 +1392,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1341
1392
|
let title = await I.grabTitle();
|
|
1342
1393
|
```
|
|
1343
1394
|
|
|
1344
|
-
Returns **[Promise][
|
|
1395
|
+
Returns **[Promise][26]<[string][18]>** title
|
|
1345
1396
|
|
|
1346
1397
|
### grabValueFrom
|
|
1347
1398
|
|
|
@@ -1355,9 +1406,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1355
1406
|
|
|
1356
1407
|
#### Parameters
|
|
1357
1408
|
|
|
1358
|
-
- `locator` **([string][
|
|
1409
|
+
- `locator` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
1359
1410
|
|
|
1360
|
-
Returns **[Promise][
|
|
1411
|
+
Returns **[Promise][26]<[string][18]>** attribute value
|
|
1361
1412
|
|
|
1362
1413
|
### grabValueFromAll
|
|
1363
1414
|
|
|
@@ -1370,9 +1421,9 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1370
1421
|
|
|
1371
1422
|
#### Parameters
|
|
1372
1423
|
|
|
1373
|
-
- `locator` **([string][
|
|
1424
|
+
- `locator` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
1374
1425
|
|
|
1375
|
-
Returns **[Promise][
|
|
1426
|
+
Returns **[Promise][26]<[Array][29]<[string][18]>>** attribute value
|
|
1376
1427
|
|
|
1377
1428
|
### grabWebElements
|
|
1378
1429
|
|
|
@@ -1385,9 +1436,9 @@ const webElements = await I.grabWebElements('#button');
|
|
|
1385
1436
|
|
|
1386
1437
|
#### Parameters
|
|
1387
1438
|
|
|
1388
|
-
- `locator` **([string][
|
|
1439
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1389
1440
|
|
|
1390
|
-
Returns **[Promise][
|
|
1441
|
+
Returns **[Promise][26]<any>** WebElement of being used Web helper
|
|
1391
1442
|
|
|
1392
1443
|
### moveCursorTo
|
|
1393
1444
|
|
|
@@ -1401,11 +1452,11 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1401
1452
|
|
|
1402
1453
|
#### Parameters
|
|
1403
1454
|
|
|
1404
|
-
- `locator` **([string][
|
|
1455
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1405
1456
|
- `xOffset`
|
|
1406
1457
|
- `yOffset`
|
|
1407
|
-
- `offsetX` **[number][
|
|
1408
|
-
- `offsetY` **[number][
|
|
1458
|
+
- `offsetX` **[number][23]** (optional, `0` by default) X-axis offset.
|
|
1459
|
+
- `offsetY` **[number][23]** (optional, `0` by default) Y-axis offset.
|
|
1409
1460
|
|
|
1410
1461
|
Returns **void** automatically synchronized promise through #recorder
|
|
1411
1462
|
|
|
@@ -1430,7 +1481,7 @@ _Note:_ In case a text field or textarea is focused be aware that some browsers
|
|
|
1430
1481
|
|
|
1431
1482
|
Presses a key in the browser (on a focused element).
|
|
1432
1483
|
|
|
1433
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1484
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][31].
|
|
1434
1485
|
|
|
1435
1486
|
```js
|
|
1436
1487
|
I.pressKey('Backspace');
|
|
@@ -1489,7 +1540,7 @@ Some of the supported key names are:
|
|
|
1489
1540
|
|
|
1490
1541
|
#### Parameters
|
|
1491
1542
|
|
|
1492
|
-
- `key` **([string][
|
|
1543
|
+
- `key` **([string][18] | [Array][29]<[string][18]>)** key or array of keys to press.
|
|
1493
1544
|
|
|
1494
1545
|
Returns **void** automatically synchronized promise through #recorder
|
|
1495
1546
|
|
|
@@ -1497,7 +1548,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1497
1548
|
|
|
1498
1549
|
Presses a key in the browser and leaves it in a down state.
|
|
1499
1550
|
|
|
1500
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1551
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][32]).
|
|
1501
1552
|
|
|
1502
1553
|
```js
|
|
1503
1554
|
I.pressKeyDown('Control');
|
|
@@ -1507,7 +1558,7 @@ I.pressKeyUp('Control');
|
|
|
1507
1558
|
|
|
1508
1559
|
#### Parameters
|
|
1509
1560
|
|
|
1510
|
-
- `key` **[string][
|
|
1561
|
+
- `key` **[string][18]** name of key to press down.
|
|
1511
1562
|
|
|
1512
1563
|
Returns **void** automatically synchronized promise through #recorder
|
|
1513
1564
|
|
|
@@ -1515,7 +1566,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1515
1566
|
|
|
1516
1567
|
Releases a key in the browser which was previously set to a down state.
|
|
1517
1568
|
|
|
1518
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1569
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][32]).
|
|
1519
1570
|
|
|
1520
1571
|
```js
|
|
1521
1572
|
I.pressKeyDown('Control');
|
|
@@ -1525,7 +1576,7 @@ I.pressKeyUp('Control');
|
|
|
1525
1576
|
|
|
1526
1577
|
#### Parameters
|
|
1527
1578
|
|
|
1528
|
-
- `key` **[string][
|
|
1579
|
+
- `key` **[string][18]** name of key to release.
|
|
1529
1580
|
|
|
1530
1581
|
Returns **void** automatically synchronized promise through #recorder
|
|
1531
1582
|
|
|
@@ -1548,8 +1599,8 @@ First parameter can be set to `maximize`.
|
|
|
1548
1599
|
|
|
1549
1600
|
#### Parameters
|
|
1550
1601
|
|
|
1551
|
-
- `width` **[number][
|
|
1552
|
-
- `height` **[number][
|
|
1602
|
+
- `width` **[number][23]** width in pixels or `maximize`.
|
|
1603
|
+
- `height` **[number][23]** height in pixels.
|
|
1553
1604
|
|
|
1554
1605
|
Returns **void** automatically synchronized promise through #recorder
|
|
1555
1606
|
|
|
@@ -1568,8 +1619,8 @@ I.rightClick('Click me', '.context');
|
|
|
1568
1619
|
|
|
1569
1620
|
#### Parameters
|
|
1570
1621
|
|
|
1571
|
-
- `locator` **([string][
|
|
1572
|
-
- `context` **([string][
|
|
1622
|
+
- `locator` **([string][18] | [object][17])** clickable element located by CSS|XPath|strict locator.
|
|
1623
|
+
- `context` **([string][18]? | [object][17])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1573
1624
|
|
|
1574
1625
|
Returns **void** automatically synchronized promise through #recorder
|
|
1575
1626
|
|
|
@@ -1614,8 +1665,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1614
1665
|
|
|
1615
1666
|
#### Parameters
|
|
1616
1667
|
|
|
1617
|
-
- `locator` **([string][
|
|
1618
|
-
- `fileName` **[string][
|
|
1668
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1669
|
+
- `fileName` **[string][18]** file name to save.
|
|
1619
1670
|
|
|
1620
1671
|
Returns **void** automatically synchronized promise through #recorder
|
|
1621
1672
|
|
|
@@ -1632,8 +1683,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1632
1683
|
|
|
1633
1684
|
#### Parameters
|
|
1634
1685
|
|
|
1635
|
-
- `fileName` **[string][
|
|
1636
|
-
- `fullPage` **[boolean][
|
|
1686
|
+
- `fileName` **[string][18]** file name to save.
|
|
1687
|
+
- `fullPage` **[boolean][33]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1637
1688
|
|
|
1638
1689
|
Returns **void** automatically synchronized promise through #recorder
|
|
1639
1690
|
|
|
@@ -1649,8 +1700,8 @@ I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "cent
|
|
|
1649
1700
|
|
|
1650
1701
|
#### Parameters
|
|
1651
1702
|
|
|
1652
|
-
- `locator` **([string][
|
|
1653
|
-
- `scrollIntoViewOptions` **(ScrollIntoViewOptions | [boolean][
|
|
1703
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1704
|
+
- `scrollIntoViewOptions` **(ScrollIntoViewOptions | [boolean][33])** either alignToTop=true|false or scrollIntoViewOptions. See [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][34].
|
|
1654
1705
|
|
|
1655
1706
|
Returns **void** automatically synchronized promise through #recorder
|
|
1656
1707
|
|
|
@@ -1686,9 +1737,9 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1686
1737
|
|
|
1687
1738
|
#### Parameters
|
|
1688
1739
|
|
|
1689
|
-
- `locator` **([string][
|
|
1690
|
-
- `offsetX` **[number][
|
|
1691
|
-
- `offsetY` **[number][
|
|
1740
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1741
|
+
- `offsetX` **[number][23]** (optional, `0` by default) X-axis offset.
|
|
1742
|
+
- `offsetY` **[number][23]** (optional, `0` by default) Y-axis offset.
|
|
1692
1743
|
|
|
1693
1744
|
Returns **void** automatically synchronized promise through #recorder
|
|
1694
1745
|
|
|
@@ -1705,8 +1756,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1705
1756
|
|
|
1706
1757
|
#### Parameters
|
|
1707
1758
|
|
|
1708
|
-
- `text` **[string][
|
|
1709
|
-
- `context` **([string][
|
|
1759
|
+
- `text` **[string][18]** expected on page.
|
|
1760
|
+
- `context` **([string][18]? | [object][17])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1710
1761
|
|
|
1711
1762
|
Returns **void** automatically synchronized promise through #recorder
|
|
1712
1763
|
|
|
@@ -1724,8 +1775,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1724
1775
|
|
|
1725
1776
|
#### Parameters
|
|
1726
1777
|
|
|
1727
|
-
- `locator` **([string][
|
|
1728
|
-
- `attributes` **[object][
|
|
1778
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1779
|
+
- `attributes` **[object][17]** attributes and their values to check.
|
|
1729
1780
|
|
|
1730
1781
|
Returns **void** automatically synchronized promise through #recorder
|
|
1731
1782
|
|
|
@@ -1742,7 +1793,7 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1742
1793
|
|
|
1743
1794
|
#### Parameters
|
|
1744
1795
|
|
|
1745
|
-
- `field` **([string][
|
|
1796
|
+
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
1746
1797
|
|
|
1747
1798
|
Returns **void** automatically synchronized promise through #recorder
|
|
1748
1799
|
|
|
@@ -1756,7 +1807,7 @@ I.seeCookie('Auth');
|
|
|
1756
1807
|
|
|
1757
1808
|
#### Parameters
|
|
1758
1809
|
|
|
1759
|
-
- `name` **[string][
|
|
1810
|
+
- `name` **[string][18]** cookie name.
|
|
1760
1811
|
|
|
1761
1812
|
Returns **void** automatically synchronized promise through #recorder
|
|
1762
1813
|
|
|
@@ -1770,8 +1821,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1770
1821
|
|
|
1771
1822
|
#### Parameters
|
|
1772
1823
|
|
|
1773
|
-
- `locator` **([string][
|
|
1774
|
-
- `cssProperties` **[object][
|
|
1824
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1825
|
+
- `cssProperties` **[object][17]** object with CSS properties and their values to check.
|
|
1775
1826
|
|
|
1776
1827
|
Returns **void** automatically synchronized promise through #recorder
|
|
1777
1828
|
|
|
@@ -1788,7 +1839,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1788
1839
|
|
|
1789
1840
|
#### Parameters
|
|
1790
1841
|
|
|
1791
|
-
- `url` **[string][
|
|
1842
|
+
- `url` **[string][18]** value to check.
|
|
1792
1843
|
|
|
1793
1844
|
Returns **void** automatically synchronized promise through #recorder
|
|
1794
1845
|
|
|
@@ -1803,7 +1854,7 @@ I.seeElement('#modal');
|
|
|
1803
1854
|
|
|
1804
1855
|
#### Parameters
|
|
1805
1856
|
|
|
1806
|
-
- `locator` **([string][
|
|
1857
|
+
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1807
1858
|
|
|
1808
1859
|
Returns **void** automatically synchronized promise through #recorder
|
|
1809
1860
|
|
|
@@ -1822,7 +1873,7 @@ I.seeElementInDOM('#modal');
|
|
|
1822
1873
|
|
|
1823
1874
|
#### Parameters
|
|
1824
1875
|
|
|
1825
|
-
- `locator` **([string][
|
|
1876
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1826
1877
|
|
|
1827
1878
|
Returns **void** automatically synchronized promise through #recorder
|
|
1828
1879
|
|
|
@@ -1836,7 +1887,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1836
1887
|
|
|
1837
1888
|
#### Parameters
|
|
1838
1889
|
|
|
1839
|
-
- `url` **[string][
|
|
1890
|
+
- `url` **[string][18]** a fragment to check
|
|
1840
1891
|
|
|
1841
1892
|
Returns **void** automatically synchronized promise through #recorder
|
|
1842
1893
|
|
|
@@ -1854,8 +1905,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1854
1905
|
|
|
1855
1906
|
#### Parameters
|
|
1856
1907
|
|
|
1857
|
-
- `field` **([string][
|
|
1858
|
-
- `value` **([string][
|
|
1908
|
+
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
1909
|
+
- `value` **([string][18] | [object][17])** value to check.
|
|
1859
1910
|
|
|
1860
1911
|
Returns **void** automatically synchronized promise through #recorder
|
|
1861
1912
|
|
|
@@ -1866,7 +1917,7 @@ given string.
|
|
|
1866
1917
|
|
|
1867
1918
|
#### Parameters
|
|
1868
1919
|
|
|
1869
|
-
- `text` **[string][
|
|
1920
|
+
- `text` **[string][18]** value to check.
|
|
1870
1921
|
|
|
1871
1922
|
### seeInSource
|
|
1872
1923
|
|
|
@@ -1878,7 +1929,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1878
1929
|
|
|
1879
1930
|
#### Parameters
|
|
1880
1931
|
|
|
1881
|
-
- `text` **[string][
|
|
1932
|
+
- `text` **[string][18]** value to check.
|
|
1882
1933
|
|
|
1883
1934
|
Returns **void** automatically synchronized promise through #recorder
|
|
1884
1935
|
|
|
@@ -1892,7 +1943,7 @@ I.seeInTitle('Home Page');
|
|
|
1892
1943
|
|
|
1893
1944
|
#### Parameters
|
|
1894
1945
|
|
|
1895
|
-
- `text` **[string][
|
|
1946
|
+
- `text` **[string][18]** text value to check.
|
|
1896
1947
|
|
|
1897
1948
|
Returns **void** automatically synchronized promise through #recorder
|
|
1898
1949
|
|
|
@@ -1907,8 +1958,8 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1907
1958
|
|
|
1908
1959
|
#### Parameters
|
|
1909
1960
|
|
|
1910
|
-
- `locator` **([string][
|
|
1911
|
-
- `num` **[number][
|
|
1961
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1962
|
+
- `num` **[number][23]** number of elements.
|
|
1912
1963
|
|
|
1913
1964
|
Returns **void** automatically synchronized promise through #recorder
|
|
1914
1965
|
|
|
@@ -1927,8 +1978,8 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1927
1978
|
|
|
1928
1979
|
#### Parameters
|
|
1929
1980
|
|
|
1930
|
-
- `locator` **([string][
|
|
1931
|
-
- `num` **[number][
|
|
1981
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1982
|
+
- `num` **[number][23]** number of elements.
|
|
1932
1983
|
|
|
1933
1984
|
Returns **void** automatically synchronized promise through #recorder
|
|
1934
1985
|
|
|
@@ -1946,8 +1997,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1946
1997
|
|
|
1947
1998
|
#### Parameters
|
|
1948
1999
|
|
|
1949
|
-
- `text` **[string][
|
|
1950
|
-
- `context` **([string][
|
|
2000
|
+
- `text` **[string][18]** element value to check.
|
|
2001
|
+
- `context` **([string][18] | [object][17])?** element located by CSS|XPath|strict locator.
|
|
1951
2002
|
|
|
1952
2003
|
Returns **void** automatically synchronized promise through #recorder
|
|
1953
2004
|
|
|
@@ -1961,7 +2012,7 @@ I.seeTitleEquals('Test title.');
|
|
|
1961
2012
|
|
|
1962
2013
|
#### Parameters
|
|
1963
2014
|
|
|
1964
|
-
- `text` **[string][
|
|
2015
|
+
- `text` **[string][18]** value to check.
|
|
1965
2016
|
|
|
1966
2017
|
Returns **void** automatically synchronized promise through #recorder
|
|
1967
2018
|
|
|
@@ -1988,14 +2039,14 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1988
2039
|
|
|
1989
2040
|
#### Parameters
|
|
1990
2041
|
|
|
1991
|
-
- `select` **([string][
|
|
1992
|
-
- `option` **([string][
|
|
2042
|
+
- `select` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
2043
|
+
- `option` **([string][18] | [Array][29]<any>)** visible text or value of option.
|
|
1993
2044
|
|
|
1994
2045
|
Returns **void** automatically synchronized promise through #recorder
|
|
1995
2046
|
|
|
1996
2047
|
### setCookie
|
|
1997
2048
|
|
|
1998
|
-
Uses Selenium's JSON [cookie format][
|
|
2049
|
+
Uses Selenium's JSON [cookie format][35].
|
|
1999
2050
|
Sets cookie(s).
|
|
2000
2051
|
|
|
2001
2052
|
Can be a single cookie object or an array of cookies:
|
|
@@ -2012,12 +2063,14 @@ I.setCookie([
|
|
|
2012
2063
|
|
|
2013
2064
|
#### Parameters
|
|
2014
2065
|
|
|
2015
|
-
- `cookie` **(Cookie | [Array][
|
|
2066
|
+
- `cookie` **(Cookie | [Array][29]<Cookie>)** a cookie object or array of cookie objects.
|
|
2016
2067
|
|
|
2017
2068
|
Returns **void** automatically synchronized promise through #recorder
|
|
2018
2069
|
|
|
2019
2070
|
### setGeoLocation
|
|
2020
2071
|
|
|
2072
|
+
This method is **deprecated**.
|
|
2073
|
+
|
|
2021
2074
|
Set the current geo location
|
|
2022
2075
|
|
|
2023
2076
|
```js
|
|
@@ -2027,9 +2080,9 @@ I.setGeoLocation(121.21, 11.56, 10);
|
|
|
2027
2080
|
|
|
2028
2081
|
#### Parameters
|
|
2029
2082
|
|
|
2030
|
-
- `latitude` **[number][
|
|
2031
|
-
- `longitude` **[number][
|
|
2032
|
-
- `altitude` **[number][
|
|
2083
|
+
- `latitude` **[number][23]** to set.
|
|
2084
|
+
- `longitude` **[number][23]** to set
|
|
2085
|
+
- `altitude` **[number][23]?** (optional, null by default) to set
|
|
2033
2086
|
|
|
2034
2087
|
Returns **void** automatically synchronized promise through #recorder
|
|
2035
2088
|
|
|
@@ -2044,7 +2097,7 @@ I.switchTo(); // switch back to main page
|
|
|
2044
2097
|
|
|
2045
2098
|
#### Parameters
|
|
2046
2099
|
|
|
2047
|
-
- `locator` **([string][
|
|
2100
|
+
- `locator` **([string][18]? | [object][17])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
2048
2101
|
|
|
2049
2102
|
Returns **void** automatically synchronized promise through #recorder
|
|
2050
2103
|
|
|
@@ -2059,8 +2112,8 @@ I.switchToNextTab(2);
|
|
|
2059
2112
|
|
|
2060
2113
|
#### Parameters
|
|
2061
2114
|
|
|
2062
|
-
- `num` **[number][
|
|
2063
|
-
- `sec` **([number][
|
|
2115
|
+
- `num` **[number][23]?** (optional) number of tabs to switch forward, default: 1.
|
|
2116
|
+
- `sec` **([number][23] | null)?** (optional) time in seconds to wait.
|
|
2064
2117
|
|
|
2065
2118
|
Returns **void** automatically synchronized promise through #recorder
|
|
2066
2119
|
|
|
@@ -2075,8 +2128,8 @@ I.switchToPreviousTab(2);
|
|
|
2075
2128
|
|
|
2076
2129
|
#### Parameters
|
|
2077
2130
|
|
|
2078
|
-
- `num` **[number][
|
|
2079
|
-
- `sec` **[number][
|
|
2131
|
+
- `num` **[number][23]?** (optional) number of tabs to switch backward, default: 1.
|
|
2132
|
+
- `sec` **[number][23]??** (optional) time in seconds to wait.
|
|
2080
2133
|
|
|
2081
2134
|
Returns **void** automatically synchronized promise through #recorder
|
|
2082
2135
|
|
|
@@ -2096,13 +2149,13 @@ await I.switchToWindow( window );
|
|
|
2096
2149
|
|
|
2097
2150
|
#### Parameters
|
|
2098
2151
|
|
|
2099
|
-
- `window` **[string][
|
|
2152
|
+
- `window` **[string][18]** name of window handle.
|
|
2100
2153
|
|
|
2101
2154
|
### type
|
|
2102
2155
|
|
|
2103
2156
|
Types out the given text into an active field.
|
|
2104
2157
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
2105
|
-
_Note:_ Should be used when [`fillField`][
|
|
2158
|
+
_Note:_ Should be used when [`fillField`][31] is not an option.
|
|
2106
2159
|
|
|
2107
2160
|
```js
|
|
2108
2161
|
// passing in a string
|
|
@@ -2121,8 +2174,8 @@ I.type(secret('123456'));
|
|
|
2121
2174
|
#### Parameters
|
|
2122
2175
|
|
|
2123
2176
|
- `keys`
|
|
2124
|
-
- `delay` **[number][
|
|
2125
|
-
- `key` **([string][
|
|
2177
|
+
- `delay` **[number][23]?** (optional) delay in ms between key presses
|
|
2178
|
+
- `key` **([string][18] | [Array][29]<[string][18]>)** or array of keys to type.
|
|
2126
2179
|
|
|
2127
2180
|
Returns **void** automatically synchronized promise through #recorder
|
|
2128
2181
|
|
|
@@ -2142,19 +2195,19 @@ I.uncheckOption('agree', '//form');
|
|
|
2142
2195
|
|
|
2143
2196
|
#### Parameters
|
|
2144
2197
|
|
|
2145
|
-
- `field` **([string][
|
|
2146
|
-
- `context` **([string][
|
|
2198
|
+
- `field` **([string][18] | [object][17])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
2199
|
+
- `context` **([string][18]? | [object][17])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2147
2200
|
|
|
2148
2201
|
Returns **void** automatically synchronized promise through #recorder
|
|
2149
2202
|
|
|
2150
2203
|
### useWebDriverTo
|
|
2151
2204
|
|
|
2152
|
-
Use [webdriverio][
|
|
2205
|
+
Use [webdriverio][36] API inside a test.
|
|
2153
2206
|
|
|
2154
2207
|
First argument is a description of an action.
|
|
2155
2208
|
Second argument is async function that gets this helper as parameter.
|
|
2156
2209
|
|
|
2157
|
-
{ [`browser`][
|
|
2210
|
+
{ [`browser`][36]) } object from WebDriver API is available.
|
|
2158
2211
|
|
|
2159
2212
|
```js
|
|
2160
2213
|
I.useWebDriverTo('open multiple windows', async ({ browser }) {
|
|
@@ -2165,8 +2218,8 @@ I.useWebDriverTo('open multiple windows', async ({ browser }) {
|
|
|
2165
2218
|
|
|
2166
2219
|
#### Parameters
|
|
2167
2220
|
|
|
2168
|
-
- `description` **[string][
|
|
2169
|
-
- `fn` **[function][
|
|
2221
|
+
- `description` **[string][18]** used to show in logs.
|
|
2222
|
+
- `fn` **[function][25]** async functuion that executed with WebDriver helper as argument
|
|
2170
2223
|
|
|
2171
2224
|
### wait
|
|
2172
2225
|
|
|
@@ -2178,7 +2231,7 @@ I.wait(2); // wait 2 secs
|
|
|
2178
2231
|
|
|
2179
2232
|
#### Parameters
|
|
2180
2233
|
|
|
2181
|
-
- `sec` **[number][
|
|
2234
|
+
- `sec` **[number][23]** number of second to wait.
|
|
2182
2235
|
|
|
2183
2236
|
Returns **void** automatically synchronized promise through #recorder
|
|
2184
2237
|
|
|
@@ -2194,9 +2247,9 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
2194
2247
|
|
|
2195
2248
|
#### Parameters
|
|
2196
2249
|
|
|
2197
|
-
- `locator` **([string][
|
|
2250
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2198
2251
|
- `waitTimeout`
|
|
2199
|
-
- `sec` **[number][
|
|
2252
|
+
- `sec` **[number][23]?** (optional, `1` by default) time in seconds to wait
|
|
2200
2253
|
|
|
2201
2254
|
Returns **void** automatically synchronized promise through #recorder
|
|
2202
2255
|
|
|
@@ -2211,8 +2264,8 @@ I.waitForDetached('#popup');
|
|
|
2211
2264
|
|
|
2212
2265
|
#### Parameters
|
|
2213
2266
|
|
|
2214
|
-
- `locator` **([string][
|
|
2215
|
-
- `sec` **[number][
|
|
2267
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2268
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2216
2269
|
|
|
2217
2270
|
Returns **void** automatically synchronized promise through #recorder
|
|
2218
2271
|
|
|
@@ -2228,8 +2281,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
2228
2281
|
|
|
2229
2282
|
#### Parameters
|
|
2230
2283
|
|
|
2231
|
-
- `locator` **([string][
|
|
2232
|
-
- `sec` **[number][
|
|
2284
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2285
|
+
- `sec` **[number][23]?** (optional, `1` by default) time in seconds to wait
|
|
2233
2286
|
|
|
2234
2287
|
Returns **void** automatically synchronized promise through #recorder
|
|
2235
2288
|
|
|
@@ -2240,8 +2293,8 @@ Element can be located by CSS or XPath.
|
|
|
2240
2293
|
|
|
2241
2294
|
#### Parameters
|
|
2242
2295
|
|
|
2243
|
-
- `locator` **([string][
|
|
2244
|
-
- `sec` **[number][
|
|
2296
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2297
|
+
- `sec` **[number][23]** (optional) time in seconds to wait, 1 by default.
|
|
2245
2298
|
|
|
2246
2299
|
Returns **void** automatically synchronized promise through #recorder
|
|
2247
2300
|
|
|
@@ -2262,9 +2315,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2262
2315
|
|
|
2263
2316
|
#### Parameters
|
|
2264
2317
|
|
|
2265
|
-
- `fn` **([string][
|
|
2266
|
-
- `argsOrSec` **([Array][
|
|
2267
|
-
- `sec` **[number][
|
|
2318
|
+
- `fn` **([string][18] | [function][25])** to be executed in browser context.
|
|
2319
|
+
- `argsOrSec` **([Array][29]<any> | [number][23])?** (optional, `1` by default) arguments for function or seconds.
|
|
2320
|
+
- `sec` **[number][23]?** (optional, `1` by default) time in seconds to wait
|
|
2268
2321
|
|
|
2269
2322
|
Returns **void** automatically synchronized promise through #recorder
|
|
2270
2323
|
|
|
@@ -2279,8 +2332,23 @@ I.waitForInvisible('#popup');
|
|
|
2279
2332
|
|
|
2280
2333
|
#### Parameters
|
|
2281
2334
|
|
|
2282
|
-
- `locator` **([string][
|
|
2283
|
-
- `sec` **[number][
|
|
2335
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2336
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2337
|
+
|
|
2338
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2339
|
+
|
|
2340
|
+
### waitForNumberOfTabs
|
|
2341
|
+
|
|
2342
|
+
Waits for number of tabs.
|
|
2343
|
+
|
|
2344
|
+
```js
|
|
2345
|
+
I.waitForNumberOfTabs(2);
|
|
2346
|
+
```
|
|
2347
|
+
|
|
2348
|
+
#### Parameters
|
|
2349
|
+
|
|
2350
|
+
- `expectedTabs` **[number][23]** expecting the number of tabs.
|
|
2351
|
+
- `sec` **[number][23]** number of secs to wait.
|
|
2284
2352
|
|
|
2285
2353
|
Returns **void** automatically synchronized promise through #recorder
|
|
2286
2354
|
|
|
@@ -2297,9 +2365,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2297
2365
|
|
|
2298
2366
|
#### Parameters
|
|
2299
2367
|
|
|
2300
|
-
- `text` **[string][
|
|
2301
|
-
- `sec` **[number][
|
|
2302
|
-
- `context` **([string][
|
|
2368
|
+
- `text` **[string][18]** to wait for.
|
|
2369
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2370
|
+
- `context` **([string][18] | [object][17])?** (optional) element located by CSS|XPath|strict locator.
|
|
2303
2371
|
|
|
2304
2372
|
Returns **void** automatically synchronized promise through #recorder
|
|
2305
2373
|
|
|
@@ -2313,9 +2381,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2313
2381
|
|
|
2314
2382
|
#### Parameters
|
|
2315
2383
|
|
|
2316
|
-
- `field` **([string][
|
|
2317
|
-
- `value` **[string][
|
|
2318
|
-
- `sec` **[number][
|
|
2384
|
+
- `field` **([string][18] | [object][17])** input field.
|
|
2385
|
+
- `value` **[string][18]** expected value.
|
|
2386
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2319
2387
|
|
|
2320
2388
|
Returns **void** automatically synchronized promise through #recorder
|
|
2321
2389
|
|
|
@@ -2330,8 +2398,8 @@ I.waitForVisible('#popup');
|
|
|
2330
2398
|
|
|
2331
2399
|
#### Parameters
|
|
2332
2400
|
|
|
2333
|
-
- `locator` **([string][
|
|
2334
|
-
- `sec` **[number][
|
|
2401
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2402
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2335
2403
|
|
|
2336
2404
|
Returns **void** automatically synchronized promise through #recorder
|
|
2337
2405
|
|
|
@@ -2345,8 +2413,8 @@ I.waitInUrl('/info', 2);
|
|
|
2345
2413
|
|
|
2346
2414
|
#### Parameters
|
|
2347
2415
|
|
|
2348
|
-
- `urlPart` **[string][
|
|
2349
|
-
- `sec` **[number][
|
|
2416
|
+
- `urlPart` **[string][18]** value to check.
|
|
2417
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2350
2418
|
|
|
2351
2419
|
Returns **void** automatically synchronized promise through #recorder
|
|
2352
2420
|
|
|
@@ -2360,9 +2428,9 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2360
2428
|
|
|
2361
2429
|
#### Parameters
|
|
2362
2430
|
|
|
2363
|
-
- `locator` **([string][
|
|
2364
|
-
- `num` **[number][
|
|
2365
|
-
- `sec` **[number][
|
|
2431
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2432
|
+
- `num` **[number][23]** number of elements.
|
|
2433
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2366
2434
|
|
|
2367
2435
|
Returns **void** automatically synchronized promise through #recorder
|
|
2368
2436
|
|
|
@@ -2377,8 +2445,8 @@ I.waitToHide('#popup');
|
|
|
2377
2445
|
|
|
2378
2446
|
#### Parameters
|
|
2379
2447
|
|
|
2380
|
-
- `locator` **([string][
|
|
2381
|
-
- `sec` **[number][
|
|
2448
|
+
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2449
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2382
2450
|
|
|
2383
2451
|
Returns **void** automatically synchronized promise through #recorder
|
|
2384
2452
|
|
|
@@ -2393,8 +2461,8 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2393
2461
|
|
|
2394
2462
|
#### Parameters
|
|
2395
2463
|
|
|
2396
|
-
- `urlPart` **[string][
|
|
2397
|
-
- `sec` **[number][
|
|
2464
|
+
- `urlPart` **[string][18]** value to check.
|
|
2465
|
+
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2398
2466
|
|
|
2399
2467
|
Returns **void** automatically synchronized promise through #recorder
|
|
2400
2468
|
|
|
@@ -2402,72 +2470,78 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2402
2470
|
|
|
2403
2471
|
[2]: https://codecept.io/webdriver/#testing-with-webdriver
|
|
2404
2472
|
|
|
2405
|
-
[3]:
|
|
2473
|
+
[3]: https://webdriver.io/blog/2023/07/31/driver-management/
|
|
2474
|
+
|
|
2475
|
+
[4]: http://webdriver.io/guide/getstarted/configuration.html
|
|
2476
|
+
|
|
2477
|
+
[5]: https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/IE/Options.html
|
|
2478
|
+
|
|
2479
|
+
[6]: https://aerokube.com/selenoid/latest/
|
|
2406
2480
|
|
|
2407
|
-
[
|
|
2481
|
+
[7]: https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
|
|
2408
2482
|
|
|
2409
|
-
[
|
|
2483
|
+
[8]: http://webdriver.io/guide/usage/cloudservices.html
|
|
2410
2484
|
|
|
2411
|
-
[
|
|
2485
|
+
[9]: https://webdriver.io/docs/sauce-service.html
|
|
2412
2486
|
|
|
2413
|
-
[
|
|
2487
|
+
[10]: https://github.com/puneet0191/codeceptjs-saucehelper/
|
|
2414
2488
|
|
|
2415
|
-
[
|
|
2489
|
+
[11]: https://webdriver.io/docs/browserstack-service.html
|
|
2416
2490
|
|
|
2417
|
-
[
|
|
2491
|
+
[12]: https://github.com/PeterNgTr/codeceptjs-bshelper
|
|
2418
2492
|
|
|
2419
|
-
[
|
|
2493
|
+
[13]: https://github.com/testingbot/codeceptjs-tbhelper
|
|
2420
2494
|
|
|
2421
|
-
[
|
|
2495
|
+
[14]: https://webdriver.io/docs/testingbot-service.html
|
|
2422
2496
|
|
|
2423
|
-
[
|
|
2497
|
+
[15]: https://github.com/PeterNgTr/codeceptjs-applitoolshelper
|
|
2424
2498
|
|
|
2425
|
-
[
|
|
2499
|
+
[16]: http://webdriver.io/guide/usage/multiremote.html
|
|
2426
2500
|
|
|
2427
|
-
[
|
|
2501
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
2428
2502
|
|
|
2429
|
-
[
|
|
2503
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2430
2504
|
|
|
2431
|
-
[
|
|
2505
|
+
[19]: http://jster.net/category/windows-modals-popups
|
|
2432
2506
|
|
|
2433
|
-
[
|
|
2507
|
+
[20]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2434
2508
|
|
|
2435
|
-
[
|
|
2509
|
+
[21]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2436
2510
|
|
|
2437
|
-
[
|
|
2511
|
+
[22]: https://webdriver.io/docs/timeouts.html
|
|
2438
2512
|
|
|
2439
|
-
[
|
|
2513
|
+
[23]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2440
2514
|
|
|
2441
|
-
[
|
|
2515
|
+
[24]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
2442
2516
|
|
|
2443
|
-
[
|
|
2517
|
+
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2444
2518
|
|
|
2445
|
-
[
|
|
2519
|
+
[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2446
2520
|
|
|
2447
|
-
[
|
|
2521
|
+
[27]: http://webdriver.io/api/protocol/execute.html
|
|
2448
2522
|
|
|
2449
|
-
[
|
|
2523
|
+
[28]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2450
2524
|
|
|
2451
|
-
[
|
|
2525
|
+
[29]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2452
2526
|
|
|
2453
|
-
[
|
|
2527
|
+
[30]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
|
|
2454
2528
|
|
|
2455
|
-
[
|
|
2529
|
+
[31]: #fillfield
|
|
2456
2530
|
|
|
2457
|
-
[
|
|
2531
|
+
[32]: #click
|
|
2458
2532
|
|
|
2459
|
-
[
|
|
2533
|
+
[33]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2460
2534
|
|
|
2461
|
-
[
|
|
2535
|
+
[34]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
2462
2536
|
|
|
2463
|
-
[
|
|
2537
|
+
[35]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object
|
|
2464
2538
|
|
|
2465
|
-
[
|
|
2539
|
+
[36]: https://webdriver.io/docs/api.html
|
|
2466
2540
|
|
|
2467
|
-
[
|
|
2541
|
+
[37]: http://codecept.io/acceptance/#smartwait
|
|
2468
2542
|
|
|
2469
|
-
[
|
|
2543
|
+
[38]: http://webdriver.io/docs/timeouts.html
|
|
2470
2544
|
|
|
2471
|
-
[
|
|
2545
|
+
[39]: https://webdriver.io/docs/configuration/#loglevel
|
|
2472
2546
|
|
|
2473
|
-
[
|
|
2547
|
+
[40]: https://webdriver.io/docs/automationProtocols/#devtools-protocol
|