codeceptjs 2.1.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -37
- package/README.md +15 -22
- package/bin/codecept.js +4 -1
- package/docs/acceptance.md +44 -1
- package/docs/advanced.md +1 -1
- package/docs/angular.md +6 -9
- package/docs/basics.md +388 -75
- package/docs/bdd.md +4 -3
- package/docs/best.md +1 -1
- package/docs/books.md +31 -0
- package/docs/build/Appium.js +215 -176
- package/docs/build/Nightmare.js +618 -489
- package/docs/build/Polly.js +189 -0
- package/docs/build/Protractor.js +747 -608
- package/docs/build/Puppeteer.js +914 -633
- package/docs/build/REST.js +1 -1
- package/docs/build/TestCafe.js +1835 -0
- package/docs/build/WebDriver.js +861 -805
- package/docs/build/WebDriverIO.js +616 -617
- package/docs/changelog.md +410 -316
- package/docs/commands.md +6 -6
- package/docs/community-helpers.md +2 -0
- package/docs/detox.md +235 -0
- package/docs/examples.md +23 -0
- package/docs/helpers/ApiDataFactory.md +11 -10
- package/docs/helpers/Appium.md +130 -61
- package/docs/helpers/Detox.md +579 -0
- package/docs/helpers/FileSystem.md +2 -1
- package/docs/helpers/Mochawesome.md +1 -0
- package/docs/helpers/Nightmare.md +348 -128
- package/docs/helpers/Polly.md +85 -0
- package/docs/helpers/Protractor.md +451 -184
- package/docs/helpers/Puppeteer-firefox.md +55 -0
- package/docs/helpers/Puppeteer.md +619 -183
- package/docs/helpers/REST.md +17 -16
- package/docs/helpers/SeleniumWebdriver.md +9 -8
- package/docs/helpers/TestCafe.md +1168 -0
- package/docs/helpers/WebDriver.md +600 -291
- package/docs/helpers/WebDriverIO.md +393 -278
- package/docs/helpers.md +37 -18
- package/docs/locators.md +2 -0
- package/docs/mobile-react-native-locators.md +64 -0
- package/docs/mobile.md +5 -0
- package/docs/plugins.md +54 -13
- package/docs/puppeteer.md +74 -26
- package/docs/quickstart.md +47 -12
- package/docs/react.md +67 -0
- package/docs/reports.md +1 -1
- package/docs/{webapi/_keys.mustache → shared/keys.mustache} +0 -0
- package/docs/shared/react.mustache +1 -0
- package/docs/testcafe.md +157 -0
- package/docs/videos.md +19 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +2 -2
- package/docs/webapi/attachFile.mustache +2 -2
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +3 -3
- package/docs/webapi/dontSee.mustache +6 -3
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +7 -1
- package/docs/webapi/dontSeeCookie.mustache +5 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +6 -1
- package/docs/webapi/dontSeeElement.mustache +5 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +5 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +7 -2
- package/docs/webapi/dontSeeInSource.mustache +5 -1
- package/docs/webapi/dontSeeInTitle.mustache +5 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +2 -2
- package/docs/webapi/dragAndDrop.mustache +2 -2
- package/docs/webapi/dragSlider.mustache +2 -2
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +2 -2
- package/docs/webapi/grabAttributeFrom.mustache +3 -2
- package/docs/webapi/grabBrowserLogs.mustache +3 -1
- package/docs/webapi/grabCookie.mustache +2 -1
- package/docs/webapi/grabCssPropertyFrom.mustache +3 -2
- package/docs/webapi/grabCurrentUrl.mustache +3 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +19 -0
- package/docs/webapi/grabHTMLFrom.mustache +2 -1
- package/docs/webapi/grabNumberOfOpenTabs.mustache +4 -2
- package/docs/webapi/grabNumberOfVisibleElements.mustache +3 -2
- package/docs/webapi/grabPageScrollPosition.mustache +3 -1
- package/docs/webapi/grabSource.mustache +3 -1
- package/docs/webapi/grabTextFrom.mustache +2 -1
- package/docs/webapi/grabTitle.mustache +3 -1
- package/docs/webapi/grabValueFrom.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +2 -2
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +3 -3
- package/docs/webapi/say.mustache +2 -2
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +2 -2
- package/docs/webapi/seeAttributesOnElements.mustache +3 -3
- package/docs/webapi/seeCheckboxIsChecked.mustache +2 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -2
- package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInCurrentUrl.mustache +1 -1
- package/docs/webapi/seeInField.mustache +2 -2
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +5 -1
- package/docs/webapi/seeNumberOfElements.mustache +10 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/switchTo.mustache +6 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/wait.mustache +1 -2
- package/docs/webapi/waitForDetached.mustache +3 -3
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +3 -3
- package/docs/webapi/waitForInvisible.mustache +3 -3
- package/docs/webapi/waitForText.mustache +3 -3
- package/docs/webapi/waitForValue.mustache +3 -3
- package/docs/webapi/waitForVisible.mustache +3 -3
- package/docs/webapi/waitInUrl.mustache +2 -2
- package/docs/webapi/waitNumberOfVisibleElements.mustache +3 -3
- package/docs/webapi/waitToHide.mustache +3 -3
- package/docs/webapi/waitUntil.mustache +3 -3
- package/docs/webapi/waitUrlEquals.mustache +2 -2
- package/docs/webdriver.md +453 -0
- package/lib/codecept.js +11 -9
- package/lib/command/definitions.js +183 -30
- package/lib/command/gherkin/snippets.js +29 -9
- package/lib/command/init.js +31 -9
- package/lib/command/run-multiple.js +46 -59
- package/lib/command/utils.js +1 -1
- package/lib/container.js +30 -4
- package/lib/data/dataScenarioConfig.js +18 -0
- package/lib/helper/Appium.js +24 -24
- package/lib/helper/Nightmare.js +81 -84
- package/lib/helper/Polly.js +189 -0
- package/lib/helper/Protractor.js +96 -86
- package/lib/helper/Puppeteer.js +238 -113
- package/lib/helper/REST.js +1 -1
- package/lib/helper/TestCafe.js +1257 -0
- package/lib/helper/WebDriver.js +217 -277
- package/lib/helper/WebDriverIO.js +75 -75
- package/lib/helper/clientscripts/nightmare.js +8 -0
- package/lib/helper/extras/React.js +55 -0
- package/lib/helper/testcafe/testControllerHolder.js +42 -0
- package/lib/helper/testcafe/testcafe-utils.js +63 -0
- package/lib/history.js +39 -0
- package/lib/hooks.js +25 -1
- package/lib/interfaces/gherkin.js +17 -1
- package/lib/interfaces/scenarioConfig.js +2 -2
- package/lib/listener/config.js +3 -3
- package/lib/locator.js +6 -0
- package/lib/pause.js +22 -1
- package/lib/plugin/allure.js +63 -0
- package/lib/plugin/autoLogin.js +65 -16
- package/lib/plugin/puppeteerCoverage.js +6 -1
- package/lib/plugin/stepByStepReport.js +4 -3
- package/lib/scenario.js +23 -17
- package/lib/step.js +5 -2
- package/lib/ui.js +1 -1
- package/lib/utils.js +70 -20
- package/package.json +20 -19
- package/translations/de-DE.js +69 -0
- package/translations/index.js +1 -0
- package/docs/video.md +0 -26
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
id: WebDriver
|
|
3
3
|
title: WebDriver
|
|
4
4
|
---
|
|
5
|
+
|
|
5
6
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
6
7
|
|
|
7
8
|
## WebDriver
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Extends Helper
|
|
10
11
|
|
|
11
12
|
WebDriver helper which wraps [webdriverio][1] library to
|
|
12
13
|
manipulate browser using Selenium WebDriver or PhantomJS.
|
|
@@ -19,37 +20,37 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
19
20
|
|
|
20
21
|
- `url`: base url of website to be tested.
|
|
21
22
|
- `browser`: browser in which to perform testing.
|
|
22
|
-
- `host`:
|
|
23
|
-
- `port`:
|
|
24
|
-
- `protocol`:
|
|
25
|
-
- `path`:
|
|
26
|
-
- `remoteFileUpload`:
|
|
27
|
-
- `restart`:
|
|
28
|
-
- `smartWait`: (optional)
|
|
29
|
-
- `disableScreenshots`:
|
|
30
|
-
- `fullPageScreenshots`
|
|
31
|
-
- `uniqueScreenshotNames`:
|
|
32
|
-
- `keepBrowserState`:
|
|
33
|
-
- `keepCookies`:
|
|
23
|
+
- `host`: - WebDriver host to connect.
|
|
24
|
+
- `port`: - WebDriver port to connect.
|
|
25
|
+
- `protocol`: - protocol for WebDriver server.
|
|
26
|
+
- `path`: - path to WebDriver server,
|
|
27
|
+
- `remoteFileUpload`: - upload file to remote server when running `attachFile`.
|
|
28
|
+
- `restart`: - restart browser between tests.
|
|
29
|
+
- `smartWait`: (optional) enables [SmartWait][3]; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000.
|
|
30
|
+
- `disableScreenshots`: - don't save screenshots on failure.
|
|
31
|
+
- `fullPageScreenshots` - make full page screenshots on failure.
|
|
32
|
+
- `uniqueScreenshotNames`: - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
33
|
+
- `keepBrowserState`: - keep browser state between tests when `restart` is set to false.
|
|
34
|
+
- `keepCookies`: - keep cookies between tests when `restart` set to false.
|
|
34
35
|
- `windowSize`: (optional) default window size. Set to `maximize` or a dimension in the format `640x480`.
|
|
35
|
-
- `waitForTimeout`:
|
|
36
|
+
- `waitForTimeout`: sets default wait time in _ms_ for all `wait` functions.
|
|
36
37
|
- `desiredCapabilities`: Selenium's [desired
|
|
37
38
|
capabilities][4].
|
|
38
|
-
- `manualStart`:
|
|
39
|
+
- `manualStart`: - do not start browser before a test, start it manually inside a helper
|
|
39
40
|
with `this.helpers["WebDriver"]._startBrowser()`.
|
|
40
41
|
- `timeouts`: [WebDriver timeouts][5] defined as hash.
|
|
41
42
|
|
|
42
43
|
Example:
|
|
43
44
|
|
|
44
|
-
```
|
|
45
|
+
```js
|
|
45
46
|
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
helpers: {
|
|
48
|
+
WebDriver : {
|
|
49
|
+
smartWait: 5000,
|
|
50
|
+
browser: "chrome",
|
|
51
|
+
restart: false,
|
|
52
|
+
windowSize: "maximize",
|
|
53
|
+
timeouts: {
|
|
53
54
|
"script": 60000,
|
|
54
55
|
"page load": 10000
|
|
55
56
|
}
|
|
@@ -63,15 +64,15 @@ website][6].
|
|
|
63
64
|
|
|
64
65
|
### Headless Chrome
|
|
65
66
|
|
|
66
|
-
```
|
|
67
|
+
```js
|
|
67
68
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
helpers: {
|
|
70
|
+
WebDriver : {
|
|
71
|
+
url: "http://localhost",
|
|
72
|
+
browser: "chrome",
|
|
73
|
+
desiredCapabilities: {
|
|
74
|
+
chromeOptions: {
|
|
75
|
+
args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
}
|
|
@@ -83,14 +84,14 @@ website][6].
|
|
|
83
84
|
|
|
84
85
|
Additional configuration params can be used from [IE options][7]
|
|
85
86
|
|
|
86
|
-
```
|
|
87
|
+
```js
|
|
87
88
|
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
helpers: {
|
|
90
|
+
WebDriver : {
|
|
91
|
+
url: "http://localhost",
|
|
92
|
+
browser: "internet explorer",
|
|
93
|
+
desiredCapabilities: {
|
|
94
|
+
ieOptions: {
|
|
94
95
|
"ie.browserCommandLineSwitches": "-private",
|
|
95
96
|
"ie.usePerProcessProxy": true,
|
|
96
97
|
"ie.ensureCleanSession": true,
|
|
@@ -103,15 +104,18 @@ Additional configuration params can be used from [IE options][7]
|
|
|
103
104
|
|
|
104
105
|
### Selenoid Options
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
[Selenoid][8] is a modern way to run Selenium inside Docker containers.
|
|
108
|
+
Selenoid is easy to set up and provides more features than original Selenium Server. Use `selenoidOptions` to set Selenoid capabilities
|
|
109
|
+
|
|
110
|
+
```js
|
|
107
111
|
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
helpers: {
|
|
113
|
+
WebDriver : {
|
|
114
|
+
url: "http://localhost",
|
|
115
|
+
browser: "chrome",
|
|
116
|
+
desiredCapabilities: {
|
|
117
|
+
selenoidOptions: {
|
|
118
|
+
enableVNC: true,
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
121
|
}
|
|
@@ -119,17 +123,17 @@ Additional configuration params can be used from [IE options][7]
|
|
|
119
123
|
}
|
|
120
124
|
```
|
|
121
125
|
|
|
122
|
-
### Connect
|
|
126
|
+
### Connect Through proxy
|
|
123
127
|
|
|
124
128
|
CodeceptJS also provides flexible options when you want to execute tests to Selenium servers through proxy. You will
|
|
125
129
|
need to update the `helpers.WebDriver.capabilities.proxy` key.
|
|
126
130
|
|
|
127
131
|
```js
|
|
128
132
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
helpers: {
|
|
134
|
+
WebDriver: {
|
|
135
|
+
capabilities: {
|
|
136
|
+
proxy: {
|
|
133
137
|
"proxyType": "manual|pac",
|
|
134
138
|
"proxyAutoconfigUrl": "URL TO PAC FILE",
|
|
135
139
|
"httpProxy": "PROXY SERVER",
|
|
@@ -150,10 +154,10 @@ For example,
|
|
|
150
154
|
|
|
151
155
|
```js
|
|
152
156
|
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
+
helpers: {
|
|
158
|
+
WebDriver: {
|
|
159
|
+
capabilities: {
|
|
160
|
+
proxy: {
|
|
157
161
|
"proxyType": "manual",
|
|
158
162
|
"httpProxy": "http://corporate.proxy:8080",
|
|
159
163
|
"socksUsername": "codeceptjs",
|
|
@@ -172,7 +176,7 @@ information.
|
|
|
172
176
|
### Cloud Providers
|
|
173
177
|
|
|
174
178
|
WebDriver makes it possible to execute tests against services like `Sauce Labs` `BrowserStack` `TestingBot`
|
|
175
|
-
Check out their documentation on [available parameters][
|
|
179
|
+
Check out their documentation on [available parameters][9]
|
|
176
180
|
|
|
177
181
|
Connecting to `BrowserStack` and `Sauce Labs` is simple. All you need to do
|
|
178
182
|
is set the `user` and `key` parameters. WebDriver automatically know which
|
|
@@ -180,12 +184,12 @@ service provider to connect to.
|
|
|
180
184
|
|
|
181
185
|
```js
|
|
182
186
|
{
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
helpers:{
|
|
188
|
+
WebDriver: {
|
|
189
|
+
url: "YOUR_DESIRED_HOST",
|
|
190
|
+
user: "YOUR_BROWSERSTACK_USER",
|
|
191
|
+
key: "YOUR_BROWSERSTACK_KEY",
|
|
192
|
+
capabilities: {
|
|
189
193
|
"browserName": "chrome",
|
|
190
194
|
|
|
191
195
|
// only set this if you're using BrowserStackLocal to test a local domain
|
|
@@ -221,9 +225,9 @@ plugins: {
|
|
|
221
225
|
}
|
|
222
226
|
```
|
|
223
227
|
|
|
224
|
-
See [complete reference on webdriver.io][
|
|
228
|
+
See [complete reference on webdriver.io][10].
|
|
225
229
|
|
|
226
|
-
> Alternatively, use [codeceptjs-saucehelper][
|
|
230
|
+
> Alternatively, use [codeceptjs-saucehelper][11] for better reporting.
|
|
227
231
|
|
|
228
232
|
#### BrowserStack
|
|
229
233
|
|
|
@@ -247,13 +251,13 @@ plugins: {
|
|
|
247
251
|
}
|
|
248
252
|
```
|
|
249
253
|
|
|
250
|
-
See [complete reference on webdriver.io][
|
|
254
|
+
See [complete reference on webdriver.io][12].
|
|
251
255
|
|
|
252
|
-
> Alternatively, use [codeceptjs-bshelper][
|
|
256
|
+
> Alternatively, use [codeceptjs-bshelper][13] for better reporting.
|
|
253
257
|
|
|
254
258
|
#### TestingBot
|
|
255
259
|
|
|
256
|
-
>
|
|
260
|
+
> Recommended: use official [TestingBot Helper][14].
|
|
257
261
|
|
|
258
262
|
Alternatively, TestingBot can be configured via wdio service, which should be installed additionally:
|
|
259
263
|
|
|
@@ -275,25 +279,25 @@ plugins: {
|
|
|
275
279
|
}
|
|
276
280
|
```
|
|
277
281
|
|
|
278
|
-
See [complete reference on webdriver.io][
|
|
282
|
+
See [complete reference on webdriver.io][15].
|
|
279
283
|
|
|
280
284
|
#### Applitools
|
|
281
285
|
|
|
282
286
|
Visual testing via Applitools service
|
|
283
287
|
|
|
284
|
-
> Use [CodeceptJS Applitools Helper][
|
|
288
|
+
> Use [CodeceptJS Applitools Helper][16] with Applitools wdio service.
|
|
285
289
|
|
|
286
290
|
### Multiremote Capabilities
|
|
287
291
|
|
|
288
292
|
This is a work in progress but you can control two browsers at a time right out of the box.
|
|
289
293
|
Individual control is something that is planned for a later version.
|
|
290
294
|
|
|
291
|
-
Here is the [webdriverio docs][
|
|
295
|
+
Here is the [webdriverio docs][17] on the subject
|
|
292
296
|
|
|
293
297
|
```js
|
|
294
298
|
{
|
|
295
|
-
|
|
296
|
-
|
|
299
|
+
helpers: {
|
|
300
|
+
WebDriver: {
|
|
297
301
|
"multiremote": {
|
|
298
302
|
"MyChrome": {
|
|
299
303
|
"desiredCapabilities": {
|
|
@@ -338,7 +342,7 @@ this.helpers['WebDriver']._locate({name: 'password'}).then //...
|
|
|
338
342
|
#### Parameters
|
|
339
343
|
|
|
340
344
|
- `locator` element located by CSS|XPath|strict locator.
|
|
341
|
-
- `smartWait`
|
|
345
|
+
- `smartWait`
|
|
342
346
|
|
|
343
347
|
### \_locateCheckable
|
|
344
348
|
|
|
@@ -380,9 +384,7 @@ this.helpers['WebDriver']._locateFields('Your email').then // ...
|
|
|
380
384
|
|
|
381
385
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
382
386
|
Don't confuse popups with modal windows, as created by [various
|
|
383
|
-
libraries][
|
|
384
|
-
|
|
385
|
-
- _Appium_: supported only for web testing
|
|
387
|
+
libraries][18].
|
|
386
388
|
|
|
387
389
|
### amOnPage
|
|
388
390
|
|
|
@@ -397,7 +399,9 @@ I.amOnPage('/login'); // opens a login page
|
|
|
397
399
|
|
|
398
400
|
#### Parameters
|
|
399
401
|
|
|
400
|
-
- `url`
|
|
402
|
+
- `url` [string][19] url path or global url.
|
|
403
|
+
|
|
404
|
+
|
|
401
405
|
|
|
402
406
|
### appendField
|
|
403
407
|
|
|
@@ -410,8 +414,15 @@ I.appendField('#myTextField', 'appended');
|
|
|
410
414
|
|
|
411
415
|
#### Parameters
|
|
412
416
|
|
|
413
|
-
- `field`
|
|
414
|
-
- `value`
|
|
417
|
+
- `field` ([string][19] \| [object][20]) located by label|name|CSS|XPath|strict locator
|
|
418
|
+
- `value` [string][19] text value to append.
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
425
|
+
|
|
415
426
|
|
|
416
427
|
### attachFile
|
|
417
428
|
|
|
@@ -426,16 +437,16 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
426
437
|
|
|
427
438
|
#### Parameters
|
|
428
439
|
|
|
429
|
-
- `locator`
|
|
430
|
-
- `pathToFile`
|
|
440
|
+
- `locator` ([string][19] \| [object][20]) field located by label|name|CSS|XPath|strict locator.
|
|
441
|
+
- `pathToFile` [string][19] local file path relative to codecept.json config file.
|
|
442
|
+
|
|
443
|
+
|
|
431
444
|
Appium: not tested
|
|
432
445
|
|
|
433
446
|
### cancelPopup
|
|
434
447
|
|
|
435
448
|
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
436
449
|
|
|
437
|
-
- _Appium_: supported only for web testing
|
|
438
|
-
|
|
439
450
|
### checkOption
|
|
440
451
|
|
|
441
452
|
Selects a checkbox or radio button.
|
|
@@ -451,9 +462,11 @@ I.checkOption('agree', '//form');
|
|
|
451
462
|
|
|
452
463
|
#### Parameters
|
|
453
464
|
|
|
454
|
-
- `field`
|
|
455
|
-
- `context`
|
|
456
|
-
|
|
465
|
+
- `field` ([string][19] \| [object][20]) checkbox located by label | name | CSS | XPath | strict locator.
|
|
466
|
+
- `context` [string][19] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
Appium: not tested
|
|
457
470
|
|
|
458
471
|
### clearCookie
|
|
459
472
|
|
|
@@ -467,7 +480,9 @@ I.clearCookie('test');
|
|
|
467
480
|
|
|
468
481
|
#### Parameters
|
|
469
482
|
|
|
470
|
-
- `cookie`
|
|
483
|
+
- `cookie` [string][19] (optional, `null` by default) cookie name
|
|
484
|
+
|
|
485
|
+
|
|
471
486
|
|
|
472
487
|
### clearField
|
|
473
488
|
|
|
@@ -481,7 +496,10 @@ I.clearField('#email');
|
|
|
481
496
|
|
|
482
497
|
#### Parameters
|
|
483
498
|
|
|
484
|
-
- `field`
|
|
499
|
+
- `field`
|
|
500
|
+
- `editable` ([string][19] \| [object][20]) field located by label|name|CSS|XPath|strict locator.
|
|
501
|
+
|
|
502
|
+
|
|
485
503
|
|
|
486
504
|
### click
|
|
487
505
|
|
|
@@ -500,7 +518,7 @@ I.click('Submit');
|
|
|
500
518
|
// CSS button
|
|
501
519
|
I.click('#form input[type=submit]');
|
|
502
520
|
// XPath
|
|
503
|
-
I.click('//form
|
|
521
|
+
I.click('//form/[@type=submit]');
|
|
504
522
|
// link in context
|
|
505
523
|
I.click('Logout', '#nav');
|
|
506
524
|
// using strict locator
|
|
@@ -509,8 +527,14 @@ I.click({css: 'nav a.login'});
|
|
|
509
527
|
|
|
510
528
|
#### Parameters
|
|
511
529
|
|
|
512
|
-
- `locator`
|
|
513
|
-
- `context`
|
|
530
|
+
- `locator` ([string][19] \| [object][20]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
531
|
+
- `context` ([string][19] \| [object][20]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
537
|
+
|
|
514
538
|
|
|
515
539
|
### closeCurrentTab
|
|
516
540
|
|
|
@@ -524,18 +548,15 @@ I.closeCurrentTab();
|
|
|
524
548
|
|
|
525
549
|
Close all tabs except for the current one.
|
|
526
550
|
|
|
527
|
-
- _Appium_: supported web test
|
|
528
|
-
|
|
529
551
|
```js
|
|
530
552
|
I.closeOtherTabs();
|
|
531
553
|
```
|
|
532
554
|
|
|
533
555
|
### defineTimeout
|
|
534
556
|
|
|
535
|
-
Set [WebDriver timeouts][
|
|
557
|
+
Set [WebDriver timeouts][21] in realtime.
|
|
536
558
|
|
|
537
|
-
|
|
538
|
-
Timeouts are expected to be passed as object:
|
|
559
|
+
Timeouts are expected to be passed as object:
|
|
539
560
|
|
|
540
561
|
```js
|
|
541
562
|
I.defineTimeout({ script: 5000 });
|
|
@@ -552,55 +573,99 @@ Opposite to `see`. Checks that a text is not present on a page.
|
|
|
552
573
|
Use context parameter to narrow down the search.
|
|
553
574
|
|
|
554
575
|
```js
|
|
555
|
-
I.dontSee('Login'); // assume we are already logged in
|
|
576
|
+
I.dontSee('Login'); // assume we are already logged in.
|
|
577
|
+
I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
556
578
|
```
|
|
557
579
|
|
|
558
580
|
#### Parameters
|
|
559
581
|
|
|
560
|
-
- `text`
|
|
561
|
-
- `context`
|
|
582
|
+
- `text` [string][19] which is not present.
|
|
583
|
+
- `context` ([string][19] \| [object][20]) (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
588
|
+
|
|
562
589
|
|
|
563
590
|
### dontSeeCheckboxIsChecked
|
|
564
591
|
|
|
565
592
|
Verifies that the specified checkbox is not checked.
|
|
566
593
|
|
|
594
|
+
```js
|
|
595
|
+
I.dontSeeeCheckboxIsChedcked('#agree'); // located by ID
|
|
596
|
+
I.dontSeeeCheckboxIsChedcked('I agree to terms'); // located by label
|
|
597
|
+
I.dontSeeeCheckboxIsChedcked('agree'); // located by name
|
|
598
|
+
```
|
|
599
|
+
|
|
567
600
|
#### Parameters
|
|
568
601
|
|
|
569
|
-
- `field`
|
|
602
|
+
- `field` ([string][19] \| [object][20]) located by label|name|CSS|XPath|strict locator.
|
|
603
|
+
|
|
604
|
+
|
|
570
605
|
Appium: not tested
|
|
571
606
|
|
|
572
607
|
### dontSeeCookie
|
|
573
608
|
|
|
574
609
|
Checks that cookie with given name does not exist.
|
|
575
610
|
|
|
611
|
+
```js
|
|
612
|
+
I.dontSeeCookie('auth'); // no auth cookie
|
|
613
|
+
```
|
|
614
|
+
|
|
576
615
|
#### Parameters
|
|
577
616
|
|
|
578
|
-
- `name`
|
|
617
|
+
- `name` [string][19] cookie name.
|
|
618
|
+
|
|
619
|
+
|
|
579
620
|
|
|
580
621
|
### dontSeeCurrentUrlEquals
|
|
581
622
|
|
|
582
623
|
Checks that current url is not equal to provided one.
|
|
583
624
|
If a relative url provided, a configured url will be prepended to it.
|
|
584
625
|
|
|
626
|
+
```js
|
|
627
|
+
I.dontSeeCurrentUrlEquals('/login'); // relative url are ok
|
|
628
|
+
I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok
|
|
629
|
+
```
|
|
630
|
+
|
|
585
631
|
#### Parameters
|
|
586
632
|
|
|
587
|
-
- `url`
|
|
633
|
+
- `url` [string][19] value to check.
|
|
634
|
+
|
|
635
|
+
|
|
588
636
|
|
|
589
637
|
### dontSeeElement
|
|
590
638
|
|
|
591
639
|
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
592
640
|
|
|
641
|
+
```js
|
|
642
|
+
I.dontSeeElement('.modal'); // modal is not shown
|
|
643
|
+
```
|
|
644
|
+
|
|
593
645
|
#### Parameters
|
|
594
646
|
|
|
595
|
-
- `locator`
|
|
647
|
+
- `locator` ([string][19] \| [object][20]) located by CSS|XPath|Strict locator.
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
654
|
+
|
|
596
655
|
|
|
597
656
|
### dontSeeElementInDOM
|
|
598
657
|
|
|
599
658
|
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
600
659
|
|
|
660
|
+
```js
|
|
661
|
+
I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
662
|
+
```
|
|
663
|
+
|
|
601
664
|
#### Parameters
|
|
602
665
|
|
|
603
|
-
- `locator`
|
|
666
|
+
- `locator` ([string][19] \| [object][20]) located by CSS|XPath|Strict locator.
|
|
667
|
+
|
|
668
|
+
|
|
604
669
|
|
|
605
670
|
### dontSeeInCurrentUrl
|
|
606
671
|
|
|
@@ -608,33 +673,55 @@ Checks that current url does not contain a provided fragment.
|
|
|
608
673
|
|
|
609
674
|
#### Parameters
|
|
610
675
|
|
|
611
|
-
- `url`
|
|
676
|
+
- `url` [string][19] value to check.
|
|
677
|
+
|
|
678
|
+
|
|
612
679
|
|
|
613
680
|
### dontSeeInField
|
|
614
681
|
|
|
615
682
|
Checks that value of input field or textare doesn't equal to given value
|
|
616
683
|
Opposite to `seeInField`.
|
|
617
684
|
|
|
685
|
+
```js
|
|
686
|
+
I.dontSeeInField('email', 'user@user.com'); // field by name
|
|
687
|
+
I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
688
|
+
```
|
|
689
|
+
|
|
618
690
|
#### Parameters
|
|
619
691
|
|
|
620
|
-
- `field`
|
|
621
|
-
- `value`
|
|
692
|
+
- `field` ([string][19] \| [object][20]) located by label|name|CSS|XPath|strict locator.
|
|
693
|
+
- `value` [string][19] value to check.
|
|
694
|
+
|
|
695
|
+
|
|
622
696
|
|
|
623
697
|
### dontSeeInSource
|
|
624
698
|
|
|
625
699
|
Checks that the current page does not contains the given string in its raw source code.
|
|
626
700
|
|
|
701
|
+
```js
|
|
702
|
+
I.dontSeeInSource('<!--'); // no comments in source
|
|
703
|
+
```
|
|
704
|
+
|
|
627
705
|
#### Parameters
|
|
628
706
|
|
|
629
|
-
- `text`
|
|
707
|
+
- `text`
|
|
708
|
+
- `value` [string][19] to check.
|
|
709
|
+
|
|
710
|
+
|
|
630
711
|
|
|
631
712
|
### dontSeeInTitle
|
|
632
713
|
|
|
633
714
|
Checks that title does not contain text.
|
|
634
715
|
|
|
716
|
+
```js
|
|
717
|
+
I.dontSeeInTitle('Error');
|
|
718
|
+
```
|
|
719
|
+
|
|
635
720
|
#### Parameters
|
|
636
721
|
|
|
637
|
-
- `text`
|
|
722
|
+
- `text` [string][19] value to check.
|
|
723
|
+
|
|
724
|
+
|
|
638
725
|
|
|
639
726
|
### doubleClick
|
|
640
727
|
|
|
@@ -650,8 +737,14 @@ I.doubleClick('.btn.edit');
|
|
|
650
737
|
|
|
651
738
|
#### Parameters
|
|
652
739
|
|
|
653
|
-
- `locator`
|
|
654
|
-
- `context`
|
|
740
|
+
- `locator` ([string][19] \| [object][20]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
741
|
+
- `context` ([string][19] \| [object][20]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
747
|
+
|
|
655
748
|
|
|
656
749
|
### dragAndDrop
|
|
657
750
|
|
|
@@ -663,8 +756,10 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
663
756
|
|
|
664
757
|
#### Parameters
|
|
665
758
|
|
|
666
|
-
- `srcElement`
|
|
667
|
-
- `destElement`
|
|
759
|
+
- `srcElement` ([string][19] \| [object][20]) located by CSS|XPath|strict locator.
|
|
760
|
+
- `destElement` ([string][19] \| [object][20]) located by CSS|XPath|strict locator.
|
|
761
|
+
|
|
762
|
+
|
|
668
763
|
Appium: not tested
|
|
669
764
|
|
|
670
765
|
### dragSlider
|
|
@@ -679,19 +774,21 @@ I.dragSlider('#slider', -70);
|
|
|
679
774
|
|
|
680
775
|
#### Parameters
|
|
681
776
|
|
|
682
|
-
- `locator`
|
|
683
|
-
- `offsetX`
|
|
777
|
+
- `locator` ([string][19] \| [object][20]) located by label|name|CSS|XPath|strict locator.
|
|
778
|
+
- `offsetX` [number][22] position to drag.
|
|
779
|
+
|
|
780
|
+
|
|
684
781
|
|
|
685
782
|
### executeAsyncScript
|
|
686
783
|
|
|
687
784
|
Executes async script on page.
|
|
688
785
|
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
689
786
|
|
|
690
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][
|
|
787
|
+
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][23].
|
|
691
788
|
|
|
692
789
|
```js
|
|
693
790
|
I.executeAsyncScript(function(done) {
|
|
694
|
-
Vue.nextTick(done); // waiting for next tick
|
|
791
|
+
Vue.nextTick(done); // waiting for next tick
|
|
695
792
|
});
|
|
696
793
|
```
|
|
697
794
|
|
|
@@ -700,14 +797,14 @@ Additional arguments can be passed as well, while `done` function is always last
|
|
|
700
797
|
|
|
701
798
|
```js
|
|
702
799
|
let val = await I.executeAsyncScript(function(url, done) {
|
|
703
|
-
// in browser context
|
|
704
|
-
$.ajax(url, { success: (data) => done(data); }
|
|
800
|
+
// in browser context
|
|
801
|
+
$.ajax(url, { success: (data) => done(data); }
|
|
705
802
|
}, 'http://ajax.callback.url/');
|
|
706
803
|
```
|
|
707
804
|
|
|
708
805
|
#### Parameters
|
|
709
806
|
|
|
710
|
-
- `fn`
|
|
807
|
+
- `fn` ([string][19] \| [function][24]) function to be executed in browser context.
|
|
711
808
|
|
|
712
809
|
### executeScript
|
|
713
810
|
|
|
@@ -721,8 +818,8 @@ Example with jQuery DatePicker:
|
|
|
721
818
|
```js
|
|
722
819
|
// change date of jQuery DatePicker
|
|
723
820
|
I.executeScript(function() {
|
|
724
|
-
// now we are inside browser context
|
|
725
|
-
$('date').datetimepicker('setDate', new Date());
|
|
821
|
+
// now we are inside browser context
|
|
822
|
+
$('date').datetimepicker('setDate', new Date());
|
|
726
823
|
});
|
|
727
824
|
```
|
|
728
825
|
|
|
@@ -730,14 +827,14 @@ Can return values. Don't forget to use `await` to get them.
|
|
|
730
827
|
|
|
731
828
|
```js
|
|
732
829
|
let date = await I.executeScript(function(el) {
|
|
733
|
-
// only basic types can be returned
|
|
734
|
-
return $(el).datetimepicker('getDate').toString();
|
|
830
|
+
// only basic types can be returned
|
|
831
|
+
return $(el).datetimepicker('getDate').toString();
|
|
735
832
|
}, '#date'); // passing jquery selector
|
|
736
833
|
```
|
|
737
834
|
|
|
738
835
|
#### Parameters
|
|
739
836
|
|
|
740
|
-
- `fn`
|
|
837
|
+
- `fn` ([string][19] \| [function][24]) function to be executed in browser context.
|
|
741
838
|
|
|
742
839
|
### fillField
|
|
743
840
|
|
|
@@ -757,14 +854,30 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
757
854
|
|
|
758
855
|
#### Parameters
|
|
759
856
|
|
|
760
|
-
- `field`
|
|
761
|
-
- `value`
|
|
857
|
+
- `field` ([string][19] \| [object][20]) located by label|name|CSS|XPath|strict locator.
|
|
858
|
+
- `value` [string][19] text value to fill.
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
### grabAllWindowHandles
|
|
868
|
+
|
|
869
|
+
Get all Window Handles.
|
|
870
|
+
Useful for referencing a specific handle when calling `I.switchToWindow(handle)`
|
|
871
|
+
|
|
872
|
+
```js
|
|
873
|
+
const windows = await I.grabAllWindowHandles();
|
|
874
|
+
```
|
|
762
875
|
|
|
763
876
|
### grabAttributeFrom
|
|
764
877
|
|
|
765
878
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
766
879
|
An array as a result will be returned if there are more than one matched element.
|
|
767
|
-
Resumes test execution, so
|
|
880
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
768
881
|
|
|
769
882
|
```js
|
|
770
883
|
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
@@ -772,9 +885,13 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
772
885
|
|
|
773
886
|
#### Parameters
|
|
774
887
|
|
|
775
|
-
- `locator`
|
|
776
|
-
- `attr`
|
|
777
|
-
|
|
888
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
889
|
+
- `attr` [string][19] attribute name.
|
|
890
|
+
|
|
891
|
+
Returns [Promise][25]<[string][19]> attribute value
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
Appium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
778
895
|
|
|
779
896
|
### grabBrowserLogs
|
|
780
897
|
|
|
@@ -789,7 +906,8 @@ console.log(JSON.stringify(logs))
|
|
|
789
906
|
|
|
790
907
|
Gets a cookie object by name.
|
|
791
908
|
If none provided gets all cookies.
|
|
792
|
-
|
|
909
|
+
|
|
910
|
+
- Resumes test execution, so should be used inside async with `await` operator.
|
|
793
911
|
|
|
794
912
|
```js
|
|
795
913
|
let cookie = await I.grabCookie('auth');
|
|
@@ -798,12 +916,16 @@ assert(cookie.value, '123456');
|
|
|
798
916
|
|
|
799
917
|
#### Parameters
|
|
800
918
|
|
|
801
|
-
- `name`
|
|
919
|
+
- `name` cookie name.
|
|
920
|
+
|
|
921
|
+
Returns [Promise][25]<[string][19]> attribute value
|
|
922
|
+
|
|
923
|
+
|
|
802
924
|
|
|
803
925
|
### grabCssPropertyFrom
|
|
804
926
|
|
|
805
927
|
Grab CSS property for given locator
|
|
806
|
-
Resumes test execution, so
|
|
928
|
+
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
807
929
|
|
|
808
930
|
```js
|
|
809
931
|
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
@@ -811,8 +933,12 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
811
933
|
|
|
812
934
|
#### Parameters
|
|
813
935
|
|
|
814
|
-
- `locator`
|
|
815
|
-
- `cssProperty`
|
|
936
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
937
|
+
- `cssProperty` [string][19] CSS property name.
|
|
938
|
+
|
|
939
|
+
Returns [Promise][25]<[string][19]> CSS value
|
|
940
|
+
|
|
941
|
+
|
|
816
942
|
|
|
817
943
|
### grabCurrentUrl
|
|
818
944
|
|
|
@@ -824,10 +950,23 @@ let url = await I.grabCurrentUrl();
|
|
|
824
950
|
console.log(`Current URL is [${url}]`);
|
|
825
951
|
```
|
|
826
952
|
|
|
953
|
+
Returns [Promise][25]<[string][19]> current URL
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
### grabCurrentWindowHandle
|
|
958
|
+
|
|
959
|
+
Get the current Window Handle.
|
|
960
|
+
Useful for referencing it when calling `I.switchToWindow(handle)`
|
|
961
|
+
|
|
962
|
+
```js
|
|
963
|
+
const window = await I.grabCurrentWindowHandle();
|
|
964
|
+
```
|
|
965
|
+
|
|
827
966
|
### grabHTMLFrom
|
|
828
967
|
|
|
829
968
|
Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
|
|
830
|
-
Resumes test execution, so
|
|
969
|
+
Resumes test execution, so should be used inside async function with `await` operator.
|
|
831
970
|
If more than one element is found - an array of HTMLs returned.
|
|
832
971
|
|
|
833
972
|
```js
|
|
@@ -836,37 +975,53 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
836
975
|
|
|
837
976
|
#### Parameters
|
|
838
977
|
|
|
839
|
-
- `locator` element located by CSS|XPath|strict locator
|
|
978
|
+
- `locator` element located by CSS|XPath|strict locator.
|
|
979
|
+
|
|
980
|
+
Returns [Promise][25]<[string][19]> HTML code for an element
|
|
981
|
+
|
|
982
|
+
|
|
840
983
|
|
|
841
984
|
### grabNumberOfOpenTabs
|
|
842
985
|
|
|
843
986
|
Grab number of open tabs.
|
|
844
987
|
|
|
845
988
|
```js
|
|
846
|
-
I.grabNumberOfOpenTabs();
|
|
989
|
+
let tabs = await I.grabNumberOfOpenTabs();
|
|
847
990
|
```
|
|
848
991
|
|
|
992
|
+
Returns [Promise][25]<[number][22]> number of open tabs
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
849
996
|
### grabNumberOfVisibleElements
|
|
850
997
|
|
|
851
998
|
Grab number of visible elements by locator.
|
|
852
999
|
|
|
853
1000
|
```js
|
|
854
|
-
I.grabNumberOfVisibleElements('p');
|
|
1001
|
+
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
855
1002
|
```
|
|
856
1003
|
|
|
857
1004
|
#### Parameters
|
|
858
1005
|
|
|
859
|
-
- `locator`
|
|
1006
|
+
- `locator` ([string][19] \| [object][20]) located by CSS|XPath|strict locator.
|
|
1007
|
+
|
|
1008
|
+
Returns [Promise][25]<[number][22]> number of visible elements
|
|
1009
|
+
|
|
1010
|
+
|
|
860
1011
|
|
|
861
1012
|
### grabPageScrollPosition
|
|
862
1013
|
|
|
863
1014
|
Retrieves a page scroll position and returns it to test.
|
|
864
|
-
Resumes test execution, so
|
|
1015
|
+
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
865
1016
|
|
|
866
1017
|
```js
|
|
867
1018
|
let { x, y } = await I.grabPageScrollPosition();
|
|
868
1019
|
```
|
|
869
1020
|
|
|
1021
|
+
Returns [Promise][25]<[object][20]> scroll position
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
870
1025
|
### grabPopupText
|
|
871
1026
|
|
|
872
1027
|
Grab the text within the popup. If no popup is visible then it will return null.
|
|
@@ -884,12 +1039,14 @@ Resumes test execution, so should be used inside an async function.
|
|
|
884
1039
|
let pageSource = await I.grabSource();
|
|
885
1040
|
```
|
|
886
1041
|
|
|
887
|
-
|
|
1042
|
+
Returns [Promise][25]<[string][19]> source code
|
|
1043
|
+
|
|
1044
|
+
|
|
888
1045
|
|
|
889
1046
|
### grabTextFrom
|
|
890
1047
|
|
|
891
1048
|
Retrieves a text from an element located by CSS or XPath and returns it to test.
|
|
892
|
-
Resumes test execution, so
|
|
1049
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
893
1050
|
|
|
894
1051
|
```js
|
|
895
1052
|
let pin = await I.grabTextFrom('#pin');
|
|
@@ -899,23 +1056,29 @@ If multiple elements found returns an array of texts.
|
|
|
899
1056
|
|
|
900
1057
|
#### Parameters
|
|
901
1058
|
|
|
902
|
-
- `locator` element located by CSS|XPath|strict locator
|
|
1059
|
+
- `locator` element located by CSS|XPath|strict locator.
|
|
1060
|
+
|
|
1061
|
+
Returns [Promise][25]<[string][19]> attribute value
|
|
1062
|
+
|
|
1063
|
+
|
|
903
1064
|
|
|
904
1065
|
### grabTitle
|
|
905
1066
|
|
|
906
1067
|
Retrieves a page title and returns it to test.
|
|
907
|
-
Resumes test execution, so
|
|
1068
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
908
1069
|
|
|
909
1070
|
```js
|
|
910
1071
|
let title = await I.grabTitle();
|
|
911
1072
|
```
|
|
912
1073
|
|
|
913
|
-
|
|
1074
|
+
Returns [Promise][25]<[string][19]> title
|
|
1075
|
+
|
|
1076
|
+
|
|
914
1077
|
|
|
915
1078
|
### grabValueFrom
|
|
916
1079
|
|
|
917
1080
|
Retrieves a value from a form element located by CSS or XPath and returns it to test.
|
|
918
|
-
Resumes test execution, so
|
|
1081
|
+
Resumes test execution, so should be used inside async function with `await` operator.
|
|
919
1082
|
|
|
920
1083
|
```js
|
|
921
1084
|
let email = await I.grabValueFrom('input[name=email]');
|
|
@@ -923,7 +1086,11 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
923
1086
|
|
|
924
1087
|
#### Parameters
|
|
925
1088
|
|
|
926
|
-
- `locator`
|
|
1089
|
+
- `locator` ([string][19] \| [object][20]) field located by label|name|CSS|XPath|strict locator.
|
|
1090
|
+
|
|
1091
|
+
Returns [Promise][25]<[string][19]> attribute value
|
|
1092
|
+
|
|
1093
|
+
|
|
927
1094
|
|
|
928
1095
|
### moveCursorTo
|
|
929
1096
|
|
|
@@ -937,9 +1104,11 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
937
1104
|
|
|
938
1105
|
#### Parameters
|
|
939
1106
|
|
|
940
|
-
- `locator`
|
|
941
|
-
- `offsetX`
|
|
942
|
-
- `offsetY`
|
|
1107
|
+
- `locator` ([string][19] \| [object][20]) located by CSS|XPath|strict locator.
|
|
1108
|
+
- `offsetX` [number][22] (optional, `0` by default) X-axis offset.
|
|
1109
|
+
- `offsetY` [number][22] (optional, `0` by default) Y-axis offset.
|
|
1110
|
+
|
|
1111
|
+
|
|
943
1112
|
|
|
944
1113
|
### openNewTab
|
|
945
1114
|
|
|
@@ -952,7 +1121,7 @@ I.openNewTab();
|
|
|
952
1121
|
### pressKey
|
|
953
1122
|
|
|
954
1123
|
Presses a key on a focused element.
|
|
955
|
-
Special keys like 'Enter', 'Control', [etc][
|
|
1124
|
+
Special keys like 'Enter', 'Control', [etc][26]
|
|
956
1125
|
will be replaced with corresponding unicode.
|
|
957
1126
|
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
|
|
958
1127
|
|
|
@@ -963,36 +1132,43 @@ I.pressKey(['Control','a']);
|
|
|
963
1132
|
|
|
964
1133
|
#### Parameters
|
|
965
1134
|
|
|
966
|
-
- `key`
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1135
|
+
- `key` ([string][19] \| [array][27]) key or array of keys to press.
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
[Valid key names](https://w3c.github.io/webdriver/#keyboard-actions) are:
|
|
1142
|
+
|
|
1143
|
+
- `'Add'`,
|
|
1144
|
+
- `'Alt'`,
|
|
1145
|
+
- `'ArrowDown'` or `'Down arrow'`,
|
|
1146
|
+
- `'ArrowLeft'` or `'Left arrow'`,
|
|
1147
|
+
- `'ArrowRight'` or `'Right arrow'`,
|
|
1148
|
+
- `'ArrowUp'` or `'Up arrow'`,
|
|
1149
|
+
- `'Backspace'`,
|
|
1150
|
+
- `'Command'`,
|
|
1151
|
+
- `'Control'`,
|
|
1152
|
+
- `'Del'`,
|
|
1153
|
+
- `'Divide'`,
|
|
1154
|
+
- `'End'`,
|
|
1155
|
+
- `'Enter'`,
|
|
1156
|
+
- `'Equals'`,
|
|
1157
|
+
- `'Escape'`,
|
|
1158
|
+
- `'F1 to F12'`,
|
|
1159
|
+
- `'Home'`,
|
|
1160
|
+
- `'Insert'`,
|
|
1161
|
+
- `'Meta'`,
|
|
1162
|
+
- `'Multiply'`,
|
|
1163
|
+
- `'Numpad 0'` to `'Numpad 9'`,
|
|
1164
|
+
- `'Pagedown'` or `'PageDown'`,
|
|
1165
|
+
- `'Pageup'` or `'PageUp'`,
|
|
1166
|
+
- `'Pause'`,
|
|
1167
|
+
- `'Semicolon'`,
|
|
1168
|
+
- `'Shift'`,
|
|
1169
|
+
- `'Space'`,
|
|
1170
|
+
- `'Subtract'`,
|
|
1171
|
+
- `'Tab'`.To make combinations with modifier and mouse clicks (like Ctrl+Click) press a modifier, click, then release it.```js
|
|
996
1172
|
I.pressKey('Control');
|
|
997
1173
|
I.click('#someelement');
|
|
998
1174
|
I.pressKey('Control');
|
|
@@ -1006,6 +1182,9 @@ Reload the current page.
|
|
|
1006
1182
|
I.refreshPage();
|
|
1007
1183
|
```
|
|
1008
1184
|
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
|
|
1009
1188
|
### resizeWindow
|
|
1010
1189
|
|
|
1011
1190
|
Resize the current window to provided width and height.
|
|
@@ -1013,8 +1192,10 @@ First parameter can be set to `maximize`.
|
|
|
1013
1192
|
|
|
1014
1193
|
#### Parameters
|
|
1015
1194
|
|
|
1016
|
-
- `width`
|
|
1017
|
-
- `height`
|
|
1195
|
+
- `width` [number][22] width in pixels or `maximize`.
|
|
1196
|
+
- `height` [number][22] height in pixels.
|
|
1197
|
+
|
|
1198
|
+
|
|
1018
1199
|
Appium: not tested in web, in apps doesn't work
|
|
1019
1200
|
|
|
1020
1201
|
### rightClick
|
|
@@ -1032,8 +1213,14 @@ I.rightClick('Click me', '.context');
|
|
|
1032
1213
|
|
|
1033
1214
|
#### Parameters
|
|
1034
1215
|
|
|
1035
|
-
- `locator`
|
|
1036
|
-
- `context`
|
|
1216
|
+
- `locator` ([string][19] \| [object][20]) clickable element located by CSS|XPath|strict locator.
|
|
1217
|
+
- `context` ([string][19] \| [object][20]) (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1223
|
+
|
|
1037
1224
|
|
|
1038
1225
|
### runInWeb
|
|
1039
1226
|
|
|
@@ -1064,7 +1251,7 @@ Placeholder for ~ locator only test case write once run on both Appium and WebDr
|
|
|
1064
1251
|
### saveScreenshot
|
|
1065
1252
|
|
|
1066
1253
|
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
1067
|
-
Filename is relative to output folder.
|
|
1254
|
+
Filename is relative to output folder.
|
|
1068
1255
|
Optionally resize the window to the full available page `scrollHeight` and `scrollWidth` to capture the entire page by passing `true` in as the second argument.
|
|
1069
1256
|
|
|
1070
1257
|
```js
|
|
@@ -1074,8 +1261,10 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1074
1261
|
|
|
1075
1262
|
#### Parameters
|
|
1076
1263
|
|
|
1077
|
-
- `fileName`
|
|
1078
|
-
- `fullPage`
|
|
1264
|
+
- `fileName` [string][19] file name to save.
|
|
1265
|
+
- `fullPage` [boolean][28] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1266
|
+
|
|
1267
|
+
|
|
1079
1268
|
|
|
1080
1269
|
### scrollPageToBottom
|
|
1081
1270
|
|
|
@@ -1085,6 +1274,9 @@ Scroll page to the bottom.
|
|
|
1085
1274
|
I.scrollPageToBottom();
|
|
1086
1275
|
```
|
|
1087
1276
|
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
|
|
1088
1280
|
### scrollPageToTop
|
|
1089
1281
|
|
|
1090
1282
|
Scroll page to the top.
|
|
@@ -1093,21 +1285,8 @@ Scroll page to the top.
|
|
|
1093
1285
|
I.scrollPageToTop();
|
|
1094
1286
|
```
|
|
1095
1287
|
|
|
1096
|
-
### scrollTo
|
|
1097
|
-
|
|
1098
|
-
Scrolls to element matched by locator.
|
|
1099
|
-
Extra shift can be set with offsetX and offsetY options.
|
|
1100
1288
|
|
|
1101
|
-
```js
|
|
1102
|
-
I.scrollTo('footer');
|
|
1103
|
-
I.scrollTo('#submit', 5, 5);
|
|
1104
|
-
```
|
|
1105
1289
|
|
|
1106
|
-
#### Parameters
|
|
1107
|
-
|
|
1108
|
-
- `locator` located by CSS|XPath|strict locator.
|
|
1109
|
-
- `offsetX` (optional) X-axis offset.
|
|
1110
|
-
- `offsetY` (optional) Y-axis offset.- _Appium_: supported only for web testing
|
|
1111
1290
|
|
|
1112
1291
|
### scrollTo
|
|
1113
1292
|
|
|
@@ -1121,9 +1300,11 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1121
1300
|
|
|
1122
1301
|
#### Parameters
|
|
1123
1302
|
|
|
1124
|
-
- `locator`
|
|
1125
|
-
- `offsetX`
|
|
1126
|
-
- `offsetY`
|
|
1303
|
+
- `locator` ([string][19] \| [object][20]) located by CSS|XPath|strict locator.
|
|
1304
|
+
- `offsetX` [number][22] (optional, `0` by default) X-axis offset.
|
|
1305
|
+
- `offsetY` [number][22] (optional, `0` by default) Y-axis offset.
|
|
1306
|
+
|
|
1307
|
+
|
|
1127
1308
|
|
|
1128
1309
|
### see
|
|
1129
1310
|
|
|
@@ -1138,21 +1319,29 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1138
1319
|
|
|
1139
1320
|
#### Parameters
|
|
1140
1321
|
|
|
1141
|
-
- `text`
|
|
1142
|
-
- `context`
|
|
1322
|
+
- `text` [string][19] expected on page.
|
|
1323
|
+
- `context` ([string][19] \| [object][20]) (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1329
|
+
|
|
1143
1330
|
|
|
1144
1331
|
### seeAttributesOnElements
|
|
1145
1332
|
|
|
1146
1333
|
Checks that all elements with given locator have given attributes.
|
|
1147
1334
|
|
|
1148
1335
|
```js
|
|
1149
|
-
I.seeAttributesOnElements('//form', {
|
|
1336
|
+
I.seeAttributesOnElements('//form', { method: "post"});
|
|
1150
1337
|
```
|
|
1151
1338
|
|
|
1152
1339
|
#### Parameters
|
|
1153
1340
|
|
|
1154
|
-
- `locator`
|
|
1155
|
-
- `attributes`
|
|
1341
|
+
- `locator` ([string][19] \| [object][20]) located by CSS|XPath|strict locator.
|
|
1342
|
+
- `attributes` [object][20] attributes and their values to check.
|
|
1343
|
+
|
|
1344
|
+
|
|
1156
1345
|
|
|
1157
1346
|
### seeCheckboxIsChecked
|
|
1158
1347
|
|
|
@@ -1166,7 +1355,9 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1166
1355
|
|
|
1167
1356
|
#### Parameters
|
|
1168
1357
|
|
|
1169
|
-
- `field`
|
|
1358
|
+
- `field` ([string][19] \| [object][20]) located by label|name|CSS|XPath|strict locator.
|
|
1359
|
+
|
|
1360
|
+
|
|
1170
1361
|
Appium: not tested
|
|
1171
1362
|
|
|
1172
1363
|
### seeCookie
|
|
@@ -1179,7 +1370,9 @@ I.seeCookie('Auth');
|
|
|
1179
1370
|
|
|
1180
1371
|
#### Parameters
|
|
1181
1372
|
|
|
1182
|
-
- `name`
|
|
1373
|
+
- `name` [string][19] cookie name.
|
|
1374
|
+
|
|
1375
|
+
|
|
1183
1376
|
|
|
1184
1377
|
### seeCssPropertiesOnElements
|
|
1185
1378
|
|
|
@@ -1191,8 +1384,10 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1191
1384
|
|
|
1192
1385
|
#### Parameters
|
|
1193
1386
|
|
|
1194
|
-
- `locator`
|
|
1195
|
-
- `cssProperties`
|
|
1387
|
+
- `locator` ([string][19] \| [object][20]) located by CSS|XPath|strict locator.
|
|
1388
|
+
- `cssProperties` [object][20] object with CSS properties and their values to check.
|
|
1389
|
+
|
|
1390
|
+
|
|
1196
1391
|
|
|
1197
1392
|
### seeCurrentUrlEquals
|
|
1198
1393
|
|
|
@@ -1207,7 +1402,9 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1207
1402
|
|
|
1208
1403
|
#### Parameters
|
|
1209
1404
|
|
|
1210
|
-
- `url`
|
|
1405
|
+
- `url` [string][19] value to check.
|
|
1406
|
+
|
|
1407
|
+
|
|
1211
1408
|
|
|
1212
1409
|
### seeElement
|
|
1213
1410
|
|
|
@@ -1220,7 +1417,14 @@ I.seeElement('#modal');
|
|
|
1220
1417
|
|
|
1221
1418
|
#### Parameters
|
|
1222
1419
|
|
|
1223
|
-
- `locator`
|
|
1420
|
+
- `locator` ([string][19] \| [object][20]) located by CSS|XPath|strict locator.
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
|
|
1426
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1427
|
+
|
|
1224
1428
|
|
|
1225
1429
|
### seeElementInDOM
|
|
1226
1430
|
|
|
@@ -1233,7 +1437,9 @@ I.seeElementInDOM('#modal');
|
|
|
1233
1437
|
|
|
1234
1438
|
#### Parameters
|
|
1235
1439
|
|
|
1236
|
-
- `locator`
|
|
1440
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1441
|
+
|
|
1442
|
+
|
|
1237
1443
|
|
|
1238
1444
|
### seeInCurrentUrl
|
|
1239
1445
|
|
|
@@ -1245,7 +1451,9 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1245
1451
|
|
|
1246
1452
|
#### Parameters
|
|
1247
1453
|
|
|
1248
|
-
- `url`
|
|
1454
|
+
- `url` [string][19] a fragment to check
|
|
1455
|
+
|
|
1456
|
+
|
|
1249
1457
|
|
|
1250
1458
|
### seeInField
|
|
1251
1459
|
|
|
@@ -1261,16 +1469,16 @@ I.seeInField('#searchform input','Search');
|
|
|
1261
1469
|
|
|
1262
1470
|
#### Parameters
|
|
1263
1471
|
|
|
1264
|
-
- `field`
|
|
1265
|
-
- `value`
|
|
1472
|
+
- `field` ([string][19] \| [object][20]) located by label|name|CSS|XPath|strict locator.
|
|
1473
|
+
- `value` [string][19] value to check.
|
|
1474
|
+
|
|
1475
|
+
|
|
1266
1476
|
|
|
1267
1477
|
### seeInPopup
|
|
1268
1478
|
|
|
1269
1479
|
Checks that the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`, contains the
|
|
1270
1480
|
given string.
|
|
1271
1481
|
|
|
1272
|
-
- _Appium_: supported only for web testing
|
|
1273
|
-
|
|
1274
1482
|
#### Parameters
|
|
1275
1483
|
|
|
1276
1484
|
- `text` value to check.
|
|
@@ -1285,31 +1493,44 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1285
1493
|
|
|
1286
1494
|
#### Parameters
|
|
1287
1495
|
|
|
1288
|
-
- `text`
|
|
1496
|
+
- `text` [string][19] value to check.
|
|
1497
|
+
|
|
1498
|
+
|
|
1289
1499
|
|
|
1290
1500
|
### seeInTitle
|
|
1291
1501
|
|
|
1292
1502
|
Checks that title contains text.
|
|
1293
1503
|
|
|
1504
|
+
```js
|
|
1505
|
+
I.seeInTitle('Home Page');
|
|
1506
|
+
```
|
|
1507
|
+
|
|
1294
1508
|
#### Parameters
|
|
1295
1509
|
|
|
1296
|
-
- `text`
|
|
1510
|
+
- `text` [string][19] text value to check.
|
|
1511
|
+
|
|
1512
|
+
|
|
1297
1513
|
|
|
1298
1514
|
### seeNumberOfElements
|
|
1299
1515
|
|
|
1300
1516
|
Asserts that an element appears a given number of times in the DOM.
|
|
1301
1517
|
Element is located by label or name or CSS or XPath.
|
|
1302
1518
|
|
|
1303
|
-
- _Appium_: supported
|
|
1304
|
-
|
|
1305
1519
|
```js
|
|
1306
1520
|
I.seeNumberOfElements('#submitBtn', 1);
|
|
1307
1521
|
```
|
|
1308
1522
|
|
|
1309
1523
|
#### Parameters
|
|
1310
1524
|
|
|
1311
|
-
- `locator`
|
|
1312
|
-
- `num`
|
|
1525
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1526
|
+
- `num` [number][22] number of elements.
|
|
1527
|
+
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
|
|
1531
|
+
|
|
1532
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1533
|
+
|
|
1313
1534
|
|
|
1314
1535
|
### seeNumberOfVisibleElements
|
|
1315
1536
|
|
|
@@ -1322,8 +1543,15 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1322
1543
|
|
|
1323
1544
|
#### Parameters
|
|
1324
1545
|
|
|
1325
|
-
- `locator`
|
|
1326
|
-
- `num`
|
|
1546
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1547
|
+
- `num` [number][22] number of elements.
|
|
1548
|
+
|
|
1549
|
+
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1554
|
+
|
|
1327
1555
|
|
|
1328
1556
|
### seeTextEquals
|
|
1329
1557
|
|
|
@@ -1373,8 +1601,10 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1373
1601
|
|
|
1374
1602
|
#### Parameters
|
|
1375
1603
|
|
|
1376
|
-
- `select`
|
|
1377
|
-
- `option`
|
|
1604
|
+
- `select` ([string][19] \| [object][20]) field located by label|name|CSS|XPath|strict locator.
|
|
1605
|
+
- `option` ([string][19] \| [array][27]) visible text or value of option.
|
|
1606
|
+
|
|
1607
|
+
|
|
1378
1608
|
|
|
1379
1609
|
### setCookie
|
|
1380
1610
|
|
|
@@ -1386,16 +1616,25 @@ I.setCookie({name: 'auth', value: true});
|
|
|
1386
1616
|
|
|
1387
1617
|
#### Parameters
|
|
1388
1618
|
|
|
1389
|
-
- `cookie`
|
|
1390
|
-
|
|
1619
|
+
- `cookie` [object][20] a cookie object.
|
|
1620
|
+
|
|
1621
|
+
Uses Selenium's JSON [cookie
|
|
1622
|
+
format][29].
|
|
1391
1623
|
|
|
1392
1624
|
### switchTo
|
|
1393
1625
|
|
|
1394
1626
|
Switches frame or in case of null locator reverts to parent.
|
|
1395
1627
|
|
|
1628
|
+
```js
|
|
1629
|
+
I.switchTo('iframe'); // switch to first iframe
|
|
1630
|
+
I.switchTo(); // switch back to main page
|
|
1631
|
+
```
|
|
1632
|
+
|
|
1396
1633
|
#### Parameters
|
|
1397
1634
|
|
|
1398
|
-
- `locator`
|
|
1635
|
+
- `locator` ([string][19] \| [object][20]) (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1636
|
+
|
|
1637
|
+
|
|
1399
1638
|
|
|
1400
1639
|
### switchToNextTab
|
|
1401
1640
|
|
|
@@ -1425,6 +1664,24 @@ I.switchToPreviousTab(2);
|
|
|
1425
1664
|
- `num` (optional) number of tabs to switch backward, default: 1.
|
|
1426
1665
|
- `sec` (optional) time in seconds to wait.
|
|
1427
1666
|
|
|
1667
|
+
### switchToWindow
|
|
1668
|
+
|
|
1669
|
+
Switch to the window with a specified handle.
|
|
1670
|
+
|
|
1671
|
+
```js
|
|
1672
|
+
const windows = await I.grabAllWindowHandles();
|
|
1673
|
+
// ... do something
|
|
1674
|
+
await I.switchToWindow( windows[0] );
|
|
1675
|
+
|
|
1676
|
+
const window = await.grabCurrentWindowHandle();
|
|
1677
|
+
// ... do something
|
|
1678
|
+
await I.switchToWindow( window );
|
|
1679
|
+
```
|
|
1680
|
+
|
|
1681
|
+
#### Parameters
|
|
1682
|
+
|
|
1683
|
+
- `window`
|
|
1684
|
+
|
|
1428
1685
|
### uncheckOption
|
|
1429
1686
|
|
|
1430
1687
|
Unselects a checkbox or radio button.
|
|
@@ -1440,9 +1697,11 @@ I.uncheckOption('agree', '//form');
|
|
|
1440
1697
|
|
|
1441
1698
|
#### Parameters
|
|
1442
1699
|
|
|
1443
|
-
- `field`
|
|
1444
|
-
- `context`
|
|
1445
|
-
|
|
1700
|
+
- `field` ([string][19] \| [object][20]) checkbox located by label | name | CSS | XPath | strict locator.
|
|
1701
|
+
- `context` [string][19] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
Appium: not tested
|
|
1446
1705
|
|
|
1447
1706
|
### wait
|
|
1448
1707
|
|
|
@@ -1454,19 +1713,25 @@ I.wait(2); // wait 2 secs
|
|
|
1454
1713
|
|
|
1455
1714
|
#### Parameters
|
|
1456
1715
|
|
|
1457
|
-
- `sec`
|
|
1716
|
+
- `sec` [number][22] number of second to wait.
|
|
1717
|
+
|
|
1718
|
+
|
|
1458
1719
|
|
|
1459
1720
|
### waitForDetached
|
|
1460
1721
|
|
|
1461
1722
|
Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
1462
1723
|
Element can be located by CSS or XPath.
|
|
1463
1724
|
|
|
1464
|
-
|
|
1725
|
+
```js
|
|
1726
|
+
I.waitForDetached('#popup');
|
|
1727
|
+
```
|
|
1465
1728
|
|
|
1466
1729
|
#### Parameters
|
|
1467
1730
|
|
|
1468
|
-
- `locator`
|
|
1469
|
-
- `sec`
|
|
1731
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1732
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1733
|
+
|
|
1734
|
+
|
|
1470
1735
|
|
|
1471
1736
|
### waitForElement
|
|
1472
1737
|
|
|
@@ -1480,8 +1745,10 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1480
1745
|
|
|
1481
1746
|
#### Parameters
|
|
1482
1747
|
|
|
1483
|
-
- `locator`
|
|
1484
|
-
- `sec`
|
|
1748
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1749
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1750
|
+
|
|
1751
|
+
|
|
1485
1752
|
|
|
1486
1753
|
### waitForEnabled
|
|
1487
1754
|
|
|
@@ -1490,8 +1757,10 @@ Element can be located by CSS or XPath.
|
|
|
1490
1757
|
|
|
1491
1758
|
#### Parameters
|
|
1492
1759
|
|
|
1493
|
-
- `locator`
|
|
1494
|
-
- `sec` (optional) time in seconds to wait, 1 by default
|
|
1760
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1761
|
+
- `sec` (optional) time in seconds to wait, 1 by default.
|
|
1762
|
+
|
|
1763
|
+
|
|
1495
1764
|
|
|
1496
1765
|
### waitForFunction
|
|
1497
1766
|
|
|
@@ -1510,21 +1779,27 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1510
1779
|
|
|
1511
1780
|
#### Parameters
|
|
1512
1781
|
|
|
1513
|
-
- `fn`
|
|
1514
|
-
- `argsOrSec`
|
|
1515
|
-
- `sec`
|
|
1782
|
+
- `fn` ([string][19] \| [function][24]) to be executed in browser context.
|
|
1783
|
+
- `argsOrSec` ([array][27] \| [number][22]) (optional, `1` by default) arguments for function or seconds.
|
|
1784
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1785
|
+
|
|
1786
|
+
|
|
1516
1787
|
|
|
1517
1788
|
### waitForInvisible
|
|
1518
1789
|
|
|
1519
1790
|
Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
|
|
1520
1791
|
Element can be located by CSS or XPath.
|
|
1521
1792
|
|
|
1522
|
-
|
|
1793
|
+
```js
|
|
1794
|
+
I.waitForInvisible('#popup');
|
|
1795
|
+
```
|
|
1523
1796
|
|
|
1524
1797
|
#### Parameters
|
|
1525
1798
|
|
|
1526
|
-
- `locator`
|
|
1527
|
-
- `sec`
|
|
1799
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1800
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1801
|
+
|
|
1802
|
+
|
|
1528
1803
|
|
|
1529
1804
|
### waitForText
|
|
1530
1805
|
|
|
@@ -1539,9 +1814,11 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1539
1814
|
|
|
1540
1815
|
#### Parameters
|
|
1541
1816
|
|
|
1542
|
-
- `text`
|
|
1543
|
-
- `sec`
|
|
1544
|
-
- `context`
|
|
1817
|
+
- `text` [string][19] to wait for.
|
|
1818
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1819
|
+
- `context` ([string][19] \| [object][20]) (optional) element located by CSS|XPath|strict locator.
|
|
1820
|
+
|
|
1821
|
+
|
|
1545
1822
|
|
|
1546
1823
|
### waitForValue
|
|
1547
1824
|
|
|
@@ -1553,21 +1830,27 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1553
1830
|
|
|
1554
1831
|
#### Parameters
|
|
1555
1832
|
|
|
1556
|
-
- `field`
|
|
1557
|
-
- `value`
|
|
1558
|
-
- `sec`
|
|
1833
|
+
- `field` ([string][19] \| [object][20]) input field.
|
|
1834
|
+
- `value` [string][19] expected value.
|
|
1835
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1836
|
+
|
|
1837
|
+
|
|
1559
1838
|
|
|
1560
1839
|
### waitForVisible
|
|
1561
1840
|
|
|
1562
1841
|
Waits for an element to become visible on a page (by default waits for 1sec).
|
|
1563
1842
|
Element can be located by CSS or XPath.
|
|
1564
1843
|
|
|
1565
|
-
|
|
1844
|
+
```js
|
|
1845
|
+
I.waitForVisible('#popup');
|
|
1846
|
+
```
|
|
1566
1847
|
|
|
1567
1848
|
#### Parameters
|
|
1568
1849
|
|
|
1569
|
-
- `locator`
|
|
1570
|
-
- `sec`
|
|
1850
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1851
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1852
|
+
|
|
1853
|
+
|
|
1571
1854
|
|
|
1572
1855
|
### waitInUrl
|
|
1573
1856
|
|
|
@@ -1579,8 +1862,10 @@ I.waitInUrl('/info', 2);
|
|
|
1579
1862
|
|
|
1580
1863
|
#### Parameters
|
|
1581
1864
|
|
|
1582
|
-
- `urlPart`
|
|
1583
|
-
- `sec`
|
|
1865
|
+
- `urlPart` [string][19] value to check.
|
|
1866
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1867
|
+
|
|
1868
|
+
|
|
1584
1869
|
|
|
1585
1870
|
### waitNumberOfVisibleElements
|
|
1586
1871
|
|
|
@@ -1592,21 +1877,27 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1592
1877
|
|
|
1593
1878
|
#### Parameters
|
|
1594
1879
|
|
|
1595
|
-
- `locator`
|
|
1596
|
-
- `num`
|
|
1597
|
-
- `sec`
|
|
1880
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1881
|
+
- `num` [number][22] number of elements.
|
|
1882
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1883
|
+
|
|
1884
|
+
|
|
1598
1885
|
|
|
1599
1886
|
### waitToHide
|
|
1600
1887
|
|
|
1601
1888
|
Waits for an element to hide (by default waits for 1sec).
|
|
1602
1889
|
Element can be located by CSS or XPath.
|
|
1603
1890
|
|
|
1604
|
-
|
|
1891
|
+
```js
|
|
1892
|
+
I.waitToHide('#popup');
|
|
1893
|
+
```
|
|
1605
1894
|
|
|
1606
1895
|
#### Parameters
|
|
1607
1896
|
|
|
1608
|
-
- `locator`
|
|
1609
|
-
- `sec`
|
|
1897
|
+
- `locator` ([string][19] \| [object][20]) element located by CSS|XPath|strict locator.
|
|
1898
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1899
|
+
|
|
1900
|
+
|
|
1610
1901
|
|
|
1611
1902
|
### waitUntil
|
|
1612
1903
|
|
|
@@ -1619,10 +1910,12 @@ I.waitUntil(() => window.requests == 0, 5);
|
|
|
1619
1910
|
|
|
1620
1911
|
#### Parameters
|
|
1621
1912
|
|
|
1622
|
-
- `fn`
|
|
1623
|
-
- `sec`
|
|
1624
|
-
- `timeoutMsg`
|
|
1625
|
-
|
|
1913
|
+
- `fn` ([function][24] \| [string][19]) function which is executed in browser context.
|
|
1914
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1915
|
+
- `timeoutMsg` [string][19] message to show in case of timeout fail.
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
- `interval`
|
|
1626
1919
|
|
|
1627
1920
|
### waitUrlEquals
|
|
1628
1921
|
|
|
@@ -1635,8 +1928,10 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1635
1928
|
|
|
1636
1929
|
#### Parameters
|
|
1637
1930
|
|
|
1638
|
-
- `urlPart`
|
|
1639
|
-
- `sec`
|
|
1931
|
+
- `urlPart` [string][19] value to check.
|
|
1932
|
+
- `sec` [number][22] (optional, `1` by default) time in seconds to wait
|
|
1933
|
+
|
|
1934
|
+
|
|
1640
1935
|
|
|
1641
1936
|
[1]: http://webdriver.io/
|
|
1642
1937
|
|
|
@@ -1652,32 +1947,46 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1652
1947
|
|
|
1653
1948
|
[7]: https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/IE/Options.html
|
|
1654
1949
|
|
|
1655
|
-
[8]:
|
|
1950
|
+
[8]: https://aerokube.com/selenoid/latest/
|
|
1951
|
+
|
|
1952
|
+
[9]: http://webdriver.io/guide/usage/cloudservices.html
|
|
1953
|
+
|
|
1954
|
+
[10]: https://webdriver.io/docs/sauce-service.html
|
|
1955
|
+
|
|
1956
|
+
[11]: https://github.com/puneet0191/codeceptjs-saucehelper/
|
|
1957
|
+
|
|
1958
|
+
[12]: https://webdriver.io/docs/browserstack-service.html
|
|
1959
|
+
|
|
1960
|
+
[13]: https://github.com/PeterNgTr/codeceptjs-bshelper
|
|
1961
|
+
|
|
1962
|
+
[14]: https://github.com/testingbot/codeceptjs-tbhelper
|
|
1963
|
+
|
|
1964
|
+
[15]: https://webdriver.io/docs/testingbot-service.html
|
|
1656
1965
|
|
|
1657
|
-
[
|
|
1966
|
+
[16]: https://github.com/PeterNgTr/codeceptjs-applitoolshelper
|
|
1658
1967
|
|
|
1659
|
-
[
|
|
1968
|
+
[17]: http://webdriver.io/guide/usage/multiremote.html
|
|
1660
1969
|
|
|
1661
|
-
[
|
|
1970
|
+
[18]: http://jster.net/category/windows-modals-popups
|
|
1662
1971
|
|
|
1663
|
-
[
|
|
1972
|
+
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1664
1973
|
|
|
1665
|
-
[
|
|
1974
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1666
1975
|
|
|
1667
|
-
[
|
|
1976
|
+
[21]: https://webdriver.io/docs/timeouts.html
|
|
1668
1977
|
|
|
1669
|
-
[
|
|
1978
|
+
[22]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1670
1979
|
|
|
1671
|
-
[
|
|
1980
|
+
[23]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
1672
1981
|
|
|
1673
|
-
[
|
|
1982
|
+
[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1674
1983
|
|
|
1675
|
-
[
|
|
1984
|
+
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1676
1985
|
|
|
1677
|
-
[
|
|
1986
|
+
[26]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
|
|
1678
1987
|
|
|
1679
|
-
[
|
|
1988
|
+
[27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1680
1989
|
|
|
1681
|
-
[
|
|
1990
|
+
[28]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1682
1991
|
|
|
1683
|
-
[
|
|
1992
|
+
[29]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object
|