codeceptjs 3.6.0-beta.1.ai-healers → 3.6.0
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 +2 -2
- package/bin/codecept.js +2 -1
- package/docs/webapi/dontSeeTraffic.mustache +13 -0
- package/docs/webapi/flushNetworkTraffics.mustache +5 -0
- package/docs/webapi/grabRecordedNetworkTraffics.mustache +10 -0
- package/docs/webapi/seeTraffic.mustache +36 -0
- package/docs/webapi/startRecordingTraffic.mustache +8 -0
- package/docs/webapi/startRecordingWebSocketMessages.mustache +8 -0
- package/docs/webapi/stopRecordingTraffic.mustache +5 -0
- package/docs/webapi/stopRecordingWebSocketMessages.mustache +7 -0
- package/docs/webapi/waitForCookie.mustache +9 -0
- package/lib/actor.js +6 -3
- package/lib/command/dryRun.js +44 -13
- package/lib/helper/Appium.js +36 -12
- package/lib/helper/Expect.js +11 -8
- package/lib/helper/JSONResponse.js +8 -8
- package/lib/helper/MockServer.js +221 -0
- package/lib/helper/Playwright.js +107 -371
- package/lib/helper/Puppeteer.js +404 -71
- package/lib/helper/REST.js +4 -1
- package/lib/helper/WebDriver.js +189 -13
- package/lib/helper/errors/ElementAssertion.js +38 -0
- package/lib/helper/extras/PlaywrightReactVueLocator.js +6 -1
- package/lib/helper/network/actions.js +123 -0
- package/lib/helper/network/utils.js +187 -0
- package/lib/locator.js +36 -5
- package/lib/plugin/coverage.js +112 -99
- package/lib/step.js +3 -1
- package/package.json +48 -37
- package/typings/index.d.ts +19 -2
- package/typings/promiseBasedTypes.d.ts +505 -41
- package/typings/types.d.ts +609 -56
- package/docs/advanced.md +0 -351
- package/docs/ai.md +0 -365
- package/docs/api.md +0 -323
- package/docs/basics.md +0 -979
- package/docs/bdd.md +0 -539
- package/docs/best.md +0 -237
- package/docs/books.md +0 -37
- package/docs/bootstrap.md +0 -135
- package/docs/build/AI.js +0 -124
- package/docs/build/ApiDataFactory.js +0 -410
- package/docs/build/Appium.js +0 -2027
- package/docs/build/Expect.js +0 -422
- package/docs/build/FileSystem.js +0 -228
- package/docs/build/GraphQL.js +0 -229
- package/docs/build/GraphQLDataFactory.js +0 -309
- package/docs/build/JSONResponse.js +0 -338
- package/docs/build/Mochawesome.js +0 -71
- package/docs/build/Nightmare.js +0 -2152
- package/docs/build/OpenAI.js +0 -126
- package/docs/build/Playwright.js +0 -5110
- package/docs/build/Protractor.js +0 -2706
- package/docs/build/Puppeteer.js +0 -3905
- package/docs/build/REST.js +0 -344
- package/docs/build/TestCafe.js +0 -2125
- package/docs/build/WebDriver.js +0 -4240
- package/docs/changelog.md +0 -2572
- package/docs/commands.md +0 -266
- package/docs/community-helpers.md +0 -58
- package/docs/configuration.md +0 -157
- package/docs/continuous-integration.md +0 -22
- package/docs/custom-helpers.md +0 -306
- package/docs/data.md +0 -379
- package/docs/detox.md +0 -235
- package/docs/docker.md +0 -136
- package/docs/email.md +0 -183
- package/docs/examples.md +0 -149
- package/docs/heal.md +0 -186
- package/docs/helpers/ApiDataFactory.md +0 -266
- package/docs/helpers/Appium.md +0 -1374
- package/docs/helpers/Detox.md +0 -586
- package/docs/helpers/Expect.md +0 -275
- package/docs/helpers/FileSystem.md +0 -152
- package/docs/helpers/GraphQL.md +0 -151
- package/docs/helpers/GraphQLDataFactory.md +0 -226
- package/docs/helpers/JSONResponse.md +0 -254
- package/docs/helpers/Mochawesome.md +0 -8
- package/docs/helpers/MockRequest.md +0 -377
- package/docs/helpers/Nightmare.md +0 -1305
- package/docs/helpers/OpenAI.md +0 -70
- package/docs/helpers/Playwright.md +0 -2759
- package/docs/helpers/Polly.md +0 -44
- package/docs/helpers/Protractor.md +0 -1769
- package/docs/helpers/Puppeteer-firefox.md +0 -86
- package/docs/helpers/Puppeteer.md +0 -2317
- package/docs/helpers/REST.md +0 -218
- package/docs/helpers/TestCafe.md +0 -1321
- package/docs/helpers/WebDriver.md +0 -2547
- package/docs/hooks.md +0 -340
- package/docs/index.md +0 -111
- package/docs/installation.md +0 -75
- package/docs/internal-api.md +0 -266
- package/docs/locators.md +0 -339
- package/docs/mobile-react-native-locators.md +0 -67
- package/docs/mobile.md +0 -338
- package/docs/pageobjects.md +0 -291
- package/docs/parallel.md +0 -400
- package/docs/playwright.md +0 -632
- package/docs/plugins.md +0 -1247
- package/docs/puppeteer.md +0 -316
- package/docs/quickstart.md +0 -162
- package/docs/react.md +0 -70
- package/docs/reports.md +0 -392
- package/docs/secrets.md +0 -36
- package/docs/shadow.md +0 -68
- package/docs/shared/keys.mustache +0 -31
- package/docs/shared/react.mustache +0 -1
- package/docs/testcafe.md +0 -174
- package/docs/translation.md +0 -247
- package/docs/tutorial.md +0 -271
- package/docs/typescript.md +0 -180
- package/docs/ui.md +0 -59
- package/docs/videos.md +0 -28
- package/docs/visual.md +0 -202
- package/docs/vue.md +0 -143
- package/docs/webdriver.md +0 -701
- package/docs/wiki/Books-&-Posts.md +0 -27
- package/docs/wiki/Community-Helpers-&-Plugins.md +0 -53
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +0 -61
- package/docs/wiki/Examples.md +0 -145
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -68
- package/docs/wiki/Home.md +0 -16
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +0 -83
- package/docs/wiki/Release-Process.md +0 -24
- package/docs/wiki/Roadmap.md +0 -23
- package/docs/wiki/Tests.md +0 -1393
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -153
- package/docs/wiki/Videos.md +0 -19
|
@@ -1,2547 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
permalink: /helpers/WebDriver
|
|
3
|
-
editLink: false
|
|
4
|
-
sidebar: auto
|
|
5
|
-
title: WebDriver
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
-
|
|
10
|
-
## WebDriver
|
|
11
|
-
|
|
12
|
-
**Extends Helper**
|
|
13
|
-
|
|
14
|
-
WebDriver helper which wraps [webdriverio][1] library to
|
|
15
|
-
manipulate browser using Selenium WebDriver or PhantomJS.
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## Configuration
|
|
29
|
-
|
|
30
|
-
This helper should be configured in codecept.conf.js
|
|
31
|
-
|
|
32
|
-
Type: [object][17]
|
|
33
|
-
|
|
34
|
-
### Properties
|
|
35
|
-
|
|
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].
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Example:
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
{
|
|
65
|
-
helpers: {
|
|
66
|
-
WebDriver : {
|
|
67
|
-
smartWait: 5000,
|
|
68
|
-
browser: "chrome",
|
|
69
|
-
restart: false,
|
|
70
|
-
windowSize: "maximize",
|
|
71
|
-
timeouts: {
|
|
72
|
-
"script": 60000,
|
|
73
|
-
"page load": 10000
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
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
|
-
|
|
101
|
-
Example with basic authentication
|
|
102
|
-
|
|
103
|
-
```js
|
|
104
|
-
{
|
|
105
|
-
helpers: {
|
|
106
|
-
WebDriver : {
|
|
107
|
-
smartWait: 5000,
|
|
108
|
-
browser: "chrome",
|
|
109
|
-
basicAuth: {username: 'username', password: 'password'},
|
|
110
|
-
restart: false,
|
|
111
|
-
windowSize: "maximize",
|
|
112
|
-
timeouts: {
|
|
113
|
-
"script": 60000,
|
|
114
|
-
"page load": 10000
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Additional configuration params can be used from [webdriverio
|
|
122
|
-
website][4].
|
|
123
|
-
|
|
124
|
-
### Headless Chrome
|
|
125
|
-
|
|
126
|
-
```js
|
|
127
|
-
{
|
|
128
|
-
helpers: {
|
|
129
|
-
WebDriver : {
|
|
130
|
-
url: "http://localhost",
|
|
131
|
-
browser: "chrome",
|
|
132
|
-
desiredCapabilities: {
|
|
133
|
-
chromeOptions: {
|
|
134
|
-
args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
```
|
|
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
|
-
|
|
161
|
-
### Internet Explorer
|
|
162
|
-
|
|
163
|
-
Additional configuration params can be used from [IE options][5]
|
|
164
|
-
|
|
165
|
-
```js
|
|
166
|
-
{
|
|
167
|
-
helpers: {
|
|
168
|
-
WebDriver : {
|
|
169
|
-
url: "http://localhost",
|
|
170
|
-
browser: "internet explorer",
|
|
171
|
-
desiredCapabilities: {
|
|
172
|
-
ieOptions: {
|
|
173
|
-
"ie.browserCommandLineSwitches": "-private",
|
|
174
|
-
"ie.usePerProcessProxy": true,
|
|
175
|
-
"ie.ensureCleanSession": true,
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### Selenoid Options
|
|
184
|
-
|
|
185
|
-
[Selenoid][6] is a modern way to run Selenium inside Docker containers.
|
|
186
|
-
Selenoid is easy to set up and provides more features than original Selenium Server. Use `selenoidOptions` to set Selenoid capabilities
|
|
187
|
-
|
|
188
|
-
```js
|
|
189
|
-
{
|
|
190
|
-
helpers: {
|
|
191
|
-
WebDriver : {
|
|
192
|
-
url: "http://localhost",
|
|
193
|
-
browser: "chrome",
|
|
194
|
-
desiredCapabilities: {
|
|
195
|
-
selenoidOptions: {
|
|
196
|
-
enableVNC: true,
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Connect Through proxy
|
|
205
|
-
|
|
206
|
-
CodeceptJS also provides flexible options when you want to execute tests to Selenium servers through proxy. You will
|
|
207
|
-
need to update the `helpers.WebDriver.capabilities.proxy` key.
|
|
208
|
-
|
|
209
|
-
```js
|
|
210
|
-
{
|
|
211
|
-
helpers: {
|
|
212
|
-
WebDriver: {
|
|
213
|
-
capabilities: {
|
|
214
|
-
proxy: {
|
|
215
|
-
"proxyType": "manual|pac",
|
|
216
|
-
"proxyAutoconfigUrl": "URL TO PAC FILE",
|
|
217
|
-
"httpProxy": "PROXY SERVER",
|
|
218
|
-
"sslProxy": "PROXY SERVER",
|
|
219
|
-
"ftpProxy": "PROXY SERVER",
|
|
220
|
-
"socksProxy": "PROXY SERVER",
|
|
221
|
-
"socksUsername": "USERNAME",
|
|
222
|
-
"socksPassword": "PASSWORD",
|
|
223
|
-
"noProxy": "BYPASS ADDRESSES"
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
For example,
|
|
232
|
-
|
|
233
|
-
```js
|
|
234
|
-
{
|
|
235
|
-
helpers: {
|
|
236
|
-
WebDriver: {
|
|
237
|
-
capabilities: {
|
|
238
|
-
proxy: {
|
|
239
|
-
"proxyType": "manual",
|
|
240
|
-
"httpProxy": "http://corporate.proxy:8080",
|
|
241
|
-
"socksUsername": "codeceptjs",
|
|
242
|
-
"socksPassword": "secret",
|
|
243
|
-
"noProxy": "127.0.0.1,localhost"
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
Please refer to [Selenium - Proxy Object][7] for more
|
|
252
|
-
information.
|
|
253
|
-
|
|
254
|
-
### Cloud Providers
|
|
255
|
-
|
|
256
|
-
WebDriver makes it possible to execute tests against services like `Sauce Labs` `BrowserStack` `TestingBot`
|
|
257
|
-
Check out their documentation on [available parameters][8]
|
|
258
|
-
|
|
259
|
-
Connecting to `BrowserStack` and `Sauce Labs` is simple. All you need to do
|
|
260
|
-
is set the `user` and `key` parameters. WebDriver automatically know which
|
|
261
|
-
service provider to connect to.
|
|
262
|
-
|
|
263
|
-
```js
|
|
264
|
-
{
|
|
265
|
-
helpers:{
|
|
266
|
-
WebDriver: {
|
|
267
|
-
url: "YOUR_DESIRED_HOST",
|
|
268
|
-
user: "YOUR_BROWSERSTACK_USER",
|
|
269
|
-
key: "YOUR_BROWSERSTACK_KEY",
|
|
270
|
-
capabilities: {
|
|
271
|
-
"browserName": "chrome",
|
|
272
|
-
|
|
273
|
-
// only set this if you're using BrowserStackLocal to test a local domain
|
|
274
|
-
// "browserstack.local": true,
|
|
275
|
-
|
|
276
|
-
// set this option to tell browserstack to provide addition debugging info
|
|
277
|
-
// "browserstack.debug": true,
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
#### SauceLabs
|
|
285
|
-
|
|
286
|
-
SauceLabs can be configured via wdio service, which should be installed additionally:
|
|
287
|
-
|
|
288
|
-
npm i @wdio/sauce-service --save
|
|
289
|
-
|
|
290
|
-
It is important to make sure it is compatible with current webdriverio version.
|
|
291
|
-
|
|
292
|
-
Enable `wdio` plugin in plugins list and add `sauce` service:
|
|
293
|
-
|
|
294
|
-
```js
|
|
295
|
-
plugins: {
|
|
296
|
-
wdio: {
|
|
297
|
-
enabled: true,
|
|
298
|
-
services: ['sauce'],
|
|
299
|
-
user: ... ,// saucelabs username
|
|
300
|
-
key: ... // saucelabs api key
|
|
301
|
-
// additional config, from sauce service
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
See [complete reference on webdriver.io][9].
|
|
307
|
-
|
|
308
|
-
> Alternatively, use [codeceptjs-saucehelper][10] for better reporting.
|
|
309
|
-
|
|
310
|
-
#### BrowserStack
|
|
311
|
-
|
|
312
|
-
BrowserStack can be configured via wdio service, which should be installed additionally:
|
|
313
|
-
|
|
314
|
-
npm i @wdio/browserstack-service --save
|
|
315
|
-
|
|
316
|
-
It is important to make sure it is compatible with current webdriverio version.
|
|
317
|
-
|
|
318
|
-
Enable `wdio` plugin in plugins list and add `browserstack` service:
|
|
319
|
-
|
|
320
|
-
```js
|
|
321
|
-
plugins: {
|
|
322
|
-
wdio: {
|
|
323
|
-
enabled: true,
|
|
324
|
-
services: ['browserstack'],
|
|
325
|
-
user: ... ,// browserstack username
|
|
326
|
-
key: ... // browserstack api key
|
|
327
|
-
// additional config, from browserstack service
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
See [complete reference on webdriver.io][11].
|
|
333
|
-
|
|
334
|
-
> Alternatively, use [codeceptjs-bshelper][12] for better reporting.
|
|
335
|
-
|
|
336
|
-
#### TestingBot
|
|
337
|
-
|
|
338
|
-
> **Recommended**: use official [TestingBot Helper][13].
|
|
339
|
-
|
|
340
|
-
Alternatively, TestingBot can be configured via wdio service, which should be installed additionally:
|
|
341
|
-
|
|
342
|
-
npm i @wdio/testingbot-service --save
|
|
343
|
-
|
|
344
|
-
It is important to make sure it is compatible with current webdriverio version.
|
|
345
|
-
|
|
346
|
-
Enable `wdio` plugin in plugins list and add `testingbot` service:
|
|
347
|
-
|
|
348
|
-
```js
|
|
349
|
-
plugins: {
|
|
350
|
-
wdio: {
|
|
351
|
-
enabled: true,
|
|
352
|
-
services: ['testingbot'],
|
|
353
|
-
user: ... ,// testingbot key
|
|
354
|
-
key: ... // testingbot secret
|
|
355
|
-
// additional config, from testingbot service
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
See [complete reference on webdriver.io][14].
|
|
361
|
-
|
|
362
|
-
#### Applitools
|
|
363
|
-
|
|
364
|
-
Visual testing via Applitools service
|
|
365
|
-
|
|
366
|
-
> Use [CodeceptJS Applitools Helper][15] with Applitools wdio service.
|
|
367
|
-
|
|
368
|
-
### Multiremote Capabilities
|
|
369
|
-
|
|
370
|
-
This is a work in progress but you can control two browsers at a time right out of the box.
|
|
371
|
-
Individual control is something that is planned for a later version.
|
|
372
|
-
|
|
373
|
-
Here is the [webdriverio docs][16] on the subject
|
|
374
|
-
|
|
375
|
-
```js
|
|
376
|
-
{
|
|
377
|
-
helpers: {
|
|
378
|
-
WebDriver: {
|
|
379
|
-
"multiremote": {
|
|
380
|
-
"MyChrome": {
|
|
381
|
-
"desiredCapabilities": {
|
|
382
|
-
"browserName": "chrome"
|
|
383
|
-
}
|
|
384
|
-
},
|
|
385
|
-
"MyFirefox": {
|
|
386
|
-
"desiredCapabilities": {
|
|
387
|
-
"browserName": "firefox"
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
## Access From Helpers
|
|
397
|
-
|
|
398
|
-
Receive a WebDriver client from a custom helper by accessing `browser` property:
|
|
399
|
-
|
|
400
|
-
```js
|
|
401
|
-
const { WebDriver } = this.helpers;
|
|
402
|
-
const browser = WebDriver.browser
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
## Methods
|
|
406
|
-
|
|
407
|
-
### Parameters
|
|
408
|
-
|
|
409
|
-
- `config`
|
|
410
|
-
|
|
411
|
-
### _isShadowLocator
|
|
412
|
-
|
|
413
|
-
Check if locator is type of "Shadow"
|
|
414
|
-
|
|
415
|
-
#### Parameters
|
|
416
|
-
|
|
417
|
-
- `locator` **[object][17]**
|
|
418
|
-
|
|
419
|
-
### _locate
|
|
420
|
-
|
|
421
|
-
Get elements by different locator types, including strict locator.
|
|
422
|
-
Should be used in custom helpers:
|
|
423
|
-
|
|
424
|
-
```js
|
|
425
|
-
this.helpers['WebDriver']._locate({name: 'password'}).then //...
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
#### Parameters
|
|
429
|
-
|
|
430
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
431
|
-
- `smartWait`
|
|
432
|
-
|
|
433
|
-
### _locateCheckable
|
|
434
|
-
|
|
435
|
-
Find a checkbox by providing human-readable text:
|
|
436
|
-
|
|
437
|
-
```js
|
|
438
|
-
this.helpers['WebDriver']._locateCheckable('I agree with terms and conditions').then // ...
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
#### Parameters
|
|
442
|
-
|
|
443
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
444
|
-
|
|
445
|
-
### _locateClickable
|
|
446
|
-
|
|
447
|
-
Find a clickable element by providing human-readable text:
|
|
448
|
-
|
|
449
|
-
```js
|
|
450
|
-
const els = await this.helpers.WebDriver._locateClickable('Next page');
|
|
451
|
-
const els = await this.helpers.WebDriver._locateClickable('Next page', '.pages');
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
#### Parameters
|
|
455
|
-
|
|
456
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
457
|
-
- `context`
|
|
458
|
-
|
|
459
|
-
### _locateFields
|
|
460
|
-
|
|
461
|
-
Find field elements by providing human-readable text:
|
|
462
|
-
|
|
463
|
-
```js
|
|
464
|
-
this.helpers['WebDriver']._locateFields('Your email').then // ...
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
#### Parameters
|
|
468
|
-
|
|
469
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
470
|
-
|
|
471
|
-
### _locateShadow
|
|
472
|
-
|
|
473
|
-
Locate Element within the Shadow Dom
|
|
474
|
-
|
|
475
|
-
#### Parameters
|
|
476
|
-
|
|
477
|
-
- `locator` **[object][17]**
|
|
478
|
-
|
|
479
|
-
### _smartWait
|
|
480
|
-
|
|
481
|
-
Smart Wait to locate an element
|
|
482
|
-
|
|
483
|
-
#### Parameters
|
|
484
|
-
|
|
485
|
-
- `locator` **[object][17]**
|
|
486
|
-
|
|
487
|
-
### acceptPopup
|
|
488
|
-
|
|
489
|
-
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
490
|
-
Don't confuse popups with modal windows, as created by [various
|
|
491
|
-
libraries][19].
|
|
492
|
-
|
|
493
|
-
### amOnPage
|
|
494
|
-
|
|
495
|
-
Opens a web page in a browser. Requires relative or absolute url.
|
|
496
|
-
If url starts with `/`, opens a web page of a site defined in `url` config parameter.
|
|
497
|
-
|
|
498
|
-
```js
|
|
499
|
-
I.amOnPage('/'); // opens main page of website
|
|
500
|
-
I.amOnPage('https://github.com'); // opens github
|
|
501
|
-
I.amOnPage('/login'); // opens a login page
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
#### Parameters
|
|
505
|
-
|
|
506
|
-
- `url` **[string][18]** url path or global url.
|
|
507
|
-
|
|
508
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
509
|
-
|
|
510
|
-
### appendField
|
|
511
|
-
|
|
512
|
-
Appends text to a input field or textarea.
|
|
513
|
-
Field is located by name, label, CSS or XPath
|
|
514
|
-
|
|
515
|
-
```js
|
|
516
|
-
I.appendField('#myTextField', 'appended');
|
|
517
|
-
// typing secret
|
|
518
|
-
I.appendField('password', secret('123456'));
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
#### Parameters
|
|
522
|
-
|
|
523
|
-
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator
|
|
524
|
-
- `value` **[string][18]** text value to append.
|
|
525
|
-
|
|
526
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
### attachFile
|
|
533
|
-
|
|
534
|
-
Appium: not tested
|
|
535
|
-
|
|
536
|
-
Attaches a file to element located by label, name, CSS or XPath
|
|
537
|
-
Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
|
|
538
|
-
File will be uploaded to remote system (if tests are running remotely).
|
|
539
|
-
|
|
540
|
-
```js
|
|
541
|
-
I.attachFile('Avatar', 'data/avatar.jpg');
|
|
542
|
-
I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
#### Parameters
|
|
546
|
-
|
|
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.
|
|
549
|
-
|
|
550
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
551
|
-
|
|
552
|
-
### blur
|
|
553
|
-
|
|
554
|
-
Remove focus from a text input, button, etc.
|
|
555
|
-
Calls [blur][20] on the element.
|
|
556
|
-
|
|
557
|
-
Examples:
|
|
558
|
-
|
|
559
|
-
```js
|
|
560
|
-
I.blur('.text-area')
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
```js
|
|
564
|
-
//element `#product-tile` is focused
|
|
565
|
-
I.see('#add-to-cart-btn');
|
|
566
|
-
I.blur('#product-tile')
|
|
567
|
-
I.dontSee('#add-to-cart-btn');
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
#### Parameters
|
|
571
|
-
|
|
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.
|
|
574
|
-
|
|
575
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
576
|
-
|
|
577
|
-
### cancelPopup
|
|
578
|
-
|
|
579
|
-
Dismisses the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`.
|
|
580
|
-
|
|
581
|
-
### checkOption
|
|
582
|
-
|
|
583
|
-
Appium: not tested
|
|
584
|
-
Selects a checkbox or radio button.
|
|
585
|
-
Element is located by label or name or CSS or XPath.
|
|
586
|
-
|
|
587
|
-
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
588
|
-
|
|
589
|
-
```js
|
|
590
|
-
I.checkOption('#agree');
|
|
591
|
-
I.checkOption('I Agree to Terms and Conditions');
|
|
592
|
-
I.checkOption('agree', '//form');
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
#### Parameters
|
|
596
|
-
|
|
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.
|
|
599
|
-
|
|
600
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
601
|
-
|
|
602
|
-
### clearCookie
|
|
603
|
-
|
|
604
|
-
Clears a cookie by name,
|
|
605
|
-
if none provided clears all cookies.
|
|
606
|
-
|
|
607
|
-
```js
|
|
608
|
-
I.clearCookie();
|
|
609
|
-
I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
|
|
610
|
-
```
|
|
611
|
-
|
|
612
|
-
#### Parameters
|
|
613
|
-
|
|
614
|
-
- `cookie` **[string][18]?** (optional, `null` by default) cookie name
|
|
615
|
-
|
|
616
|
-
### clearField
|
|
617
|
-
|
|
618
|
-
Clears a `<textarea>` or text `<input>` element's value.
|
|
619
|
-
|
|
620
|
-
```js
|
|
621
|
-
I.clearField('Email');
|
|
622
|
-
I.clearField('user[email]');
|
|
623
|
-
I.clearField('#email');
|
|
624
|
-
```
|
|
625
|
-
|
|
626
|
-
#### Parameters
|
|
627
|
-
|
|
628
|
-
- `field`
|
|
629
|
-
- `editable` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
630
|
-
|
|
631
|
-
Returns **void** automatically synchronized promise through #recorder.
|
|
632
|
-
|
|
633
|
-
### click
|
|
634
|
-
|
|
635
|
-
Perform a click on a link or a button, given by a locator.
|
|
636
|
-
If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
637
|
-
For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
638
|
-
For images, the "alt" attribute and inner text of any parent links are searched.
|
|
639
|
-
|
|
640
|
-
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
641
|
-
|
|
642
|
-
```js
|
|
643
|
-
// simple link
|
|
644
|
-
I.click('Logout');
|
|
645
|
-
// button of form
|
|
646
|
-
I.click('Submit');
|
|
647
|
-
// CSS button
|
|
648
|
-
I.click('#form input[type=submit]');
|
|
649
|
-
// XPath
|
|
650
|
-
I.click('//form/*[@type=submit]');
|
|
651
|
-
// link in context
|
|
652
|
-
I.click('Logout', '#nav');
|
|
653
|
-
// using strict locator
|
|
654
|
-
I.click({css: 'nav a.login'});
|
|
655
|
-
```
|
|
656
|
-
|
|
657
|
-
#### Parameters
|
|
658
|
-
|
|
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.
|
|
661
|
-
|
|
662
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
### closeCurrentTab
|
|
669
|
-
|
|
670
|
-
Close current tab.
|
|
671
|
-
|
|
672
|
-
```js
|
|
673
|
-
I.closeCurrentTab();
|
|
674
|
-
```
|
|
675
|
-
|
|
676
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
677
|
-
|
|
678
|
-
### closeOtherTabs
|
|
679
|
-
|
|
680
|
-
Close all tabs except for the current one.
|
|
681
|
-
|
|
682
|
-
```js
|
|
683
|
-
I.closeOtherTabs();
|
|
684
|
-
```
|
|
685
|
-
|
|
686
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
687
|
-
|
|
688
|
-
### defineTimeout
|
|
689
|
-
|
|
690
|
-
Set [WebDriver timeouts][22] in realtime.
|
|
691
|
-
|
|
692
|
-
Timeouts are expected to be passed as object:
|
|
693
|
-
|
|
694
|
-
```js
|
|
695
|
-
I.defineTimeout({ script: 5000 });
|
|
696
|
-
I.defineTimeout({ implicit: 10000, pageLoad: 10000, script: 5000 });
|
|
697
|
-
```
|
|
698
|
-
|
|
699
|
-
#### Parameters
|
|
700
|
-
|
|
701
|
-
- `timeouts` **any** WebDriver timeouts object.
|
|
702
|
-
|
|
703
|
-
### dontSee
|
|
704
|
-
|
|
705
|
-
Opposite to `see`. Checks that a text is not present on a page.
|
|
706
|
-
Use context parameter to narrow down the search.
|
|
707
|
-
|
|
708
|
-
```js
|
|
709
|
-
I.dontSee('Login'); // assume we are already logged in.
|
|
710
|
-
I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
711
|
-
```
|
|
712
|
-
|
|
713
|
-
#### Parameters
|
|
714
|
-
|
|
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.
|
|
717
|
-
|
|
718
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
### dontSeeCheckboxIsChecked
|
|
725
|
-
|
|
726
|
-
Appium: not tested
|
|
727
|
-
Verifies that the specified checkbox is not checked.
|
|
728
|
-
|
|
729
|
-
```js
|
|
730
|
-
I.dontSeeCheckboxIsChecked('#agree'); // located by ID
|
|
731
|
-
I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label
|
|
732
|
-
I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
#### Parameters
|
|
736
|
-
|
|
737
|
-
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
738
|
-
|
|
739
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
740
|
-
|
|
741
|
-
### dontSeeCookie
|
|
742
|
-
|
|
743
|
-
Checks that cookie with given name does not exist.
|
|
744
|
-
|
|
745
|
-
```js
|
|
746
|
-
I.dontSeeCookie('auth'); // no auth cookie
|
|
747
|
-
```
|
|
748
|
-
|
|
749
|
-
#### Parameters
|
|
750
|
-
|
|
751
|
-
- `name` **[string][18]** cookie name.
|
|
752
|
-
|
|
753
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
754
|
-
|
|
755
|
-
### dontSeeCurrentUrlEquals
|
|
756
|
-
|
|
757
|
-
Checks that current url is not equal to provided one.
|
|
758
|
-
If a relative url provided, a configured url will be prepended to it.
|
|
759
|
-
|
|
760
|
-
```js
|
|
761
|
-
I.dontSeeCurrentUrlEquals('/login'); // relative url are ok
|
|
762
|
-
I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
#### Parameters
|
|
766
|
-
|
|
767
|
-
- `url` **[string][18]** value to check.
|
|
768
|
-
|
|
769
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
770
|
-
|
|
771
|
-
### dontSeeElement
|
|
772
|
-
|
|
773
|
-
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
774
|
-
|
|
775
|
-
```js
|
|
776
|
-
I.dontSeeElement('.modal'); // modal is not shown
|
|
777
|
-
```
|
|
778
|
-
|
|
779
|
-
#### Parameters
|
|
780
|
-
|
|
781
|
-
- `locator` **([string][18] | [object][17])** located by CSS|XPath|Strict locator.
|
|
782
|
-
|
|
783
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
### dontSeeElementInDOM
|
|
790
|
-
|
|
791
|
-
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
792
|
-
|
|
793
|
-
```js
|
|
794
|
-
I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
795
|
-
```
|
|
796
|
-
|
|
797
|
-
#### Parameters
|
|
798
|
-
|
|
799
|
-
- `locator` **([string][18] | [object][17])** located by CSS|XPath|Strict locator.
|
|
800
|
-
|
|
801
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
802
|
-
|
|
803
|
-
### dontSeeInCurrentUrl
|
|
804
|
-
|
|
805
|
-
Checks that current url does not contain a provided fragment.
|
|
806
|
-
|
|
807
|
-
#### Parameters
|
|
808
|
-
|
|
809
|
-
- `url` **[string][18]** value to check.
|
|
810
|
-
|
|
811
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
812
|
-
|
|
813
|
-
### dontSeeInField
|
|
814
|
-
|
|
815
|
-
Checks that value of input field or textarea doesn't equal to given value
|
|
816
|
-
Opposite to `seeInField`.
|
|
817
|
-
|
|
818
|
-
```js
|
|
819
|
-
I.dontSeeInField('email', 'user@user.com'); // field by name
|
|
820
|
-
I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
821
|
-
```
|
|
822
|
-
|
|
823
|
-
#### Parameters
|
|
824
|
-
|
|
825
|
-
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
826
|
-
- `value` **([string][18] | [object][17])** value to check.
|
|
827
|
-
|
|
828
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
829
|
-
|
|
830
|
-
### dontSeeInSource
|
|
831
|
-
|
|
832
|
-
Checks that the current page does not contains the given string in its raw source code.
|
|
833
|
-
|
|
834
|
-
```js
|
|
835
|
-
I.dontSeeInSource('<!--'); // no comments in source
|
|
836
|
-
```
|
|
837
|
-
|
|
838
|
-
#### Parameters
|
|
839
|
-
|
|
840
|
-
- `text`
|
|
841
|
-
- `value` **[string][18]** to check.
|
|
842
|
-
|
|
843
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
844
|
-
|
|
845
|
-
### dontSeeInTitle
|
|
846
|
-
|
|
847
|
-
Checks that title does not contain text.
|
|
848
|
-
|
|
849
|
-
```js
|
|
850
|
-
I.dontSeeInTitle('Error');
|
|
851
|
-
```
|
|
852
|
-
|
|
853
|
-
#### Parameters
|
|
854
|
-
|
|
855
|
-
- `text` **[string][18]** value to check.
|
|
856
|
-
|
|
857
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
858
|
-
|
|
859
|
-
### doubleClick
|
|
860
|
-
|
|
861
|
-
Performs a double-click on an element matched by link|button|label|CSS or XPath.
|
|
862
|
-
Context can be specified as second parameter to narrow search.
|
|
863
|
-
|
|
864
|
-
```js
|
|
865
|
-
I.doubleClick('Edit');
|
|
866
|
-
I.doubleClick('Edit', '.actions');
|
|
867
|
-
I.doubleClick({css: 'button.accept'});
|
|
868
|
-
I.doubleClick('.btn.edit');
|
|
869
|
-
```
|
|
870
|
-
|
|
871
|
-
#### Parameters
|
|
872
|
-
|
|
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.
|
|
875
|
-
|
|
876
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
### dragAndDrop
|
|
883
|
-
|
|
884
|
-
Appium: not tested
|
|
885
|
-
Drag an item to a destination element.
|
|
886
|
-
|
|
887
|
-
```js
|
|
888
|
-
I.dragAndDrop('#dragHandle', '#container');
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
#### Parameters
|
|
892
|
-
|
|
893
|
-
- `srcElement` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
894
|
-
- `destElement` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
895
|
-
|
|
896
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
897
|
-
|
|
898
|
-
### dragSlider
|
|
899
|
-
|
|
900
|
-
Drag the scrubber of a slider to a given position
|
|
901
|
-
For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
902
|
-
|
|
903
|
-
```js
|
|
904
|
-
I.dragSlider('#slider', 30);
|
|
905
|
-
I.dragSlider('#slider', -70);
|
|
906
|
-
```
|
|
907
|
-
|
|
908
|
-
#### Parameters
|
|
909
|
-
|
|
910
|
-
- `locator` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
911
|
-
- `offsetX` **[number][23]** position to drag.
|
|
912
|
-
|
|
913
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
914
|
-
|
|
915
|
-
### executeAsyncScript
|
|
916
|
-
|
|
917
|
-
Executes async script on page.
|
|
918
|
-
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
919
|
-
|
|
920
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][24].
|
|
921
|
-
|
|
922
|
-
```js
|
|
923
|
-
I.executeAsyncScript(function(done) {
|
|
924
|
-
Vue.nextTick(done); // waiting for next tick
|
|
925
|
-
});
|
|
926
|
-
```
|
|
927
|
-
|
|
928
|
-
By passing value to `done()` function you can return values.
|
|
929
|
-
Additional arguments can be passed as well, while `done` function is always last parameter in arguments list.
|
|
930
|
-
|
|
931
|
-
```js
|
|
932
|
-
let val = await I.executeAsyncScript(function(url, done) {
|
|
933
|
-
// in browser context
|
|
934
|
-
$.ajax(url, { success: (data) => done(data); }
|
|
935
|
-
}, 'http://ajax.callback.url/');
|
|
936
|
-
```
|
|
937
|
-
|
|
938
|
-
#### Parameters
|
|
939
|
-
|
|
940
|
-
- `args` **...any** to be passed to function.
|
|
941
|
-
- `fn` **([string][18] | [function][25])** function to be executed in browser context.
|
|
942
|
-
|
|
943
|
-
Returns **[Promise][26]<any>** script return value
|
|
944
|
-
|
|
945
|
-
### executeScript
|
|
946
|
-
|
|
947
|
-
Wraps [execute][27] command.
|
|
948
|
-
|
|
949
|
-
Executes sync script on a page.
|
|
950
|
-
Pass arguments to function as additional parameters.
|
|
951
|
-
Will return execution result to a test.
|
|
952
|
-
In this case you should use async function and await to receive results.
|
|
953
|
-
|
|
954
|
-
Example with jQuery DatePicker:
|
|
955
|
-
|
|
956
|
-
```js
|
|
957
|
-
// change date of jQuery DatePicker
|
|
958
|
-
I.executeScript(function() {
|
|
959
|
-
// now we are inside browser context
|
|
960
|
-
$('date').datetimepicker('setDate', new Date());
|
|
961
|
-
});
|
|
962
|
-
```
|
|
963
|
-
|
|
964
|
-
Can return values. Don't forget to use `await` to get them.
|
|
965
|
-
|
|
966
|
-
```js
|
|
967
|
-
let date = await I.executeScript(function(el) {
|
|
968
|
-
// only basic types can be returned
|
|
969
|
-
return $(el).datetimepicker('getDate').toString();
|
|
970
|
-
}, '#date'); // passing jquery selector
|
|
971
|
-
```
|
|
972
|
-
|
|
973
|
-
#### Parameters
|
|
974
|
-
|
|
975
|
-
- `args` **...any** to be passed to function.
|
|
976
|
-
- `fn` **([string][18] | [function][25])** function to be executed in browser context.
|
|
977
|
-
|
|
978
|
-
Returns **[Promise][26]<any>** script return value
|
|
979
|
-
|
|
980
|
-
### fillField
|
|
981
|
-
|
|
982
|
-
Fills a text field or textarea, after clearing its value, with the given string.
|
|
983
|
-
Field is located by name, label, CSS, or XPath.
|
|
984
|
-
|
|
985
|
-
```js
|
|
986
|
-
// by label
|
|
987
|
-
I.fillField('Email', 'hello@world.com');
|
|
988
|
-
// by name
|
|
989
|
-
I.fillField('password', secret('123456'));
|
|
990
|
-
// by CSS
|
|
991
|
-
I.fillField('form#login input[name=username]', 'John');
|
|
992
|
-
// or by strict locator
|
|
993
|
-
I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
994
|
-
```
|
|
995
|
-
|
|
996
|
-
#### Parameters
|
|
997
|
-
|
|
998
|
-
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
999
|
-
- `value` **([string][18] | [object][17])** text value to fill.
|
|
1000
|
-
|
|
1001
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1005
|
-
|
|
1006
|
-
{{ custom }}
|
|
1007
|
-
|
|
1008
|
-
### focus
|
|
1009
|
-
|
|
1010
|
-
Calls [focus][20] on the matching element.
|
|
1011
|
-
|
|
1012
|
-
Examples:
|
|
1013
|
-
|
|
1014
|
-
```js
|
|
1015
|
-
I.dontSee('#add-to-cart-btn');
|
|
1016
|
-
I.focus('#product-tile')
|
|
1017
|
-
I.see('#add-to-cart-bnt');
|
|
1018
|
-
```
|
|
1019
|
-
|
|
1020
|
-
#### Parameters
|
|
1021
|
-
|
|
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.
|
|
1024
|
-
|
|
1025
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1026
|
-
|
|
1027
|
-
### forceClick
|
|
1028
|
-
|
|
1029
|
-
Perform an emulated click on a link or a button, given by a locator.
|
|
1030
|
-
Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
1031
|
-
This works on hidden, animated or inactive elements as well.
|
|
1032
|
-
|
|
1033
|
-
If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
1034
|
-
For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
1035
|
-
For images, the "alt" attribute and inner text of any parent links are searched.
|
|
1036
|
-
|
|
1037
|
-
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
1038
|
-
|
|
1039
|
-
```js
|
|
1040
|
-
// simple link
|
|
1041
|
-
I.forceClick('Logout');
|
|
1042
|
-
// button of form
|
|
1043
|
-
I.forceClick('Submit');
|
|
1044
|
-
// CSS button
|
|
1045
|
-
I.forceClick('#form input[type=submit]');
|
|
1046
|
-
// XPath
|
|
1047
|
-
I.forceClick('//form/*[@type=submit]');
|
|
1048
|
-
// link in context
|
|
1049
|
-
I.forceClick('Logout', '#nav');
|
|
1050
|
-
// using strict locator
|
|
1051
|
-
I.forceClick({css: 'nav a.login'});
|
|
1052
|
-
```
|
|
1053
|
-
|
|
1054
|
-
#### Parameters
|
|
1055
|
-
|
|
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.
|
|
1058
|
-
|
|
1059
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
### forceRightClick
|
|
1066
|
-
|
|
1067
|
-
Emulates right click on an element.
|
|
1068
|
-
Unlike normal click instead of sending native event, emulates a click with JavaScript.
|
|
1069
|
-
This works on hidden, animated or inactive elements as well.
|
|
1070
|
-
|
|
1071
|
-
If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
1072
|
-
For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
|
|
1073
|
-
For images, the "alt" attribute and inner text of any parent links are searched.
|
|
1074
|
-
|
|
1075
|
-
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
1076
|
-
|
|
1077
|
-
```js
|
|
1078
|
-
// simple link
|
|
1079
|
-
I.forceRightClick('Menu');
|
|
1080
|
-
```
|
|
1081
|
-
|
|
1082
|
-
#### Parameters
|
|
1083
|
-
|
|
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.
|
|
1086
|
-
|
|
1087
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
### grabAllWindowHandles
|
|
1094
|
-
|
|
1095
|
-
Get all Window Handles.
|
|
1096
|
-
Useful for referencing a specific handle when calling `I.switchToWindow(handle)`
|
|
1097
|
-
|
|
1098
|
-
```js
|
|
1099
|
-
const windows = await I.grabAllWindowHandles();
|
|
1100
|
-
```
|
|
1101
|
-
|
|
1102
|
-
Returns **[Promise][26]<[Array][29]<[string][18]>>**
|
|
1103
|
-
|
|
1104
|
-
### grabAttributeFrom
|
|
1105
|
-
|
|
1106
|
-
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
1107
|
-
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1108
|
-
If more than one element is found - attribute of first element is returned.
|
|
1109
|
-
|
|
1110
|
-
```js
|
|
1111
|
-
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
1112
|
-
```
|
|
1113
|
-
|
|
1114
|
-
#### Parameters
|
|
1115
|
-
|
|
1116
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1117
|
-
- `attr` **[string][18]** attribute name.
|
|
1118
|
-
|
|
1119
|
-
Returns **[Promise][26]<[string][18]>** attribute value
|
|
1120
|
-
|
|
1121
|
-
### grabAttributeFromAll
|
|
1122
|
-
|
|
1123
|
-
Retrieves an array of attributes from elements located by CSS or XPath and returns it to test.
|
|
1124
|
-
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1125
|
-
|
|
1126
|
-
```js
|
|
1127
|
-
let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
1128
|
-
```
|
|
1129
|
-
|
|
1130
|
-
#### Parameters
|
|
1131
|
-
|
|
1132
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1133
|
-
- `attr` **[string][18]** attribute name.
|
|
1134
|
-
|
|
1135
|
-
Returns **[Promise][26]<[Array][29]<[string][18]>>** attribute value
|
|
1136
|
-
|
|
1137
|
-
### grabBrowserLogs
|
|
1138
|
-
|
|
1139
|
-
Get JS log from browser. Log buffer is reset after each request.
|
|
1140
|
-
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1141
|
-
|
|
1142
|
-
```js
|
|
1143
|
-
let logs = await I.grabBrowserLogs();
|
|
1144
|
-
console.log(JSON.stringify(logs))
|
|
1145
|
-
```
|
|
1146
|
-
|
|
1147
|
-
Returns **([Promise][26]<[Array][29]<[object][17]>> | [undefined][30])** all browser logs
|
|
1148
|
-
|
|
1149
|
-
### grabCookie
|
|
1150
|
-
|
|
1151
|
-
Gets a cookie object by name.
|
|
1152
|
-
If none provided gets all cookies.
|
|
1153
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1154
|
-
|
|
1155
|
-
```js
|
|
1156
|
-
let cookie = await I.grabCookie('auth');
|
|
1157
|
-
assert(cookie.value, '123456');
|
|
1158
|
-
```
|
|
1159
|
-
|
|
1160
|
-
#### Parameters
|
|
1161
|
-
|
|
1162
|
-
- `name` **[string][18]?** cookie name.
|
|
1163
|
-
|
|
1164
|
-
Returns **any** attribute value
|
|
1165
|
-
|
|
1166
|
-
### grabCssPropertyFrom
|
|
1167
|
-
|
|
1168
|
-
Grab CSS property for given locator
|
|
1169
|
-
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1170
|
-
If more than one element is found - value of first element is returned.
|
|
1171
|
-
|
|
1172
|
-
```js
|
|
1173
|
-
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
1174
|
-
```
|
|
1175
|
-
|
|
1176
|
-
#### Parameters
|
|
1177
|
-
|
|
1178
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1179
|
-
- `cssProperty` **[string][18]** CSS property name.
|
|
1180
|
-
|
|
1181
|
-
Returns **[Promise][26]<[string][18]>** CSS value
|
|
1182
|
-
|
|
1183
|
-
### grabCssPropertyFromAll
|
|
1184
|
-
|
|
1185
|
-
Grab array of CSS properties for given locator
|
|
1186
|
-
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1187
|
-
|
|
1188
|
-
```js
|
|
1189
|
-
const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
1190
|
-
```
|
|
1191
|
-
|
|
1192
|
-
#### Parameters
|
|
1193
|
-
|
|
1194
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1195
|
-
- `cssProperty` **[string][18]** CSS property name.
|
|
1196
|
-
|
|
1197
|
-
Returns **[Promise][26]<[Array][29]<[string][18]>>** CSS value
|
|
1198
|
-
|
|
1199
|
-
### grabCurrentUrl
|
|
1200
|
-
|
|
1201
|
-
Get current URL from browser.
|
|
1202
|
-
Resumes test execution, so should be used inside an async function.
|
|
1203
|
-
|
|
1204
|
-
```js
|
|
1205
|
-
let url = await I.grabCurrentUrl();
|
|
1206
|
-
console.log(`Current URL is [${url}]`);
|
|
1207
|
-
```
|
|
1208
|
-
|
|
1209
|
-
Returns **[Promise][26]<[string][18]>** current URL
|
|
1210
|
-
|
|
1211
|
-
### grabCurrentWindowHandle
|
|
1212
|
-
|
|
1213
|
-
Get the current Window Handle.
|
|
1214
|
-
Useful for referencing it when calling `I.switchToWindow(handle)`
|
|
1215
|
-
|
|
1216
|
-
```js
|
|
1217
|
-
const window = await I.grabCurrentWindowHandle();
|
|
1218
|
-
```
|
|
1219
|
-
|
|
1220
|
-
Returns **[Promise][26]<[string][18]>**
|
|
1221
|
-
|
|
1222
|
-
### grabElementBoundingRect
|
|
1223
|
-
|
|
1224
|
-
Grab the width, height, location of given locator.
|
|
1225
|
-
Provide `width` or `height`as second param to get your desired prop.
|
|
1226
|
-
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1227
|
-
|
|
1228
|
-
Returns an object with `x`, `y`, `width`, `height` keys.
|
|
1229
|
-
|
|
1230
|
-
```js
|
|
1231
|
-
const value = await I.grabElementBoundingRect('h3');
|
|
1232
|
-
// value is like { x: 226.5, y: 89, width: 527, height: 220 }
|
|
1233
|
-
```
|
|
1234
|
-
|
|
1235
|
-
To get only one metric use second parameter:
|
|
1236
|
-
|
|
1237
|
-
```js
|
|
1238
|
-
const width = await I.grabElementBoundingRect('h3', 'width');
|
|
1239
|
-
// width == 527
|
|
1240
|
-
```
|
|
1241
|
-
|
|
1242
|
-
#### Parameters
|
|
1243
|
-
|
|
1244
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1245
|
-
- `prop`
|
|
1246
|
-
- `elementSize` **[string][18]?** x, y, width or height of the given element.
|
|
1247
|
-
|
|
1248
|
-
Returns **([Promise][26]<DOMRect> | [Promise][26]<[number][23]>)** Element bounding rectangle
|
|
1249
|
-
|
|
1250
|
-
### grabGeoLocation
|
|
1251
|
-
|
|
1252
|
-
This method is **deprecated**.
|
|
1253
|
-
|
|
1254
|
-
Return the current geo location
|
|
1255
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1256
|
-
|
|
1257
|
-
```js
|
|
1258
|
-
let geoLocation = await I.grabGeoLocation();
|
|
1259
|
-
```
|
|
1260
|
-
|
|
1261
|
-
Returns **[Promise][26]<{latitude: [number][23], longitude: [number][23], altitude: [number][23]}>**
|
|
1262
|
-
|
|
1263
|
-
### grabHTMLFrom
|
|
1264
|
-
|
|
1265
|
-
Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
|
|
1266
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1267
|
-
If more than one element is found - HTML of first element is returned.
|
|
1268
|
-
|
|
1269
|
-
```js
|
|
1270
|
-
let postHTML = await I.grabHTMLFrom('#post');
|
|
1271
|
-
```
|
|
1272
|
-
|
|
1273
|
-
#### Parameters
|
|
1274
|
-
|
|
1275
|
-
- `locator`
|
|
1276
|
-
- `element` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1277
|
-
|
|
1278
|
-
Returns **[Promise][26]<[string][18]>** HTML code for an element
|
|
1279
|
-
|
|
1280
|
-
### grabHTMLFromAll
|
|
1281
|
-
|
|
1282
|
-
Retrieves all the innerHTML from elements located by CSS or XPath and returns it to test.
|
|
1283
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1284
|
-
|
|
1285
|
-
```js
|
|
1286
|
-
let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
1287
|
-
```
|
|
1288
|
-
|
|
1289
|
-
#### Parameters
|
|
1290
|
-
|
|
1291
|
-
- `locator`
|
|
1292
|
-
- `element` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1293
|
-
|
|
1294
|
-
Returns **[Promise][26]<[Array][29]<[string][18]>>** HTML code for an element
|
|
1295
|
-
|
|
1296
|
-
### grabNumberOfOpenTabs
|
|
1297
|
-
|
|
1298
|
-
Grab number of open tabs.
|
|
1299
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1300
|
-
|
|
1301
|
-
```js
|
|
1302
|
-
let tabs = await I.grabNumberOfOpenTabs();
|
|
1303
|
-
```
|
|
1304
|
-
|
|
1305
|
-
Returns **[Promise][26]<[number][23]>** number of open tabs
|
|
1306
|
-
|
|
1307
|
-
### grabNumberOfVisibleElements
|
|
1308
|
-
|
|
1309
|
-
Grab number of visible elements by locator.
|
|
1310
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1311
|
-
|
|
1312
|
-
```js
|
|
1313
|
-
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
1314
|
-
```
|
|
1315
|
-
|
|
1316
|
-
#### Parameters
|
|
1317
|
-
|
|
1318
|
-
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1319
|
-
|
|
1320
|
-
Returns **[Promise][26]<[number][23]>** number of visible elements
|
|
1321
|
-
|
|
1322
|
-
### grabPageScrollPosition
|
|
1323
|
-
|
|
1324
|
-
Retrieves a page scroll position and returns it to test.
|
|
1325
|
-
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1326
|
-
|
|
1327
|
-
```js
|
|
1328
|
-
let { x, y } = await I.grabPageScrollPosition();
|
|
1329
|
-
```
|
|
1330
|
-
|
|
1331
|
-
Returns **[Promise][26]<PageScrollPosition>** scroll position
|
|
1332
|
-
|
|
1333
|
-
### grabPopupText
|
|
1334
|
-
|
|
1335
|
-
Grab the text within the popup. If no popup is visible then it will return null.
|
|
1336
|
-
|
|
1337
|
-
```js
|
|
1338
|
-
await I.grabPopupText();
|
|
1339
|
-
```
|
|
1340
|
-
|
|
1341
|
-
Returns **[Promise][26]<[string][18]>**
|
|
1342
|
-
|
|
1343
|
-
### grabSource
|
|
1344
|
-
|
|
1345
|
-
Retrieves page source and returns it to test.
|
|
1346
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1347
|
-
|
|
1348
|
-
```js
|
|
1349
|
-
let pageSource = await I.grabSource();
|
|
1350
|
-
```
|
|
1351
|
-
|
|
1352
|
-
Returns **[Promise][26]<[string][18]>** source code
|
|
1353
|
-
|
|
1354
|
-
### grabTextFrom
|
|
1355
|
-
|
|
1356
|
-
Retrieves a text from an element located by CSS or XPath and returns it to test.
|
|
1357
|
-
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1358
|
-
|
|
1359
|
-
```js
|
|
1360
|
-
let pin = await I.grabTextFrom('#pin');
|
|
1361
|
-
```
|
|
1362
|
-
|
|
1363
|
-
If multiple elements found returns first element.
|
|
1364
|
-
|
|
1365
|
-
#### Parameters
|
|
1366
|
-
|
|
1367
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1368
|
-
|
|
1369
|
-
Returns **[Promise][26]<[string][18]>** attribute value
|
|
1370
|
-
|
|
1371
|
-
### grabTextFromAll
|
|
1372
|
-
|
|
1373
|
-
Retrieves all texts from an element located by CSS or XPath and returns it to test.
|
|
1374
|
-
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1375
|
-
|
|
1376
|
-
```js
|
|
1377
|
-
let pins = await I.grabTextFromAll('#pin li');
|
|
1378
|
-
```
|
|
1379
|
-
|
|
1380
|
-
#### Parameters
|
|
1381
|
-
|
|
1382
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1383
|
-
|
|
1384
|
-
Returns **[Promise][26]<[Array][29]<[string][18]>>** attribute value
|
|
1385
|
-
|
|
1386
|
-
### grabTitle
|
|
1387
|
-
|
|
1388
|
-
Retrieves a page title and returns it to test.
|
|
1389
|
-
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
1390
|
-
|
|
1391
|
-
```js
|
|
1392
|
-
let title = await I.grabTitle();
|
|
1393
|
-
```
|
|
1394
|
-
|
|
1395
|
-
Returns **[Promise][26]<[string][18]>** title
|
|
1396
|
-
|
|
1397
|
-
### grabValueFrom
|
|
1398
|
-
|
|
1399
|
-
Retrieves a value from a form element located by CSS or XPath and returns it to test.
|
|
1400
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1401
|
-
If more than one element is found - value of first element is returned.
|
|
1402
|
-
|
|
1403
|
-
```js
|
|
1404
|
-
let email = await I.grabValueFrom('input[name=email]');
|
|
1405
|
-
```
|
|
1406
|
-
|
|
1407
|
-
#### Parameters
|
|
1408
|
-
|
|
1409
|
-
- `locator` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
1410
|
-
|
|
1411
|
-
Returns **[Promise][26]<[string][18]>** attribute value
|
|
1412
|
-
|
|
1413
|
-
### grabValueFromAll
|
|
1414
|
-
|
|
1415
|
-
Retrieves an array of value from a form located by CSS or XPath and returns it to test.
|
|
1416
|
-
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1417
|
-
|
|
1418
|
-
```js
|
|
1419
|
-
let inputs = await I.grabValueFromAll('//form/input');
|
|
1420
|
-
```
|
|
1421
|
-
|
|
1422
|
-
#### Parameters
|
|
1423
|
-
|
|
1424
|
-
- `locator` **([string][18] | [object][17])** field located by label|name|CSS|XPath|strict locator.
|
|
1425
|
-
|
|
1426
|
-
Returns **[Promise][26]<[Array][29]<[string][18]>>** attribute value
|
|
1427
|
-
|
|
1428
|
-
### grabWebElements
|
|
1429
|
-
|
|
1430
|
-
Grab WebElements for given locator
|
|
1431
|
-
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1432
|
-
|
|
1433
|
-
```js
|
|
1434
|
-
const webElements = await I.grabWebElements('#button');
|
|
1435
|
-
```
|
|
1436
|
-
|
|
1437
|
-
#### Parameters
|
|
1438
|
-
|
|
1439
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1440
|
-
|
|
1441
|
-
Returns **[Promise][26]<any>** WebElement of being used Web helper
|
|
1442
|
-
|
|
1443
|
-
### moveCursorTo
|
|
1444
|
-
|
|
1445
|
-
Moves cursor to element matched by locator.
|
|
1446
|
-
Extra shift can be set with offsetX and offsetY options.
|
|
1447
|
-
|
|
1448
|
-
```js
|
|
1449
|
-
I.moveCursorTo('.tooltip');
|
|
1450
|
-
I.moveCursorTo('#submit', 5,5);
|
|
1451
|
-
```
|
|
1452
|
-
|
|
1453
|
-
#### Parameters
|
|
1454
|
-
|
|
1455
|
-
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1456
|
-
- `xOffset`
|
|
1457
|
-
- `yOffset`
|
|
1458
|
-
- `offsetX` **[number][23]** (optional, `0` by default) X-axis offset.
|
|
1459
|
-
- `offsetY` **[number][23]** (optional, `0` by default) Y-axis offset.
|
|
1460
|
-
|
|
1461
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1462
|
-
|
|
1463
|
-
### openNewTab
|
|
1464
|
-
|
|
1465
|
-
Open new tab and switch to it.
|
|
1466
|
-
|
|
1467
|
-
```js
|
|
1468
|
-
I.openNewTab();
|
|
1469
|
-
```
|
|
1470
|
-
|
|
1471
|
-
#### Parameters
|
|
1472
|
-
|
|
1473
|
-
- `url`
|
|
1474
|
-
- `windowName`
|
|
1475
|
-
|
|
1476
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1477
|
-
|
|
1478
|
-
### pressKey
|
|
1479
|
-
|
|
1480
|
-
_Note:_ In case a text field or textarea is focused be aware that some browsers do not respect active modifier when combining modifier keys with other keys.
|
|
1481
|
-
|
|
1482
|
-
Presses a key in the browser (on a focused element).
|
|
1483
|
-
|
|
1484
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][31].
|
|
1485
|
-
|
|
1486
|
-
```js
|
|
1487
|
-
I.pressKey('Backspace');
|
|
1488
|
-
```
|
|
1489
|
-
|
|
1490
|
-
To press a key in combination with modifier keys, pass the sequence as an array. All modifier keys (`'Alt'`, `'Control'`, `'Meta'`, `'Shift'`) will be released afterwards.
|
|
1491
|
-
|
|
1492
|
-
```js
|
|
1493
|
-
I.pressKey(['Control', 'Z']);
|
|
1494
|
-
```
|
|
1495
|
-
|
|
1496
|
-
For specifying operation modifier key based on operating system it is suggested to use `'CommandOrControl'`.
|
|
1497
|
-
This will press `'Command'` (also known as `'Meta'`) on macOS machines and `'Control'` on non-macOS machines.
|
|
1498
|
-
|
|
1499
|
-
```js
|
|
1500
|
-
I.pressKey(['CommandOrControl', 'Z']);
|
|
1501
|
-
```
|
|
1502
|
-
|
|
1503
|
-
Some of the supported key names are:
|
|
1504
|
-
|
|
1505
|
-
- `'AltLeft'` or `'Alt'`
|
|
1506
|
-
- `'AltRight'`
|
|
1507
|
-
- `'ArrowDown'`
|
|
1508
|
-
- `'ArrowLeft'`
|
|
1509
|
-
- `'ArrowRight'`
|
|
1510
|
-
- `'ArrowUp'`
|
|
1511
|
-
- `'Backspace'`
|
|
1512
|
-
- `'Clear'`
|
|
1513
|
-
- `'ControlLeft'` or `'Control'`
|
|
1514
|
-
- `'ControlRight'`
|
|
1515
|
-
- `'Command'`
|
|
1516
|
-
- `'CommandOrControl'`
|
|
1517
|
-
- `'Delete'`
|
|
1518
|
-
- `'End'`
|
|
1519
|
-
- `'Enter'`
|
|
1520
|
-
- `'Escape'`
|
|
1521
|
-
- `'F1'` to `'F12'`
|
|
1522
|
-
- `'Home'`
|
|
1523
|
-
- `'Insert'`
|
|
1524
|
-
- `'MetaLeft'` or `'Meta'`
|
|
1525
|
-
- `'MetaRight'`
|
|
1526
|
-
- `'Numpad0'` to `'Numpad9'`
|
|
1527
|
-
- `'NumpadAdd'`
|
|
1528
|
-
- `'NumpadDecimal'`
|
|
1529
|
-
- `'NumpadDivide'`
|
|
1530
|
-
- `'NumpadMultiply'`
|
|
1531
|
-
- `'NumpadSubtract'`
|
|
1532
|
-
- `'PageDown'`
|
|
1533
|
-
- `'PageUp'`
|
|
1534
|
-
- `'Pause'`
|
|
1535
|
-
- `'Return'`
|
|
1536
|
-
- `'ShiftLeft'` or `'Shift'`
|
|
1537
|
-
- `'ShiftRight'`
|
|
1538
|
-
- `'Space'`
|
|
1539
|
-
- `'Tab'`
|
|
1540
|
-
|
|
1541
|
-
#### Parameters
|
|
1542
|
-
|
|
1543
|
-
- `key` **([string][18] | [Array][29]<[string][18]>)** key or array of keys to press.
|
|
1544
|
-
|
|
1545
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1546
|
-
|
|
1547
|
-
### pressKeyDown
|
|
1548
|
-
|
|
1549
|
-
Presses a key in the browser and leaves it in a down state.
|
|
1550
|
-
|
|
1551
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][32]).
|
|
1552
|
-
|
|
1553
|
-
```js
|
|
1554
|
-
I.pressKeyDown('Control');
|
|
1555
|
-
I.click('#element');
|
|
1556
|
-
I.pressKeyUp('Control');
|
|
1557
|
-
```
|
|
1558
|
-
|
|
1559
|
-
#### Parameters
|
|
1560
|
-
|
|
1561
|
-
- `key` **[string][18]** name of key to press down.
|
|
1562
|
-
|
|
1563
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1564
|
-
|
|
1565
|
-
### pressKeyUp
|
|
1566
|
-
|
|
1567
|
-
Releases a key in the browser which was previously set to a down state.
|
|
1568
|
-
|
|
1569
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][32]).
|
|
1570
|
-
|
|
1571
|
-
```js
|
|
1572
|
-
I.pressKeyDown('Control');
|
|
1573
|
-
I.click('#element');
|
|
1574
|
-
I.pressKeyUp('Control');
|
|
1575
|
-
```
|
|
1576
|
-
|
|
1577
|
-
#### Parameters
|
|
1578
|
-
|
|
1579
|
-
- `key` **[string][18]** name of key to release.
|
|
1580
|
-
|
|
1581
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1582
|
-
|
|
1583
|
-
### refreshPage
|
|
1584
|
-
|
|
1585
|
-
Reload the current page.
|
|
1586
|
-
|
|
1587
|
-
```js
|
|
1588
|
-
I.refreshPage();
|
|
1589
|
-
```
|
|
1590
|
-
|
|
1591
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1592
|
-
|
|
1593
|
-
### resizeWindow
|
|
1594
|
-
|
|
1595
|
-
Appium: not tested in web, in apps doesn't work
|
|
1596
|
-
|
|
1597
|
-
Resize the current window to provided width and height.
|
|
1598
|
-
First parameter can be set to `maximize`.
|
|
1599
|
-
|
|
1600
|
-
#### Parameters
|
|
1601
|
-
|
|
1602
|
-
- `width` **[number][23]** width in pixels or `maximize`.
|
|
1603
|
-
- `height` **[number][23]** height in pixels.
|
|
1604
|
-
|
|
1605
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1606
|
-
|
|
1607
|
-
### rightClick
|
|
1608
|
-
|
|
1609
|
-
Performs right click on a clickable element matched by semantic locator, CSS or XPath.
|
|
1610
|
-
|
|
1611
|
-
```js
|
|
1612
|
-
// right click element with id el
|
|
1613
|
-
I.rightClick('#el');
|
|
1614
|
-
// right click link or button with text "Click me"
|
|
1615
|
-
I.rightClick('Click me');
|
|
1616
|
-
// right click button with text "Click me" inside .context
|
|
1617
|
-
I.rightClick('Click me', '.context');
|
|
1618
|
-
```
|
|
1619
|
-
|
|
1620
|
-
#### Parameters
|
|
1621
|
-
|
|
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.
|
|
1624
|
-
|
|
1625
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
### runInWeb
|
|
1632
|
-
|
|
1633
|
-
Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
1634
|
-
|
|
1635
|
-
#### Parameters
|
|
1636
|
-
|
|
1637
|
-
- `fn`
|
|
1638
|
-
|
|
1639
|
-
### runOnAndroid
|
|
1640
|
-
|
|
1641
|
-
Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
1642
|
-
|
|
1643
|
-
#### Parameters
|
|
1644
|
-
|
|
1645
|
-
- `caps` **any**
|
|
1646
|
-
- `fn` **any**
|
|
1647
|
-
|
|
1648
|
-
### runOnIOS
|
|
1649
|
-
|
|
1650
|
-
Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
1651
|
-
|
|
1652
|
-
#### Parameters
|
|
1653
|
-
|
|
1654
|
-
- `caps` **any**
|
|
1655
|
-
- `fn` **any**
|
|
1656
|
-
|
|
1657
|
-
### saveElementScreenshot
|
|
1658
|
-
|
|
1659
|
-
Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
1660
|
-
Filename is relative to output folder.
|
|
1661
|
-
|
|
1662
|
-
```js
|
|
1663
|
-
I.saveElementScreenshot(`#submit`,'debug.png');
|
|
1664
|
-
```
|
|
1665
|
-
|
|
1666
|
-
#### Parameters
|
|
1667
|
-
|
|
1668
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1669
|
-
- `fileName` **[string][18]** file name to save.
|
|
1670
|
-
|
|
1671
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1672
|
-
|
|
1673
|
-
### saveScreenshot
|
|
1674
|
-
|
|
1675
|
-
Saves a screenshot to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
1676
|
-
Filename is relative to output folder.
|
|
1677
|
-
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.
|
|
1678
|
-
|
|
1679
|
-
```js
|
|
1680
|
-
I.saveScreenshot('debug.png');
|
|
1681
|
-
I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scrollWidth before taking screenshot
|
|
1682
|
-
```
|
|
1683
|
-
|
|
1684
|
-
#### Parameters
|
|
1685
|
-
|
|
1686
|
-
- `fileName` **[string][18]** file name to save.
|
|
1687
|
-
- `fullPage` **[boolean][33]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1688
|
-
|
|
1689
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1690
|
-
|
|
1691
|
-
### scrollIntoView
|
|
1692
|
-
|
|
1693
|
-
Scroll element into viewport.
|
|
1694
|
-
|
|
1695
|
-
```js
|
|
1696
|
-
I.scrollIntoView('#submit');
|
|
1697
|
-
I.scrollIntoView('#submit', true);
|
|
1698
|
-
I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" });
|
|
1699
|
-
```
|
|
1700
|
-
|
|
1701
|
-
#### Parameters
|
|
1702
|
-
|
|
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].
|
|
1705
|
-
|
|
1706
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1707
|
-
|
|
1708
|
-
### scrollPageToBottom
|
|
1709
|
-
|
|
1710
|
-
Scroll page to the bottom.
|
|
1711
|
-
|
|
1712
|
-
```js
|
|
1713
|
-
I.scrollPageToBottom();
|
|
1714
|
-
```
|
|
1715
|
-
|
|
1716
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1717
|
-
|
|
1718
|
-
### scrollPageToTop
|
|
1719
|
-
|
|
1720
|
-
Scroll page to the top.
|
|
1721
|
-
|
|
1722
|
-
```js
|
|
1723
|
-
I.scrollPageToTop();
|
|
1724
|
-
```
|
|
1725
|
-
|
|
1726
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1727
|
-
|
|
1728
|
-
### scrollTo
|
|
1729
|
-
|
|
1730
|
-
Scrolls to element matched by locator.
|
|
1731
|
-
Extra shift can be set with offsetX and offsetY options.
|
|
1732
|
-
|
|
1733
|
-
```js
|
|
1734
|
-
I.scrollTo('footer');
|
|
1735
|
-
I.scrollTo('#submit', 5, 5);
|
|
1736
|
-
```
|
|
1737
|
-
|
|
1738
|
-
#### Parameters
|
|
1739
|
-
|
|
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.
|
|
1743
|
-
|
|
1744
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1745
|
-
|
|
1746
|
-
### see
|
|
1747
|
-
|
|
1748
|
-
Checks that a page contains a visible text.
|
|
1749
|
-
Use context parameter to narrow down the search.
|
|
1750
|
-
|
|
1751
|
-
```js
|
|
1752
|
-
I.see('Welcome'); // text welcome on a page
|
|
1753
|
-
I.see('Welcome', '.content'); // text inside .content div
|
|
1754
|
-
I.see('Register', {css: 'form.register'}); // use strict locator
|
|
1755
|
-
```
|
|
1756
|
-
|
|
1757
|
-
#### Parameters
|
|
1758
|
-
|
|
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.
|
|
1761
|
-
|
|
1762
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
### seeAttributesOnElements
|
|
1769
|
-
|
|
1770
|
-
Checks that all elements with given locator have given attributes.
|
|
1771
|
-
|
|
1772
|
-
```js
|
|
1773
|
-
I.seeAttributesOnElements('//form', { method: "post"});
|
|
1774
|
-
```
|
|
1775
|
-
|
|
1776
|
-
#### Parameters
|
|
1777
|
-
|
|
1778
|
-
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1779
|
-
- `attributes` **[object][17]** attributes and their values to check.
|
|
1780
|
-
|
|
1781
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1782
|
-
|
|
1783
|
-
### seeCheckboxIsChecked
|
|
1784
|
-
|
|
1785
|
-
Appium: not tested
|
|
1786
|
-
Verifies that the specified checkbox is checked.
|
|
1787
|
-
|
|
1788
|
-
```js
|
|
1789
|
-
I.seeCheckboxIsChecked('Agree');
|
|
1790
|
-
I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
|
|
1791
|
-
I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
1792
|
-
```
|
|
1793
|
-
|
|
1794
|
-
#### Parameters
|
|
1795
|
-
|
|
1796
|
-
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
1797
|
-
|
|
1798
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1799
|
-
|
|
1800
|
-
### seeCookie
|
|
1801
|
-
|
|
1802
|
-
Checks that cookie with given name exists.
|
|
1803
|
-
|
|
1804
|
-
```js
|
|
1805
|
-
I.seeCookie('Auth');
|
|
1806
|
-
```
|
|
1807
|
-
|
|
1808
|
-
#### Parameters
|
|
1809
|
-
|
|
1810
|
-
- `name` **[string][18]** cookie name.
|
|
1811
|
-
|
|
1812
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1813
|
-
|
|
1814
|
-
### seeCssPropertiesOnElements
|
|
1815
|
-
|
|
1816
|
-
Checks that all elements with given locator have given CSS properties.
|
|
1817
|
-
|
|
1818
|
-
```js
|
|
1819
|
-
I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
1820
|
-
```
|
|
1821
|
-
|
|
1822
|
-
#### Parameters
|
|
1823
|
-
|
|
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.
|
|
1826
|
-
|
|
1827
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1828
|
-
|
|
1829
|
-
### seeCurrentUrlEquals
|
|
1830
|
-
|
|
1831
|
-
Checks that current url is equal to provided one.
|
|
1832
|
-
If a relative url provided, a configured url will be prepended to it.
|
|
1833
|
-
So both examples will work:
|
|
1834
|
-
|
|
1835
|
-
```js
|
|
1836
|
-
I.seeCurrentUrlEquals('/register');
|
|
1837
|
-
I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
1838
|
-
```
|
|
1839
|
-
|
|
1840
|
-
#### Parameters
|
|
1841
|
-
|
|
1842
|
-
- `url` **[string][18]** value to check.
|
|
1843
|
-
|
|
1844
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1845
|
-
|
|
1846
|
-
### seeElement
|
|
1847
|
-
|
|
1848
|
-
Checks that a given Element is visible
|
|
1849
|
-
Element is located by CSS or XPath.
|
|
1850
|
-
|
|
1851
|
-
```js
|
|
1852
|
-
I.seeElement('#modal');
|
|
1853
|
-
```
|
|
1854
|
-
|
|
1855
|
-
#### Parameters
|
|
1856
|
-
|
|
1857
|
-
- `locator` **([string][18] | [object][17])** located by CSS|XPath|strict locator.
|
|
1858
|
-
|
|
1859
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
### seeElementInDOM
|
|
1866
|
-
|
|
1867
|
-
Checks that a given Element is present in the DOM
|
|
1868
|
-
Element is located by CSS or XPath.
|
|
1869
|
-
|
|
1870
|
-
```js
|
|
1871
|
-
I.seeElementInDOM('#modal');
|
|
1872
|
-
```
|
|
1873
|
-
|
|
1874
|
-
#### Parameters
|
|
1875
|
-
|
|
1876
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1877
|
-
|
|
1878
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1879
|
-
|
|
1880
|
-
### seeInCurrentUrl
|
|
1881
|
-
|
|
1882
|
-
Checks that current url contains a provided fragment.
|
|
1883
|
-
|
|
1884
|
-
```js
|
|
1885
|
-
I.seeInCurrentUrl('/register'); // we are on registration page
|
|
1886
|
-
```
|
|
1887
|
-
|
|
1888
|
-
#### Parameters
|
|
1889
|
-
|
|
1890
|
-
- `url` **[string][18]** a fragment to check
|
|
1891
|
-
|
|
1892
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1893
|
-
|
|
1894
|
-
### seeInField
|
|
1895
|
-
|
|
1896
|
-
Checks that the given input field or textarea equals to given value.
|
|
1897
|
-
For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
1898
|
-
|
|
1899
|
-
```js
|
|
1900
|
-
I.seeInField('Username', 'davert');
|
|
1901
|
-
I.seeInField({css: 'form textarea'},'Type your comment here');
|
|
1902
|
-
I.seeInField('form input[type=hidden]','hidden_value');
|
|
1903
|
-
I.seeInField('#searchform input','Search');
|
|
1904
|
-
```
|
|
1905
|
-
|
|
1906
|
-
#### Parameters
|
|
1907
|
-
|
|
1908
|
-
- `field` **([string][18] | [object][17])** located by label|name|CSS|XPath|strict locator.
|
|
1909
|
-
- `value` **([string][18] | [object][17])** value to check.
|
|
1910
|
-
|
|
1911
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1912
|
-
|
|
1913
|
-
### seeInPopup
|
|
1914
|
-
|
|
1915
|
-
Checks that the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`, contains the
|
|
1916
|
-
given string.
|
|
1917
|
-
|
|
1918
|
-
#### Parameters
|
|
1919
|
-
|
|
1920
|
-
- `text` **[string][18]** value to check.
|
|
1921
|
-
|
|
1922
|
-
### seeInSource
|
|
1923
|
-
|
|
1924
|
-
Checks that the current page contains the given string in its raw source code.
|
|
1925
|
-
|
|
1926
|
-
```js
|
|
1927
|
-
I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
1928
|
-
```
|
|
1929
|
-
|
|
1930
|
-
#### Parameters
|
|
1931
|
-
|
|
1932
|
-
- `text` **[string][18]** value to check.
|
|
1933
|
-
|
|
1934
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1935
|
-
|
|
1936
|
-
### seeInTitle
|
|
1937
|
-
|
|
1938
|
-
Checks that title contains text.
|
|
1939
|
-
|
|
1940
|
-
```js
|
|
1941
|
-
I.seeInTitle('Home Page');
|
|
1942
|
-
```
|
|
1943
|
-
|
|
1944
|
-
#### Parameters
|
|
1945
|
-
|
|
1946
|
-
- `text` **[string][18]** text value to check.
|
|
1947
|
-
|
|
1948
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1949
|
-
|
|
1950
|
-
### seeNumberOfElements
|
|
1951
|
-
|
|
1952
|
-
Asserts that an element appears a given number of times in the DOM.
|
|
1953
|
-
Element is located by label or name or CSS or XPath.
|
|
1954
|
-
|
|
1955
|
-
```js
|
|
1956
|
-
I.seeNumberOfElements('#submitBtn', 1);
|
|
1957
|
-
```
|
|
1958
|
-
|
|
1959
|
-
#### Parameters
|
|
1960
|
-
|
|
1961
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1962
|
-
- `num` **[number][23]** number of elements.
|
|
1963
|
-
|
|
1964
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
### seeNumberOfVisibleElements
|
|
1971
|
-
|
|
1972
|
-
Asserts that an element is visible a given number of times.
|
|
1973
|
-
Element is located by CSS or XPath.
|
|
1974
|
-
|
|
1975
|
-
```js
|
|
1976
|
-
I.seeNumberOfVisibleElements('.buttons', 3);
|
|
1977
|
-
```
|
|
1978
|
-
|
|
1979
|
-
#### Parameters
|
|
1980
|
-
|
|
1981
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
1982
|
-
- `num` **[number][23]** number of elements.
|
|
1983
|
-
|
|
1984
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
### seeTextEquals
|
|
1991
|
-
|
|
1992
|
-
Checks that text is equal to provided one.
|
|
1993
|
-
|
|
1994
|
-
```js
|
|
1995
|
-
I.seeTextEquals('text', 'h1');
|
|
1996
|
-
```
|
|
1997
|
-
|
|
1998
|
-
#### Parameters
|
|
1999
|
-
|
|
2000
|
-
- `text` **[string][18]** element value to check.
|
|
2001
|
-
- `context` **([string][18] | [object][17])?** element located by CSS|XPath|strict locator.
|
|
2002
|
-
|
|
2003
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2004
|
-
|
|
2005
|
-
### seeTitleEquals
|
|
2006
|
-
|
|
2007
|
-
Checks that title is equal to provided one.
|
|
2008
|
-
|
|
2009
|
-
```js
|
|
2010
|
-
I.seeTitleEquals('Test title.');
|
|
2011
|
-
```
|
|
2012
|
-
|
|
2013
|
-
#### Parameters
|
|
2014
|
-
|
|
2015
|
-
- `text` **[string][18]** value to check.
|
|
2016
|
-
|
|
2017
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2018
|
-
|
|
2019
|
-
### selectOption
|
|
2020
|
-
|
|
2021
|
-
Selects an option in a drop-down select.
|
|
2022
|
-
Field is searched by label | name | CSS | XPath.
|
|
2023
|
-
Option is selected by visible text or by value.
|
|
2024
|
-
|
|
2025
|
-
```js
|
|
2026
|
-
I.selectOption('Choose Plan', 'Monthly'); // select by label
|
|
2027
|
-
I.selectOption('subscription', 'Monthly'); // match option by text
|
|
2028
|
-
I.selectOption('subscription', '0'); // or by value
|
|
2029
|
-
I.selectOption('//form/select[@name=account]','Premium');
|
|
2030
|
-
I.selectOption('form select[name=account]', 'Premium');
|
|
2031
|
-
I.selectOption({css: 'form select[name=account]'}, 'Premium');
|
|
2032
|
-
```
|
|
2033
|
-
|
|
2034
|
-
Provide an array for the second argument to select multiple options.
|
|
2035
|
-
|
|
2036
|
-
```js
|
|
2037
|
-
I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
2038
|
-
```
|
|
2039
|
-
|
|
2040
|
-
#### Parameters
|
|
2041
|
-
|
|
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.
|
|
2044
|
-
|
|
2045
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2046
|
-
|
|
2047
|
-
### setCookie
|
|
2048
|
-
|
|
2049
|
-
Uses Selenium's JSON [cookie format][35].
|
|
2050
|
-
Sets cookie(s).
|
|
2051
|
-
|
|
2052
|
-
Can be a single cookie object or an array of cookies:
|
|
2053
|
-
|
|
2054
|
-
```js
|
|
2055
|
-
I.setCookie({name: 'auth', value: true});
|
|
2056
|
-
|
|
2057
|
-
// as array
|
|
2058
|
-
I.setCookie([
|
|
2059
|
-
{name: 'auth', value: true},
|
|
2060
|
-
{name: 'agree', value: true}
|
|
2061
|
-
]);
|
|
2062
|
-
```
|
|
2063
|
-
|
|
2064
|
-
#### Parameters
|
|
2065
|
-
|
|
2066
|
-
- `cookie` **(Cookie | [Array][29]<Cookie>)** a cookie object or array of cookie objects.
|
|
2067
|
-
|
|
2068
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2069
|
-
|
|
2070
|
-
### setGeoLocation
|
|
2071
|
-
|
|
2072
|
-
This method is **deprecated**.
|
|
2073
|
-
|
|
2074
|
-
Set the current geo location
|
|
2075
|
-
|
|
2076
|
-
```js
|
|
2077
|
-
I.setGeoLocation(121.21, 11.56);
|
|
2078
|
-
I.setGeoLocation(121.21, 11.56, 10);
|
|
2079
|
-
```
|
|
2080
|
-
|
|
2081
|
-
#### Parameters
|
|
2082
|
-
|
|
2083
|
-
- `latitude` **[number][23]** to set.
|
|
2084
|
-
- `longitude` **[number][23]** to set
|
|
2085
|
-
- `altitude` **[number][23]?** (optional, null by default) to set
|
|
2086
|
-
|
|
2087
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2088
|
-
|
|
2089
|
-
### switchTo
|
|
2090
|
-
|
|
2091
|
-
Switches frame or in case of null locator reverts to parent.
|
|
2092
|
-
|
|
2093
|
-
```js
|
|
2094
|
-
I.switchTo('iframe'); // switch to first iframe
|
|
2095
|
-
I.switchTo(); // switch back to main page
|
|
2096
|
-
```
|
|
2097
|
-
|
|
2098
|
-
#### Parameters
|
|
2099
|
-
|
|
2100
|
-
- `locator` **([string][18]? | [object][17])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
2101
|
-
|
|
2102
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2103
|
-
|
|
2104
|
-
### switchToNextTab
|
|
2105
|
-
|
|
2106
|
-
Switch focus to a particular tab by its number. It waits tabs loading and then switch tab.
|
|
2107
|
-
|
|
2108
|
-
```js
|
|
2109
|
-
I.switchToNextTab();
|
|
2110
|
-
I.switchToNextTab(2);
|
|
2111
|
-
```
|
|
2112
|
-
|
|
2113
|
-
#### Parameters
|
|
2114
|
-
|
|
2115
|
-
- `num` **[number][23]?** (optional) number of tabs to switch forward, default: 1.
|
|
2116
|
-
- `sec` **([number][23] | null)?** (optional) time in seconds to wait.
|
|
2117
|
-
|
|
2118
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2119
|
-
|
|
2120
|
-
### switchToPreviousTab
|
|
2121
|
-
|
|
2122
|
-
Switch focus to a particular tab by its number. It waits tabs loading and then switch tab.
|
|
2123
|
-
|
|
2124
|
-
```js
|
|
2125
|
-
I.switchToPreviousTab();
|
|
2126
|
-
I.switchToPreviousTab(2);
|
|
2127
|
-
```
|
|
2128
|
-
|
|
2129
|
-
#### Parameters
|
|
2130
|
-
|
|
2131
|
-
- `num` **[number][23]?** (optional) number of tabs to switch backward, default: 1.
|
|
2132
|
-
- `sec` **[number][23]??** (optional) time in seconds to wait.
|
|
2133
|
-
|
|
2134
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2135
|
-
|
|
2136
|
-
### switchToWindow
|
|
2137
|
-
|
|
2138
|
-
Switch to the window with a specified handle.
|
|
2139
|
-
|
|
2140
|
-
```js
|
|
2141
|
-
const windows = await I.grabAllWindowHandles();
|
|
2142
|
-
// ... do something
|
|
2143
|
-
await I.switchToWindow( windows[0] );
|
|
2144
|
-
|
|
2145
|
-
const window = await I.grabCurrentWindowHandle();
|
|
2146
|
-
// ... do something
|
|
2147
|
-
await I.switchToWindow( window );
|
|
2148
|
-
```
|
|
2149
|
-
|
|
2150
|
-
#### Parameters
|
|
2151
|
-
|
|
2152
|
-
- `window` **[string][18]** name of window handle.
|
|
2153
|
-
|
|
2154
|
-
### type
|
|
2155
|
-
|
|
2156
|
-
Types out the given text into an active field.
|
|
2157
|
-
To slow down typing use a second parameter, to set interval between key presses.
|
|
2158
|
-
_Note:_ Should be used when [`fillField`][31] is not an option.
|
|
2159
|
-
|
|
2160
|
-
```js
|
|
2161
|
-
// passing in a string
|
|
2162
|
-
I.type('Type this out.');
|
|
2163
|
-
|
|
2164
|
-
// typing values with a 100ms interval
|
|
2165
|
-
I.type('4141555311111111', 100);
|
|
2166
|
-
|
|
2167
|
-
// passing in an array
|
|
2168
|
-
I.type(['T', 'E', 'X', 'T']);
|
|
2169
|
-
|
|
2170
|
-
// passing a secret
|
|
2171
|
-
I.type(secret('123456'));
|
|
2172
|
-
```
|
|
2173
|
-
|
|
2174
|
-
#### Parameters
|
|
2175
|
-
|
|
2176
|
-
- `keys`
|
|
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.
|
|
2179
|
-
|
|
2180
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2181
|
-
|
|
2182
|
-
### uncheckOption
|
|
2183
|
-
|
|
2184
|
-
Appium: not tested
|
|
2185
|
-
Unselects a checkbox or radio button.
|
|
2186
|
-
Element is located by label or name or CSS or XPath.
|
|
2187
|
-
|
|
2188
|
-
The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
2189
|
-
|
|
2190
|
-
```js
|
|
2191
|
-
I.uncheckOption('#agree');
|
|
2192
|
-
I.uncheckOption('I Agree to Terms and Conditions');
|
|
2193
|
-
I.uncheckOption('agree', '//form');
|
|
2194
|
-
```
|
|
2195
|
-
|
|
2196
|
-
#### Parameters
|
|
2197
|
-
|
|
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.
|
|
2200
|
-
|
|
2201
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2202
|
-
|
|
2203
|
-
### useWebDriverTo
|
|
2204
|
-
|
|
2205
|
-
Use [webdriverio][36] API inside a test.
|
|
2206
|
-
|
|
2207
|
-
First argument is a description of an action.
|
|
2208
|
-
Second argument is async function that gets this helper as parameter.
|
|
2209
|
-
|
|
2210
|
-
{ [`browser`][36]) } object from WebDriver API is available.
|
|
2211
|
-
|
|
2212
|
-
```js
|
|
2213
|
-
I.useWebDriverTo('open multiple windows', async ({ browser }) {
|
|
2214
|
-
// create new window
|
|
2215
|
-
await browser.newWindow('https://webdriver.io');
|
|
2216
|
-
});
|
|
2217
|
-
```
|
|
2218
|
-
|
|
2219
|
-
#### Parameters
|
|
2220
|
-
|
|
2221
|
-
- `description` **[string][18]** used to show in logs.
|
|
2222
|
-
- `fn` **[function][25]** async functuion that executed with WebDriver helper as argument
|
|
2223
|
-
|
|
2224
|
-
### wait
|
|
2225
|
-
|
|
2226
|
-
Pauses execution for a number of seconds.
|
|
2227
|
-
|
|
2228
|
-
```js
|
|
2229
|
-
I.wait(2); // wait 2 secs
|
|
2230
|
-
```
|
|
2231
|
-
|
|
2232
|
-
#### Parameters
|
|
2233
|
-
|
|
2234
|
-
- `sec` **[number][23]** number of second to wait.
|
|
2235
|
-
|
|
2236
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2237
|
-
|
|
2238
|
-
### waitForClickable
|
|
2239
|
-
|
|
2240
|
-
Waits for element to be clickable (by default waits for 1sec).
|
|
2241
|
-
Element can be located by CSS or XPath.
|
|
2242
|
-
|
|
2243
|
-
```js
|
|
2244
|
-
I.waitForClickable('.btn.continue');
|
|
2245
|
-
I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
2246
|
-
```
|
|
2247
|
-
|
|
2248
|
-
#### Parameters
|
|
2249
|
-
|
|
2250
|
-
- `locator` **([string][18] | [object][17])** element located by CSS|XPath|strict locator.
|
|
2251
|
-
- `waitTimeout`
|
|
2252
|
-
- `sec` **[number][23]?** (optional, `1` by default) time in seconds to wait
|
|
2253
|
-
|
|
2254
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2255
|
-
|
|
2256
|
-
### waitForDetached
|
|
2257
|
-
|
|
2258
|
-
Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
2259
|
-
Element can be located by CSS or XPath.
|
|
2260
|
-
|
|
2261
|
-
```js
|
|
2262
|
-
I.waitForDetached('#popup');
|
|
2263
|
-
```
|
|
2264
|
-
|
|
2265
|
-
#### Parameters
|
|
2266
|
-
|
|
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
|
|
2269
|
-
|
|
2270
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2271
|
-
|
|
2272
|
-
### waitForElement
|
|
2273
|
-
|
|
2274
|
-
Waits for element to be present on page (by default waits for 1sec).
|
|
2275
|
-
Element can be located by CSS or XPath.
|
|
2276
|
-
|
|
2277
|
-
```js
|
|
2278
|
-
I.waitForElement('.btn.continue');
|
|
2279
|
-
I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
2280
|
-
```
|
|
2281
|
-
|
|
2282
|
-
#### Parameters
|
|
2283
|
-
|
|
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
|
|
2286
|
-
|
|
2287
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2288
|
-
|
|
2289
|
-
### waitForEnabled
|
|
2290
|
-
|
|
2291
|
-
Waits for element to become enabled (by default waits for 1sec).
|
|
2292
|
-
Element can be located by CSS or XPath.
|
|
2293
|
-
|
|
2294
|
-
#### Parameters
|
|
2295
|
-
|
|
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.
|
|
2298
|
-
|
|
2299
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2300
|
-
|
|
2301
|
-
### waitForFunction
|
|
2302
|
-
|
|
2303
|
-
Waits for a function to return true (waits for 1 sec by default).
|
|
2304
|
-
Running in browser context.
|
|
2305
|
-
|
|
2306
|
-
```js
|
|
2307
|
-
I.waitForFunction(fn[, [args[, timeout]])
|
|
2308
|
-
```
|
|
2309
|
-
|
|
2310
|
-
```js
|
|
2311
|
-
I.waitForFunction(() => window.requests == 0);
|
|
2312
|
-
I.waitForFunction(() => window.requests == 0, 5); // waits for 5 sec
|
|
2313
|
-
I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and wait for 5 sec
|
|
2314
|
-
```
|
|
2315
|
-
|
|
2316
|
-
#### Parameters
|
|
2317
|
-
|
|
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
|
|
2321
|
-
|
|
2322
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2323
|
-
|
|
2324
|
-
### waitForInvisible
|
|
2325
|
-
|
|
2326
|
-
Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
|
|
2327
|
-
Element can be located by CSS or XPath.
|
|
2328
|
-
|
|
2329
|
-
```js
|
|
2330
|
-
I.waitForInvisible('#popup');
|
|
2331
|
-
```
|
|
2332
|
-
|
|
2333
|
-
#### Parameters
|
|
2334
|
-
|
|
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.
|
|
2352
|
-
|
|
2353
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2354
|
-
|
|
2355
|
-
### waitForText
|
|
2356
|
-
|
|
2357
|
-
Waits for a text to appear (by default waits for 1sec).
|
|
2358
|
-
Element can be located by CSS or XPath.
|
|
2359
|
-
Narrow down search results by providing context.
|
|
2360
|
-
|
|
2361
|
-
```js
|
|
2362
|
-
I.waitForText('Thank you, form has been submitted');
|
|
2363
|
-
I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
2364
|
-
```
|
|
2365
|
-
|
|
2366
|
-
#### Parameters
|
|
2367
|
-
|
|
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.
|
|
2371
|
-
|
|
2372
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2373
|
-
|
|
2374
|
-
### waitForValue
|
|
2375
|
-
|
|
2376
|
-
Waits for the specified value to be in value attribute.
|
|
2377
|
-
|
|
2378
|
-
```js
|
|
2379
|
-
I.waitForValue('//input', "GoodValue");
|
|
2380
|
-
```
|
|
2381
|
-
|
|
2382
|
-
#### Parameters
|
|
2383
|
-
|
|
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
|
|
2387
|
-
|
|
2388
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2389
|
-
|
|
2390
|
-
### waitForVisible
|
|
2391
|
-
|
|
2392
|
-
Waits for an element to become visible on a page (by default waits for 1sec).
|
|
2393
|
-
Element can be located by CSS or XPath.
|
|
2394
|
-
|
|
2395
|
-
```js
|
|
2396
|
-
I.waitForVisible('#popup');
|
|
2397
|
-
```
|
|
2398
|
-
|
|
2399
|
-
#### Parameters
|
|
2400
|
-
|
|
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
|
|
2403
|
-
|
|
2404
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2405
|
-
|
|
2406
|
-
### waitInUrl
|
|
2407
|
-
|
|
2408
|
-
Waiting for the part of the URL to match the expected. Useful for SPA to understand that page was changed.
|
|
2409
|
-
|
|
2410
|
-
```js
|
|
2411
|
-
I.waitInUrl('/info', 2);
|
|
2412
|
-
```
|
|
2413
|
-
|
|
2414
|
-
#### Parameters
|
|
2415
|
-
|
|
2416
|
-
- `urlPart` **[string][18]** value to check.
|
|
2417
|
-
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2418
|
-
|
|
2419
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2420
|
-
|
|
2421
|
-
### waitNumberOfVisibleElements
|
|
2422
|
-
|
|
2423
|
-
Waits for a specified number of elements on the page.
|
|
2424
|
-
|
|
2425
|
-
```js
|
|
2426
|
-
I.waitNumberOfVisibleElements('a', 3);
|
|
2427
|
-
```
|
|
2428
|
-
|
|
2429
|
-
#### Parameters
|
|
2430
|
-
|
|
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
|
|
2434
|
-
|
|
2435
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2436
|
-
|
|
2437
|
-
### waitToHide
|
|
2438
|
-
|
|
2439
|
-
Waits for an element to hide (by default waits for 1sec).
|
|
2440
|
-
Element can be located by CSS or XPath.
|
|
2441
|
-
|
|
2442
|
-
```js
|
|
2443
|
-
I.waitToHide('#popup');
|
|
2444
|
-
```
|
|
2445
|
-
|
|
2446
|
-
#### Parameters
|
|
2447
|
-
|
|
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
|
|
2450
|
-
|
|
2451
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2452
|
-
|
|
2453
|
-
### waitUrlEquals
|
|
2454
|
-
|
|
2455
|
-
Waits for the entire URL to match the expected
|
|
2456
|
-
|
|
2457
|
-
```js
|
|
2458
|
-
I.waitUrlEquals('/info', 2);
|
|
2459
|
-
I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
2460
|
-
```
|
|
2461
|
-
|
|
2462
|
-
#### Parameters
|
|
2463
|
-
|
|
2464
|
-
- `urlPart` **[string][18]** value to check.
|
|
2465
|
-
- `sec` **[number][23]** (optional, `1` by default) time in seconds to wait
|
|
2466
|
-
|
|
2467
|
-
Returns **void** automatically synchronized promise through #recorder
|
|
2468
|
-
|
|
2469
|
-
[1]: http://webdriver.io/
|
|
2470
|
-
|
|
2471
|
-
[2]: https://codecept.io/webdriver/#testing-with-webdriver
|
|
2472
|
-
|
|
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/
|
|
2480
|
-
|
|
2481
|
-
[7]: https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
|
|
2482
|
-
|
|
2483
|
-
[8]: http://webdriver.io/guide/usage/cloudservices.html
|
|
2484
|
-
|
|
2485
|
-
[9]: https://webdriver.io/docs/sauce-service.html
|
|
2486
|
-
|
|
2487
|
-
[10]: https://github.com/puneet0191/codeceptjs-saucehelper/
|
|
2488
|
-
|
|
2489
|
-
[11]: https://webdriver.io/docs/browserstack-service.html
|
|
2490
|
-
|
|
2491
|
-
[12]: https://github.com/PeterNgTr/codeceptjs-bshelper
|
|
2492
|
-
|
|
2493
|
-
[13]: https://github.com/testingbot/codeceptjs-tbhelper
|
|
2494
|
-
|
|
2495
|
-
[14]: https://webdriver.io/docs/testingbot-service.html
|
|
2496
|
-
|
|
2497
|
-
[15]: https://github.com/PeterNgTr/codeceptjs-applitoolshelper
|
|
2498
|
-
|
|
2499
|
-
[16]: http://webdriver.io/guide/usage/multiremote.html
|
|
2500
|
-
|
|
2501
|
-
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
2502
|
-
|
|
2503
|
-
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2504
|
-
|
|
2505
|
-
[19]: http://jster.net/category/windows-modals-popups
|
|
2506
|
-
|
|
2507
|
-
[20]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2508
|
-
|
|
2509
|
-
[21]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2510
|
-
|
|
2511
|
-
[22]: https://webdriver.io/docs/timeouts.html
|
|
2512
|
-
|
|
2513
|
-
[23]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2514
|
-
|
|
2515
|
-
[24]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
2516
|
-
|
|
2517
|
-
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2518
|
-
|
|
2519
|
-
[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2520
|
-
|
|
2521
|
-
[27]: http://webdriver.io/api/protocol/execute.html
|
|
2522
|
-
|
|
2523
|
-
[28]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2524
|
-
|
|
2525
|
-
[29]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2526
|
-
|
|
2527
|
-
[30]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
|
|
2528
|
-
|
|
2529
|
-
[31]: #fillfield
|
|
2530
|
-
|
|
2531
|
-
[32]: #click
|
|
2532
|
-
|
|
2533
|
-
[33]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2534
|
-
|
|
2535
|
-
[34]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
2536
|
-
|
|
2537
|
-
[35]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object
|
|
2538
|
-
|
|
2539
|
-
[36]: https://webdriver.io/docs/api.html
|
|
2540
|
-
|
|
2541
|
-
[37]: http://codecept.io/acceptance/#smartwait
|
|
2542
|
-
|
|
2543
|
-
[38]: http://webdriver.io/docs/timeouts.html
|
|
2544
|
-
|
|
2545
|
-
[39]: https://webdriver.io/docs/configuration/#loglevel
|
|
2546
|
-
|
|
2547
|
-
[40]: https://webdriver.io/docs/automationProtocols/#devtools-protocol
|