Complex classes like AcceptanceTesterActions often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use AcceptanceTesterActions, and based on these observations, apply Extract Interface, too.
| 1 | <?php //[STAMP] 3bad8804b2cdabdad585084b8267e113 |
||
| 8 | trait AcceptanceTesterActions |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @return \Codeception\Scenario |
||
| 12 | */ |
||
| 13 | abstract protected function getScenario(); |
||
| 14 | |||
| 15 | |||
| 16 | /** |
||
| 17 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 18 | * |
||
| 19 | * Print out latest Selenium Logs in debug mode |
||
| 20 | * |
||
| 21 | * @param TestInterface $test |
||
| 22 | * @see \Codeception\Module\WebDriver::debugWebDriverLogs() |
||
| 23 | */ |
||
| 24 | public function debugWebDriverLogs($test = null) { |
||
| 27 | |||
| 28 | |||
| 29 | /** |
||
| 30 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 31 | * |
||
| 32 | * Changes the subdomain for the 'url' configuration parameter. |
||
| 33 | * Does not open a page; use `amOnPage` for that. |
||
| 34 | * |
||
| 35 | * ``` php |
||
| 36 | * <?php |
||
| 37 | * // If config is: 'http://mysite.com' |
||
| 38 | * // or config is: 'http://www.mysite.com' |
||
| 39 | * // or config is: 'http://company.mysite.com' |
||
| 40 | * |
||
| 41 | * $I->amOnSubdomain('user'); |
||
| 42 | * $I->amOnPage('/'); |
||
| 43 | * // moves to http://user.mysite.com/ |
||
| 44 | * ?> |
||
| 45 | * ``` |
||
| 46 | * |
||
| 47 | * @param $subdomain |
||
| 48 | * |
||
| 49 | * @return mixed |
||
| 50 | * @see \Codeception\Module\WebDriver::amOnSubdomain() |
||
| 51 | */ |
||
| 52 | public function amOnSubdomain($subdomain) { |
||
| 55 | |||
| 56 | |||
| 57 | /** |
||
| 58 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 59 | * |
||
| 60 | * Takes a screenshot of the current window and saves it to `tests/_output/debug`. |
||
| 61 | * |
||
| 62 | * ``` php |
||
| 63 | * <?php |
||
| 64 | * $I->amOnPage('/user/edit'); |
||
| 65 | * $I->makeScreenshot('edit_page'); |
||
| 66 | * // saved to: tests/_output/debug/edit_page.png |
||
| 67 | * $I->makeScreenshot(); |
||
| 68 | * // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png |
||
| 69 | * ``` |
||
| 70 | * |
||
| 71 | * @param $name |
||
| 72 | * @see \Codeception\Module\WebDriver::makeScreenshot() |
||
| 73 | */ |
||
| 74 | public function makeScreenshot($name = null) { |
||
| 77 | |||
| 78 | |||
| 79 | /** |
||
| 80 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 81 | * |
||
| 82 | * Resize the current window. |
||
| 83 | * |
||
| 84 | * ``` php |
||
| 85 | * <?php |
||
| 86 | * $I->resizeWindow(800, 600); |
||
| 87 | * |
||
| 88 | * ``` |
||
| 89 | * |
||
| 90 | * @param int $width |
||
| 91 | * @param int $height |
||
| 92 | * @see \Codeception\Module\WebDriver::resizeWindow() |
||
| 93 | */ |
||
| 94 | public function resizeWindow($width, $height) { |
||
| 97 | |||
| 98 | |||
| 99 | /** |
||
| 100 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 101 | * |
||
| 102 | * Checks that a cookie with the given name is set. |
||
| 103 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 104 | * |
||
| 105 | * ``` php |
||
| 106 | * <?php |
||
| 107 | * $I->seeCookie('PHPSESSID'); |
||
| 108 | * ?> |
||
| 109 | * ``` |
||
| 110 | * |
||
| 111 | * @param $cookie |
||
| 112 | * @param array $params |
||
| 113 | * @return mixed |
||
| 114 | * Conditional Assertion: Test won't be stopped on fail |
||
| 115 | * @see \Codeception\Module\WebDriver::seeCookie() |
||
| 116 | */ |
||
| 117 | public function canSeeCookie($cookie, $params = null) { |
||
| 120 | /** |
||
| 121 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 122 | * |
||
| 123 | * Checks that a cookie with the given name is set. |
||
| 124 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 125 | * |
||
| 126 | * ``` php |
||
| 127 | * <?php |
||
| 128 | * $I->seeCookie('PHPSESSID'); |
||
| 129 | * ?> |
||
| 130 | * ``` |
||
| 131 | * |
||
| 132 | * @param $cookie |
||
| 133 | * @param array $params |
||
| 134 | * @return mixed |
||
| 135 | * @see \Codeception\Module\WebDriver::seeCookie() |
||
| 136 | */ |
||
| 137 | public function seeCookie($cookie, $params = null) { |
||
| 140 | |||
| 141 | |||
| 142 | /** |
||
| 143 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 144 | * |
||
| 145 | * Checks that there isn't a cookie with the given name. |
||
| 146 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 147 | * |
||
| 148 | * @param $cookie |
||
| 149 | * |
||
| 150 | * @param array $params |
||
| 151 | * @return mixed |
||
| 152 | * Conditional Assertion: Test won't be stopped on fail |
||
| 153 | * @see \Codeception\Module\WebDriver::dontSeeCookie() |
||
| 154 | */ |
||
| 155 | public function cantSeeCookie($cookie, $params = null) { |
||
| 158 | /** |
||
| 159 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 160 | * |
||
| 161 | * Checks that there isn't a cookie with the given name. |
||
| 162 | * You can set additional cookie params like `domain`, `path` as array passed in last argument. |
||
| 163 | * |
||
| 164 | * @param $cookie |
||
| 165 | * |
||
| 166 | * @param array $params |
||
| 167 | * @return mixed |
||
| 168 | * @see \Codeception\Module\WebDriver::dontSeeCookie() |
||
| 169 | */ |
||
| 170 | public function dontSeeCookie($cookie, $params = null) { |
||
| 173 | |||
| 174 | |||
| 175 | /** |
||
| 176 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 177 | * |
||
| 178 | * Sets a cookie with the given name and value. |
||
| 179 | * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument. |
||
| 180 | * |
||
| 181 | * ``` php |
||
| 182 | * <?php |
||
| 183 | * $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); |
||
| 184 | * ?> |
||
| 185 | * ``` |
||
| 186 | * |
||
| 187 | * @param $name |
||
| 188 | * @param $val |
||
| 189 | * @param array $params |
||
| 190 | * |
||
| 191 | * @return mixed |
||
| 192 | * @see \Codeception\Module\WebDriver::setCookie() |
||
| 193 | */ |
||
| 194 | public function setCookie($cookie, $value, $params = null) { |
||
| 197 | |||
| 198 | |||
| 199 | /** |
||
| 200 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 201 | * |
||
| 202 | * Unsets cookie with the given name. |
||
| 203 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
| 204 | * |
||
| 205 | * @param $cookie |
||
| 206 | * |
||
| 207 | * @param array $params |
||
| 208 | * @return mixed |
||
| 209 | * @see \Codeception\Module\WebDriver::resetCookie() |
||
| 210 | */ |
||
| 211 | public function resetCookie($cookie, $params = null) { |
||
| 214 | |||
| 215 | |||
| 216 | /** |
||
| 217 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 218 | * |
||
| 219 | * Grabs a cookie value. |
||
| 220 | * You can set additional cookie params like `domain`, `path` in array passed as last argument. |
||
| 221 | * |
||
| 222 | * @param $cookie |
||
| 223 | * |
||
| 224 | * @param array $params |
||
| 225 | * @return mixed |
||
| 226 | * @see \Codeception\Module\WebDriver::grabCookie() |
||
| 227 | */ |
||
| 228 | public function grabCookie($cookie, $params = null) { |
||
| 231 | |||
| 232 | |||
| 233 | /** |
||
| 234 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 235 | * |
||
| 236 | * Grabs current page source code. |
||
| 237 | * |
||
| 238 | * @throws ModuleException if no page was opened. |
||
| 239 | * |
||
| 240 | * @return string Current page source code. |
||
| 241 | * @see \Codeception\Module\WebDriver::grabPageSource() |
||
| 242 | */ |
||
| 243 | public function grabPageSource() { |
||
| 246 | |||
| 247 | |||
| 248 | /** |
||
| 249 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 250 | * |
||
| 251 | * Open web page at the given absolute URL and sets its hostname as the base host. |
||
| 252 | * |
||
| 253 | * ``` php |
||
| 254 | * <?php |
||
| 255 | * $I->amOnUrl('http://codeception.com'); |
||
| 256 | * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart |
||
| 257 | * ?> |
||
| 258 | * ``` |
||
| 259 | * @see \Codeception\Module\WebDriver::amOnUrl() |
||
| 260 | */ |
||
| 261 | public function amOnUrl($url) { |
||
| 264 | |||
| 265 | |||
| 266 | /** |
||
| 267 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 268 | * |
||
| 269 | * Opens the page for the given relative URI. |
||
| 270 | * |
||
| 271 | * ``` php |
||
| 272 | * <?php |
||
| 273 | * // opens front page |
||
| 274 | * $I->amOnPage('/'); |
||
| 275 | * // opens /register page |
||
| 276 | * $I->amOnPage('/register'); |
||
| 277 | * ``` |
||
| 278 | * |
||
| 279 | * @param string $page |
||
| 280 | * @see \Codeception\Module\WebDriver::amOnPage() |
||
| 281 | */ |
||
| 282 | public function amOnPage($page) { |
||
| 285 | |||
| 286 | |||
| 287 | /** |
||
| 288 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 289 | * |
||
| 290 | * Checks that the current page contains the given string (case insensitive). |
||
| 291 | * |
||
| 292 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
| 293 | * parameter to only search within that element. |
||
| 294 | * |
||
| 295 | * ``` php |
||
| 296 | * <?php |
||
| 297 | * $I->see('Logout'); // I can suppose user is logged in |
||
| 298 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
| 299 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
| 300 | * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
| 301 | * ``` |
||
| 302 | * |
||
| 303 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 304 | * so `$I->see('strong')` will return true for strings like: |
||
| 305 | * |
||
| 306 | * - `<p>I am Stronger than thou</p>` |
||
| 307 | * - `<script>document.createElement('strong');</script>` |
||
| 308 | * |
||
| 309 | * But will *not* be true for strings like: |
||
| 310 | * |
||
| 311 | * - `<strong>Home</strong>` |
||
| 312 | * - `<div class="strong">Home</strong>` |
||
| 313 | * - `<!-- strong -->` |
||
| 314 | * |
||
| 315 | * For checking the raw source code, use `seeInSource()`. |
||
| 316 | * |
||
| 317 | * @param string $text |
||
| 318 | * @param string $selector optional |
||
| 319 | * Conditional Assertion: Test won't be stopped on fail |
||
| 320 | * @see \Codeception\Module\WebDriver::see() |
||
| 321 | */ |
||
| 322 | public function canSee($text, $selector = null) { |
||
| 325 | /** |
||
| 326 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 327 | * |
||
| 328 | * Checks that the current page contains the given string (case insensitive). |
||
| 329 | * |
||
| 330 | * You can specify a specific HTML element (via CSS or XPath) as the second |
||
| 331 | * parameter to only search within that element. |
||
| 332 | * |
||
| 333 | * ``` php |
||
| 334 | * <?php |
||
| 335 | * $I->see('Logout'); // I can suppose user is logged in |
||
| 336 | * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page |
||
| 337 | * $I->see('Sign Up', '//body/h1'); // with XPath |
||
| 338 | * $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
| 339 | * ``` |
||
| 340 | * |
||
| 341 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 342 | * so `$I->see('strong')` will return true for strings like: |
||
| 343 | * |
||
| 344 | * - `<p>I am Stronger than thou</p>` |
||
| 345 | * - `<script>document.createElement('strong');</script>` |
||
| 346 | * |
||
| 347 | * But will *not* be true for strings like: |
||
| 348 | * |
||
| 349 | * - `<strong>Home</strong>` |
||
| 350 | * - `<div class="strong">Home</strong>` |
||
| 351 | * - `<!-- strong -->` |
||
| 352 | * |
||
| 353 | * For checking the raw source code, use `seeInSource()`. |
||
| 354 | * |
||
| 355 | * @param string $text |
||
| 356 | * @param string $selector optional |
||
| 357 | * @see \Codeception\Module\WebDriver::see() |
||
| 358 | */ |
||
| 359 | public function see($text, $selector = null) { |
||
| 362 | |||
| 363 | |||
| 364 | /** |
||
| 365 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 366 | * |
||
| 367 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
| 368 | * Give a locator as the second parameter to match a specific region. |
||
| 369 | * |
||
| 370 | * ```php |
||
| 371 | * <?php |
||
| 372 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
| 373 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
| 374 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
| 375 | * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
| 376 | * ``` |
||
| 377 | * |
||
| 378 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 379 | * so `$I->dontSee('strong')` will fail on strings like: |
||
| 380 | * |
||
| 381 | * - `<p>I am Stronger than thou</p>` |
||
| 382 | * - `<script>document.createElement('strong');</script>` |
||
| 383 | * |
||
| 384 | * But will ignore strings like: |
||
| 385 | * |
||
| 386 | * - `<strong>Home</strong>` |
||
| 387 | * - `<div class="strong">Home</strong>` |
||
| 388 | * - `<!-- strong -->` |
||
| 389 | * |
||
| 390 | * For checking the raw source code, use `seeInSource()`. |
||
| 391 | * |
||
| 392 | * @param string $text |
||
| 393 | * @param string $selector optional |
||
| 394 | * Conditional Assertion: Test won't be stopped on fail |
||
| 395 | * @see \Codeception\Module\WebDriver::dontSee() |
||
| 396 | */ |
||
| 397 | public function cantSee($text, $selector = null) { |
||
| 400 | /** |
||
| 401 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 402 | * |
||
| 403 | * Checks that the current page doesn't contain the text specified (case insensitive). |
||
| 404 | * Give a locator as the second parameter to match a specific region. |
||
| 405 | * |
||
| 406 | * ```php |
||
| 407 | * <?php |
||
| 408 | * $I->dontSee('Login'); // I can suppose user is already logged in |
||
| 409 | * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page |
||
| 410 | * $I->dontSee('Sign Up','//body/h1'); // with XPath |
||
| 411 | * $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator |
||
| 412 | * ``` |
||
| 413 | * |
||
| 414 | * Note that the search is done after stripping all HTML tags from the body, |
||
| 415 | * so `$I->dontSee('strong')` will fail on strings like: |
||
| 416 | * |
||
| 417 | * - `<p>I am Stronger than thou</p>` |
||
| 418 | * - `<script>document.createElement('strong');</script>` |
||
| 419 | * |
||
| 420 | * But will ignore strings like: |
||
| 421 | * |
||
| 422 | * - `<strong>Home</strong>` |
||
| 423 | * - `<div class="strong">Home</strong>` |
||
| 424 | * - `<!-- strong -->` |
||
| 425 | * |
||
| 426 | * For checking the raw source code, use `seeInSource()`. |
||
| 427 | * |
||
| 428 | * @param string $text |
||
| 429 | * @param string $selector optional |
||
| 430 | * @see \Codeception\Module\WebDriver::dontSee() |
||
| 431 | */ |
||
| 432 | public function dontSee($text, $selector = null) { |
||
| 435 | |||
| 436 | |||
| 437 | /** |
||
| 438 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 439 | * |
||
| 440 | * Checks that the current page contains the given string in its |
||
| 441 | * raw source code. |
||
| 442 | * |
||
| 443 | * ``` php |
||
| 444 | * <?php |
||
| 445 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
| 446 | * ``` |
||
| 447 | * |
||
| 448 | * @param $raw |
||
| 449 | * Conditional Assertion: Test won't be stopped on fail |
||
| 450 | * @see \Codeception\Module\WebDriver::seeInSource() |
||
| 451 | */ |
||
| 452 | public function canSeeInSource($raw) { |
||
| 455 | /** |
||
| 456 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 457 | * |
||
| 458 | * Checks that the current page contains the given string in its |
||
| 459 | * raw source code. |
||
| 460 | * |
||
| 461 | * ``` php |
||
| 462 | * <?php |
||
| 463 | * $I->seeInSource('<h1>Green eggs & ham</h1>'); |
||
| 464 | * ``` |
||
| 465 | * |
||
| 466 | * @param $raw |
||
| 467 | * @see \Codeception\Module\WebDriver::seeInSource() |
||
| 468 | */ |
||
| 469 | public function seeInSource($raw) { |
||
| 472 | |||
| 473 | |||
| 474 | /** |
||
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 476 | * |
||
| 477 | * Checks that the current page contains the given string in its |
||
| 478 | * raw source code. |
||
| 479 | * |
||
| 480 | * ```php |
||
| 481 | * <?php |
||
| 482 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
| 483 | * ``` |
||
| 484 | * |
||
| 485 | * @param $raw |
||
| 486 | * Conditional Assertion: Test won't be stopped on fail |
||
| 487 | * @see \Codeception\Module\WebDriver::dontSeeInSource() |
||
| 488 | */ |
||
| 489 | public function cantSeeInSource($raw) { |
||
| 492 | /** |
||
| 493 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 494 | * |
||
| 495 | * Checks that the current page contains the given string in its |
||
| 496 | * raw source code. |
||
| 497 | * |
||
| 498 | * ```php |
||
| 499 | * <?php |
||
| 500 | * $I->dontSeeInSource('<h1>Green eggs & ham</h1>'); |
||
| 501 | * ``` |
||
| 502 | * |
||
| 503 | * @param $raw |
||
| 504 | * @see \Codeception\Module\WebDriver::dontSeeInSource() |
||
| 505 | */ |
||
| 506 | public function dontSeeInSource($raw) { |
||
| 509 | |||
| 510 | |||
| 511 | /** |
||
| 512 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 513 | * |
||
| 514 | * Checks that the page source contains the given string. |
||
| 515 | * |
||
| 516 | * ```php |
||
| 517 | * <?php |
||
| 518 | * $I->seeInPageSource('<link rel="apple-touch-icon"'); |
||
| 519 | * ``` |
||
| 520 | * |
||
| 521 | * @param $text |
||
| 522 | * Conditional Assertion: Test won't be stopped on fail |
||
| 523 | * @see \Codeception\Module\WebDriver::seeInPageSource() |
||
| 524 | */ |
||
| 525 | public function canSeeInPageSource($text) { |
||
| 528 | /** |
||
| 529 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 530 | * |
||
| 531 | * Checks that the page source contains the given string. |
||
| 532 | * |
||
| 533 | * ```php |
||
| 534 | * <?php |
||
| 535 | * $I->seeInPageSource('<link rel="apple-touch-icon"'); |
||
| 536 | * ``` |
||
| 537 | * |
||
| 538 | * @param $text |
||
| 539 | * @see \Codeception\Module\WebDriver::seeInPageSource() |
||
| 540 | */ |
||
| 541 | public function seeInPageSource($text) { |
||
| 544 | |||
| 545 | |||
| 546 | /** |
||
| 547 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 548 | * |
||
| 549 | * Checks that the page source doesn't contain the given string. |
||
| 550 | * |
||
| 551 | * @param $text |
||
| 552 | * Conditional Assertion: Test won't be stopped on fail |
||
| 553 | * @see \Codeception\Module\WebDriver::dontSeeInPageSource() |
||
| 554 | */ |
||
| 555 | public function cantSeeInPageSource($text) { |
||
| 558 | /** |
||
| 559 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 560 | * |
||
| 561 | * Checks that the page source doesn't contain the given string. |
||
| 562 | * |
||
| 563 | * @param $text |
||
| 564 | * @see \Codeception\Module\WebDriver::dontSeeInPageSource() |
||
| 565 | */ |
||
| 566 | public function dontSeeInPageSource($text) { |
||
| 569 | |||
| 570 | |||
| 571 | /** |
||
| 572 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 573 | * |
||
| 574 | * Perform a click on a link or a button, given by a locator. |
||
| 575 | * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. |
||
| 576 | * For buttons, the "value" attribute, "name" attribute, and inner text are searched. |
||
| 577 | * For links, the link text is searched. |
||
| 578 | * For images, the "alt" attribute and inner text of any parent links are searched. |
||
| 579 | * |
||
| 580 | * The second parameter is a context (CSS or XPath locator) to narrow the search. |
||
| 581 | * |
||
| 582 | * Note that if the locator matches a button of type `submit`, the form will be submitted. |
||
| 583 | * |
||
| 584 | * ``` php |
||
| 585 | * <?php |
||
| 586 | * // simple link |
||
| 587 | * $I->click('Logout'); |
||
| 588 | * // button of form |
||
| 589 | * $I->click('Submit'); |
||
| 590 | * // CSS button |
||
| 591 | * $I->click('#form input[type=submit]'); |
||
| 592 | * // XPath |
||
| 593 | * $I->click('//form/*[@type=submit]'); |
||
| 594 | * // link in context |
||
| 595 | * $I->click('Logout', '#nav'); |
||
| 596 | * // using strict locator |
||
| 597 | * $I->click(['link' => 'Login']); |
||
| 598 | * ?> |
||
| 599 | * ``` |
||
| 600 | * |
||
| 601 | * @param $link |
||
| 602 | * @param $context |
||
| 603 | * @see \Codeception\Module\WebDriver::click() |
||
| 604 | */ |
||
| 605 | public function click($link, $context = null) { |
||
| 608 | |||
| 609 | |||
| 610 | /** |
||
| 611 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 612 | * |
||
| 613 | * Checks that there's a link with the specified text. |
||
| 614 | * Give a full URL as the second parameter to match links with that exact URL. |
||
| 615 | * |
||
| 616 | * ``` php |
||
| 617 | * <?php |
||
| 618 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
| 619 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
| 620 | * ?> |
||
| 621 | * ``` |
||
| 622 | * |
||
| 623 | * @param string $text |
||
| 624 | * @param string $url optional |
||
| 625 | * Conditional Assertion: Test won't be stopped on fail |
||
| 626 | * @see \Codeception\Module\WebDriver::seeLink() |
||
| 627 | */ |
||
| 628 | public function canSeeLink($text, $url = null) { |
||
| 631 | /** |
||
| 632 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 633 | * |
||
| 634 | * Checks that there's a link with the specified text. |
||
| 635 | * Give a full URL as the second parameter to match links with that exact URL. |
||
| 636 | * |
||
| 637 | * ``` php |
||
| 638 | * <?php |
||
| 639 | * $I->seeLink('Logout'); // matches <a href="#">Logout</a> |
||
| 640 | * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a> |
||
| 641 | * ?> |
||
| 642 | * ``` |
||
| 643 | * |
||
| 644 | * @param string $text |
||
| 645 | * @param string $url optional |
||
| 646 | * @see \Codeception\Module\WebDriver::seeLink() |
||
| 647 | */ |
||
| 648 | public function seeLink($text, $url = null) { |
||
| 651 | |||
| 652 | |||
| 653 | /** |
||
| 654 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 655 | * |
||
| 656 | * Checks that the page doesn't contain a link with the given string. |
||
| 657 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
| 658 | * |
||
| 659 | * ``` php |
||
| 660 | * <?php |
||
| 661 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
| 662 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
| 663 | * ?> |
||
| 664 | * ``` |
||
| 665 | * |
||
| 666 | * @param string $text |
||
| 667 | * @param string $url optional |
||
| 668 | * Conditional Assertion: Test won't be stopped on fail |
||
| 669 | * @see \Codeception\Module\WebDriver::dontSeeLink() |
||
| 670 | */ |
||
| 671 | public function cantSeeLink($text, $url = null) { |
||
| 674 | /** |
||
| 675 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 676 | * |
||
| 677 | * Checks that the page doesn't contain a link with the given string. |
||
| 678 | * If the second parameter is given, only links with a matching "href" attribute will be checked. |
||
| 679 | * |
||
| 680 | * ``` php |
||
| 681 | * <?php |
||
| 682 | * $I->dontSeeLink('Logout'); // I suppose user is not logged in |
||
| 683 | * $I->dontSeeLink('Checkout now', '/store/cart.php'); |
||
| 684 | * ?> |
||
| 685 | * ``` |
||
| 686 | * |
||
| 687 | * @param string $text |
||
| 688 | * @param string $url optional |
||
| 689 | * @see \Codeception\Module\WebDriver::dontSeeLink() |
||
| 690 | */ |
||
| 691 | public function dontSeeLink($text, $url = null) { |
||
| 694 | |||
| 695 | |||
| 696 | /** |
||
| 697 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 698 | * |
||
| 699 | * Checks that current URI contains the given string. |
||
| 700 | * |
||
| 701 | * ``` php |
||
| 702 | * <?php |
||
| 703 | * // to match: /home/dashboard |
||
| 704 | * $I->seeInCurrentUrl('home'); |
||
| 705 | * // to match: /users/1 |
||
| 706 | * $I->seeInCurrentUrl('/users/'); |
||
| 707 | * ?> |
||
| 708 | * ``` |
||
| 709 | * |
||
| 710 | * @param string $uri |
||
| 711 | * Conditional Assertion: Test won't be stopped on fail |
||
| 712 | * @see \Codeception\Module\WebDriver::seeInCurrentUrl() |
||
| 713 | */ |
||
| 714 | public function canSeeInCurrentUrl($uri) { |
||
| 717 | /** |
||
| 718 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 719 | * |
||
| 720 | * Checks that current URI contains the given string. |
||
| 721 | * |
||
| 722 | * ``` php |
||
| 723 | * <?php |
||
| 724 | * // to match: /home/dashboard |
||
| 725 | * $I->seeInCurrentUrl('home'); |
||
| 726 | * // to match: /users/1 |
||
| 727 | * $I->seeInCurrentUrl('/users/'); |
||
| 728 | * ?> |
||
| 729 | * ``` |
||
| 730 | * |
||
| 731 | * @param string $uri |
||
| 732 | * @see \Codeception\Module\WebDriver::seeInCurrentUrl() |
||
| 733 | */ |
||
| 734 | public function seeInCurrentUrl($uri) { |
||
| 737 | |||
| 738 | |||
| 739 | /** |
||
| 740 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 741 | * |
||
| 742 | * Checks that the current URL is equal to the given string. |
||
| 743 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
| 744 | * |
||
| 745 | * ``` php |
||
| 746 | * <?php |
||
| 747 | * // to match root url |
||
| 748 | * $I->seeCurrentUrlEquals('/'); |
||
| 749 | * ?> |
||
| 750 | * ``` |
||
| 751 | * |
||
| 752 | * @param string $uri |
||
| 753 | * Conditional Assertion: Test won't be stopped on fail |
||
| 754 | * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() |
||
| 755 | */ |
||
| 756 | public function canSeeCurrentUrlEquals($uri) { |
||
| 759 | /** |
||
| 760 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 761 | * |
||
| 762 | * Checks that the current URL is equal to the given string. |
||
| 763 | * Unlike `seeInCurrentUrl`, this only matches the full URL. |
||
| 764 | * |
||
| 765 | * ``` php |
||
| 766 | * <?php |
||
| 767 | * // to match root url |
||
| 768 | * $I->seeCurrentUrlEquals('/'); |
||
| 769 | * ?> |
||
| 770 | * ``` |
||
| 771 | * |
||
| 772 | * @param string $uri |
||
| 773 | * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals() |
||
| 774 | */ |
||
| 775 | public function seeCurrentUrlEquals($uri) { |
||
| 778 | |||
| 779 | |||
| 780 | /** |
||
| 781 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 782 | * |
||
| 783 | * Checks that the current URL matches the given regular expression. |
||
| 784 | * |
||
| 785 | * ``` php |
||
| 786 | * <?php |
||
| 787 | * // to match root url |
||
| 788 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 789 | * ?> |
||
| 790 | * ``` |
||
| 791 | * |
||
| 792 | * @param string $uri |
||
| 793 | * Conditional Assertion: Test won't be stopped on fail |
||
| 794 | * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() |
||
| 795 | */ |
||
| 796 | public function canSeeCurrentUrlMatches($uri) { |
||
| 799 | /** |
||
| 800 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 801 | * |
||
| 802 | * Checks that the current URL matches the given regular expression. |
||
| 803 | * |
||
| 804 | * ``` php |
||
| 805 | * <?php |
||
| 806 | * // to match root url |
||
| 807 | * $I->seeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 808 | * ?> |
||
| 809 | * ``` |
||
| 810 | * |
||
| 811 | * @param string $uri |
||
| 812 | * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches() |
||
| 813 | */ |
||
| 814 | public function seeCurrentUrlMatches($uri) { |
||
| 817 | |||
| 818 | |||
| 819 | /** |
||
| 820 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 821 | * |
||
| 822 | * Checks that the current URI doesn't contain the given string. |
||
| 823 | * |
||
| 824 | * ``` php |
||
| 825 | * <?php |
||
| 826 | * $I->dontSeeInCurrentUrl('/users/'); |
||
| 827 | * ?> |
||
| 828 | * ``` |
||
| 829 | * |
||
| 830 | * @param string $uri |
||
| 831 | * Conditional Assertion: Test won't be stopped on fail |
||
| 832 | * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() |
||
| 833 | */ |
||
| 834 | public function cantSeeInCurrentUrl($uri) { |
||
| 837 | /** |
||
| 838 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 839 | * |
||
| 840 | * Checks that the current URI doesn't contain the given string. |
||
| 841 | * |
||
| 842 | * ``` php |
||
| 843 | * <?php |
||
| 844 | * $I->dontSeeInCurrentUrl('/users/'); |
||
| 845 | * ?> |
||
| 846 | * ``` |
||
| 847 | * |
||
| 848 | * @param string $uri |
||
| 849 | * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl() |
||
| 850 | */ |
||
| 851 | public function dontSeeInCurrentUrl($uri) { |
||
| 854 | |||
| 855 | |||
| 856 | /** |
||
| 857 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 858 | * |
||
| 859 | * Checks that the current URL doesn't equal the given string. |
||
| 860 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
| 861 | * |
||
| 862 | * ``` php |
||
| 863 | * <?php |
||
| 864 | * // current url is not root |
||
| 865 | * $I->dontSeeCurrentUrlEquals('/'); |
||
| 866 | * ?> |
||
| 867 | * ``` |
||
| 868 | * |
||
| 869 | * @param string $uri |
||
| 870 | * Conditional Assertion: Test won't be stopped on fail |
||
| 871 | * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() |
||
| 872 | */ |
||
| 873 | public function cantSeeCurrentUrlEquals($uri) { |
||
| 876 | /** |
||
| 877 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 878 | * |
||
| 879 | * Checks that the current URL doesn't equal the given string. |
||
| 880 | * Unlike `dontSeeInCurrentUrl`, this only matches the full URL. |
||
| 881 | * |
||
| 882 | * ``` php |
||
| 883 | * <?php |
||
| 884 | * // current url is not root |
||
| 885 | * $I->dontSeeCurrentUrlEquals('/'); |
||
| 886 | * ?> |
||
| 887 | * ``` |
||
| 888 | * |
||
| 889 | * @param string $uri |
||
| 890 | * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals() |
||
| 891 | */ |
||
| 892 | public function dontSeeCurrentUrlEquals($uri) { |
||
| 895 | |||
| 896 | |||
| 897 | /** |
||
| 898 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 899 | * |
||
| 900 | * Checks that current url doesn't match the given regular expression. |
||
| 901 | * |
||
| 902 | * ``` php |
||
| 903 | * <?php |
||
| 904 | * // to match root url |
||
| 905 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 906 | * ?> |
||
| 907 | * ``` |
||
| 908 | * |
||
| 909 | * @param string $uri |
||
| 910 | * Conditional Assertion: Test won't be stopped on fail |
||
| 911 | * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() |
||
| 912 | */ |
||
| 913 | public function cantSeeCurrentUrlMatches($uri) { |
||
| 916 | /** |
||
| 917 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 918 | * |
||
| 919 | * Checks that current url doesn't match the given regular expression. |
||
| 920 | * |
||
| 921 | * ``` php |
||
| 922 | * <?php |
||
| 923 | * // to match root url |
||
| 924 | * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~'); |
||
| 925 | * ?> |
||
| 926 | * ``` |
||
| 927 | * |
||
| 928 | * @param string $uri |
||
| 929 | * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches() |
||
| 930 | */ |
||
| 931 | public function dontSeeCurrentUrlMatches($uri) { |
||
| 934 | |||
| 935 | |||
| 936 | /** |
||
| 937 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 938 | * |
||
| 939 | * Executes the given regular expression against the current URI and returns the first capturing group. |
||
| 940 | * If no parameters are provided, the full URI is returned. |
||
| 941 | * |
||
| 942 | * ``` php |
||
| 943 | * <?php |
||
| 944 | * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~'); |
||
| 945 | * $uri = $I->grabFromCurrentUrl(); |
||
| 946 | * ?> |
||
| 947 | * ``` |
||
| 948 | * |
||
| 949 | * @param string $uri optional |
||
| 950 | * |
||
| 951 | * @return mixed |
||
| 952 | * @see \Codeception\Module\WebDriver::grabFromCurrentUrl() |
||
| 953 | */ |
||
| 954 | public function grabFromCurrentUrl($uri = null) { |
||
| 957 | |||
| 958 | |||
| 959 | /** |
||
| 960 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 961 | * |
||
| 962 | * Checks that the specified checkbox is checked. |
||
| 963 | * |
||
| 964 | * ``` php |
||
| 965 | * <?php |
||
| 966 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
| 967 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
| 968 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
| 969 | * ?> |
||
| 970 | * ``` |
||
| 971 | * |
||
| 972 | * @param $checkbox |
||
| 973 | * Conditional Assertion: Test won't be stopped on fail |
||
| 974 | * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() |
||
| 975 | */ |
||
| 976 | public function canSeeCheckboxIsChecked($checkbox) { |
||
| 979 | /** |
||
| 980 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 981 | * |
||
| 982 | * Checks that the specified checkbox is checked. |
||
| 983 | * |
||
| 984 | * ``` php |
||
| 985 | * <?php |
||
| 986 | * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms |
||
| 987 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. |
||
| 988 | * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); |
||
| 989 | * ?> |
||
| 990 | * ``` |
||
| 991 | * |
||
| 992 | * @param $checkbox |
||
| 993 | * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked() |
||
| 994 | */ |
||
| 995 | public function seeCheckboxIsChecked($checkbox) { |
||
| 998 | |||
| 999 | |||
| 1000 | /** |
||
| 1001 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1002 | * |
||
| 1003 | * Check that the specified checkbox is unchecked. |
||
| 1004 | * |
||
| 1005 | * ``` php |
||
| 1006 | * <?php |
||
| 1007 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
| 1008 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
| 1009 | * ?> |
||
| 1010 | * ``` |
||
| 1011 | * |
||
| 1012 | * @param $checkbox |
||
| 1013 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1014 | * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() |
||
| 1015 | */ |
||
| 1016 | public function cantSeeCheckboxIsChecked($checkbox) { |
||
| 1019 | /** |
||
| 1020 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1021 | * |
||
| 1022 | * Check that the specified checkbox is unchecked. |
||
| 1023 | * |
||
| 1024 | * ``` php |
||
| 1025 | * <?php |
||
| 1026 | * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms |
||
| 1027 | * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. |
||
| 1028 | * ?> |
||
| 1029 | * ``` |
||
| 1030 | * |
||
| 1031 | * @param $checkbox |
||
| 1032 | * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked() |
||
| 1033 | */ |
||
| 1034 | public function dontSeeCheckboxIsChecked($checkbox) { |
||
| 1037 | |||
| 1038 | |||
| 1039 | /** |
||
| 1040 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1041 | * |
||
| 1042 | * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. |
||
| 1043 | * Fields are matched by label text, the "name" attribute, CSS, or XPath. |
||
| 1044 | * |
||
| 1045 | * ``` php |
||
| 1046 | * <?php |
||
| 1047 | * $I->seeInField('Body','Type your comment here'); |
||
| 1048 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
| 1049 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
| 1050 | * $I->seeInField('#searchform input','Search'); |
||
| 1051 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
| 1052 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
| 1053 | * ?> |
||
| 1054 | * ``` |
||
| 1055 | * |
||
| 1056 | * @param $field |
||
| 1057 | * @param $value |
||
| 1058 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1059 | * @see \Codeception\Module\WebDriver::seeInField() |
||
| 1060 | */ |
||
| 1061 | public function canSeeInField($field, $value) { |
||
| 1064 | /** |
||
| 1065 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1066 | * |
||
| 1067 | * Checks that the given input field or textarea *equals* (i.e. not just contains) the given value. |
||
| 1068 | * Fields are matched by label text, the "name" attribute, CSS, or XPath. |
||
| 1069 | * |
||
| 1070 | * ``` php |
||
| 1071 | * <?php |
||
| 1072 | * $I->seeInField('Body','Type your comment here'); |
||
| 1073 | * $I->seeInField('form textarea[name=body]','Type your comment here'); |
||
| 1074 | * $I->seeInField('form input[type=hidden]','hidden_value'); |
||
| 1075 | * $I->seeInField('#searchform input','Search'); |
||
| 1076 | * $I->seeInField('//form/*[@name=search]','Search'); |
||
| 1077 | * $I->seeInField(['name' => 'search'], 'Search'); |
||
| 1078 | * ?> |
||
| 1079 | * ``` |
||
| 1080 | * |
||
| 1081 | * @param $field |
||
| 1082 | * @param $value |
||
| 1083 | * @see \Codeception\Module\WebDriver::seeInField() |
||
| 1084 | */ |
||
| 1085 | public function seeInField($field, $value) { |
||
| 1088 | |||
| 1089 | |||
| 1090 | /** |
||
| 1091 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1092 | * |
||
| 1093 | * Checks that an input field or textarea doesn't contain the given value. |
||
| 1094 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
| 1095 | * |
||
| 1096 | * ``` php |
||
| 1097 | * <?php |
||
| 1098 | * $I->dontSeeInField('Body','Type your comment here'); |
||
| 1099 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
| 1100 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
| 1101 | * $I->dontSeeInField('#searchform input','Search'); |
||
| 1102 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
| 1103 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
| 1104 | * ?> |
||
| 1105 | * ``` |
||
| 1106 | * |
||
| 1107 | * @param $field |
||
| 1108 | * @param $value |
||
| 1109 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1110 | * @see \Codeception\Module\WebDriver::dontSeeInField() |
||
| 1111 | */ |
||
| 1112 | public function cantSeeInField($field, $value) { |
||
| 1115 | /** |
||
| 1116 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1117 | * |
||
| 1118 | * Checks that an input field or textarea doesn't contain the given value. |
||
| 1119 | * For fuzzy locators, the field is matched by label text, CSS and XPath. |
||
| 1120 | * |
||
| 1121 | * ``` php |
||
| 1122 | * <?php |
||
| 1123 | * $I->dontSeeInField('Body','Type your comment here'); |
||
| 1124 | * $I->dontSeeInField('form textarea[name=body]','Type your comment here'); |
||
| 1125 | * $I->dontSeeInField('form input[type=hidden]','hidden_value'); |
||
| 1126 | * $I->dontSeeInField('#searchform input','Search'); |
||
| 1127 | * $I->dontSeeInField('//form/*[@name=search]','Search'); |
||
| 1128 | * $I->dontSeeInField(['name' => 'search'], 'Search'); |
||
| 1129 | * ?> |
||
| 1130 | * ``` |
||
| 1131 | * |
||
| 1132 | * @param $field |
||
| 1133 | * @param $value |
||
| 1134 | * @see \Codeception\Module\WebDriver::dontSeeInField() |
||
| 1135 | */ |
||
| 1136 | public function dontSeeInField($field, $value) { |
||
| 1139 | |||
| 1140 | |||
| 1141 | /** |
||
| 1142 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1143 | * |
||
| 1144 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
| 1145 | * passed selector. |
||
| 1146 | * |
||
| 1147 | * ``` php |
||
| 1148 | * <?php |
||
| 1149 | * $I->seeInFormFields('form[name=myform]', [ |
||
| 1150 | * 'input1' => 'value', |
||
| 1151 | * 'input2' => 'other value', |
||
| 1152 | * ]); |
||
| 1153 | * ?> |
||
| 1154 | * ``` |
||
| 1155 | * |
||
| 1156 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
| 1157 | * array may be passed: |
||
| 1158 | * |
||
| 1159 | * ``` php |
||
| 1160 | * <?php |
||
| 1161 | * $I->seeInFormFields('.form-class', [ |
||
| 1162 | * 'multiselect' => [ |
||
| 1163 | * 'value1', |
||
| 1164 | * 'value2', |
||
| 1165 | * ], |
||
| 1166 | * 'checkbox[]' => [ |
||
| 1167 | * 'a checked value', |
||
| 1168 | * 'another checked value', |
||
| 1169 | * ], |
||
| 1170 | * ]); |
||
| 1171 | * ?> |
||
| 1172 | * ``` |
||
| 1173 | * |
||
| 1174 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1175 | * |
||
| 1176 | * ``` php |
||
| 1177 | * <?php |
||
| 1178 | * $I->seeInFormFields('#form-id', [ |
||
| 1179 | * 'checkbox1' => true, // passes if checked |
||
| 1180 | * 'checkbox2' => false, // passes if unchecked |
||
| 1181 | * ]); |
||
| 1182 | * ?> |
||
| 1183 | * ``` |
||
| 1184 | * |
||
| 1185 | * Pair this with submitForm for quick testing magic. |
||
| 1186 | * |
||
| 1187 | * ``` php |
||
| 1188 | * <?php |
||
| 1189 | * $form = [ |
||
| 1190 | * 'field1' => 'value', |
||
| 1191 | * 'field2' => 'another value', |
||
| 1192 | * 'checkbox1' => true, |
||
| 1193 | * // ... |
||
| 1194 | * ]; |
||
| 1195 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 1196 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1197 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 1198 | * ?> |
||
| 1199 | * ``` |
||
| 1200 | * |
||
| 1201 | * @param $formSelector |
||
| 1202 | * @param $params |
||
| 1203 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1204 | * @see \Codeception\Module\WebDriver::seeInFormFields() |
||
| 1205 | */ |
||
| 1206 | public function canSeeInFormFields($formSelector, $params) { |
||
| 1209 | /** |
||
| 1210 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1211 | * |
||
| 1212 | * Checks if the array of form parameters (name => value) are set on the form matched with the |
||
| 1213 | * passed selector. |
||
| 1214 | * |
||
| 1215 | * ``` php |
||
| 1216 | * <?php |
||
| 1217 | * $I->seeInFormFields('form[name=myform]', [ |
||
| 1218 | * 'input1' => 'value', |
||
| 1219 | * 'input2' => 'other value', |
||
| 1220 | * ]); |
||
| 1221 | * ?> |
||
| 1222 | * ``` |
||
| 1223 | * |
||
| 1224 | * For multi-select elements, or to check values of multiple elements with the same name, an |
||
| 1225 | * array may be passed: |
||
| 1226 | * |
||
| 1227 | * ``` php |
||
| 1228 | * <?php |
||
| 1229 | * $I->seeInFormFields('.form-class', [ |
||
| 1230 | * 'multiselect' => [ |
||
| 1231 | * 'value1', |
||
| 1232 | * 'value2', |
||
| 1233 | * ], |
||
| 1234 | * 'checkbox[]' => [ |
||
| 1235 | * 'a checked value', |
||
| 1236 | * 'another checked value', |
||
| 1237 | * ], |
||
| 1238 | * ]); |
||
| 1239 | * ?> |
||
| 1240 | * ``` |
||
| 1241 | * |
||
| 1242 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1243 | * |
||
| 1244 | * ``` php |
||
| 1245 | * <?php |
||
| 1246 | * $I->seeInFormFields('#form-id', [ |
||
| 1247 | * 'checkbox1' => true, // passes if checked |
||
| 1248 | * 'checkbox2' => false, // passes if unchecked |
||
| 1249 | * ]); |
||
| 1250 | * ?> |
||
| 1251 | * ``` |
||
| 1252 | * |
||
| 1253 | * Pair this with submitForm for quick testing magic. |
||
| 1254 | * |
||
| 1255 | * ``` php |
||
| 1256 | * <?php |
||
| 1257 | * $form = [ |
||
| 1258 | * 'field1' => 'value', |
||
| 1259 | * 'field2' => 'another value', |
||
| 1260 | * 'checkbox1' => true, |
||
| 1261 | * // ... |
||
| 1262 | * ]; |
||
| 1263 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 1264 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 1265 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 1266 | * ?> |
||
| 1267 | * ``` |
||
| 1268 | * |
||
| 1269 | * @param $formSelector |
||
| 1270 | * @param $params |
||
| 1271 | * @see \Codeception\Module\WebDriver::seeInFormFields() |
||
| 1272 | */ |
||
| 1273 | public function seeInFormFields($formSelector, $params) { |
||
| 1276 | |||
| 1277 | |||
| 1278 | /** |
||
| 1279 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1280 | * |
||
| 1281 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
| 1282 | * the passed selector. |
||
| 1283 | * |
||
| 1284 | * ``` php |
||
| 1285 | * <?php |
||
| 1286 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
| 1287 | * 'input1' => 'non-existent value', |
||
| 1288 | * 'input2' => 'other non-existent value', |
||
| 1289 | * ]); |
||
| 1290 | * ?> |
||
| 1291 | * ``` |
||
| 1292 | * |
||
| 1293 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
| 1294 | * as the value: |
||
| 1295 | * |
||
| 1296 | * ``` php |
||
| 1297 | * <?php |
||
| 1298 | * $I->dontSeeInFormFields('.form-class', [ |
||
| 1299 | * 'fieldName' => [ |
||
| 1300 | * 'This value shouldn\'t be set', |
||
| 1301 | * 'And this value shouldn\'t be set', |
||
| 1302 | * ], |
||
| 1303 | * ]); |
||
| 1304 | * ?> |
||
| 1305 | * ``` |
||
| 1306 | * |
||
| 1307 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1308 | * |
||
| 1309 | * ``` php |
||
| 1310 | * <?php |
||
| 1311 | * $I->dontSeeInFormFields('#form-id', [ |
||
| 1312 | * 'checkbox1' => true, // fails if checked |
||
| 1313 | * 'checkbox2' => false, // fails if unchecked |
||
| 1314 | * ]); |
||
| 1315 | * ?> |
||
| 1316 | * ``` |
||
| 1317 | * |
||
| 1318 | * @param $formSelector |
||
| 1319 | * @param $params |
||
| 1320 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1321 | * @see \Codeception\Module\WebDriver::dontSeeInFormFields() |
||
| 1322 | */ |
||
| 1323 | public function cantSeeInFormFields($formSelector, $params) { |
||
| 1326 | /** |
||
| 1327 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1328 | * |
||
| 1329 | * Checks if the array of form parameters (name => value) are not set on the form matched with |
||
| 1330 | * the passed selector. |
||
| 1331 | * |
||
| 1332 | * ``` php |
||
| 1333 | * <?php |
||
| 1334 | * $I->dontSeeInFormFields('form[name=myform]', [ |
||
| 1335 | * 'input1' => 'non-existent value', |
||
| 1336 | * 'input2' => 'other non-existent value', |
||
| 1337 | * ]); |
||
| 1338 | * ?> |
||
| 1339 | * ``` |
||
| 1340 | * |
||
| 1341 | * To check that an element hasn't been assigned any one of many values, an array can be passed |
||
| 1342 | * as the value: |
||
| 1343 | * |
||
| 1344 | * ``` php |
||
| 1345 | * <?php |
||
| 1346 | * $I->dontSeeInFormFields('.form-class', [ |
||
| 1347 | * 'fieldName' => [ |
||
| 1348 | * 'This value shouldn\'t be set', |
||
| 1349 | * 'And this value shouldn\'t be set', |
||
| 1350 | * ], |
||
| 1351 | * ]); |
||
| 1352 | * ?> |
||
| 1353 | * ``` |
||
| 1354 | * |
||
| 1355 | * Additionally, checkbox values can be checked with a boolean. |
||
| 1356 | * |
||
| 1357 | * ``` php |
||
| 1358 | * <?php |
||
| 1359 | * $I->dontSeeInFormFields('#form-id', [ |
||
| 1360 | * 'checkbox1' => true, // fails if checked |
||
| 1361 | * 'checkbox2' => false, // fails if unchecked |
||
| 1362 | * ]); |
||
| 1363 | * ?> |
||
| 1364 | * ``` |
||
| 1365 | * |
||
| 1366 | * @param $formSelector |
||
| 1367 | * @param $params |
||
| 1368 | * @see \Codeception\Module\WebDriver::dontSeeInFormFields() |
||
| 1369 | */ |
||
| 1370 | public function dontSeeInFormFields($formSelector, $params) { |
||
| 1373 | |||
| 1374 | |||
| 1375 | /** |
||
| 1376 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1377 | * |
||
| 1378 | * Selects an option in a select tag or in radio button group. |
||
| 1379 | * |
||
| 1380 | * ``` php |
||
| 1381 | * <?php |
||
| 1382 | * $I->selectOption('form select[name=account]', 'Premium'); |
||
| 1383 | * $I->selectOption('form input[name=payment]', 'Monthly'); |
||
| 1384 | * $I->selectOption('//form/select[@name=account]', 'Monthly'); |
||
| 1385 | * ?> |
||
| 1386 | * ``` |
||
| 1387 | * |
||
| 1388 | * Provide an array for the second argument to select multiple options: |
||
| 1389 | * |
||
| 1390 | * ``` php |
||
| 1391 | * <?php |
||
| 1392 | * $I->selectOption('Which OS do you use?', array('Windows','Linux')); |
||
| 1393 | * ?> |
||
| 1394 | * ``` |
||
| 1395 | * |
||
| 1396 | * Or provide an associative array for the second argument to specifically define which selection method should be used: |
||
| 1397 | * |
||
| 1398 | * ``` php |
||
| 1399 | * <?php |
||
| 1400 | * $I->selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' |
||
| 1401 | * $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' |
||
| 1402 | * ?> |
||
| 1403 | * ``` |
||
| 1404 | * |
||
| 1405 | * @param $select |
||
| 1406 | * @param $option |
||
| 1407 | * @see \Codeception\Module\WebDriver::selectOption() |
||
| 1408 | */ |
||
| 1409 | public function selectOption($select, $option) { |
||
| 1412 | |||
| 1413 | |||
| 1414 | /** |
||
| 1415 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1416 | * |
||
| 1417 | * Unselect an option in the given select box. |
||
| 1418 | * |
||
| 1419 | * @param $select |
||
| 1420 | * @param $option |
||
| 1421 | * @see \Codeception\Module\WebDriver::unselectOption() |
||
| 1422 | */ |
||
| 1423 | public function unselectOption($select, $option) { |
||
| 1426 | |||
| 1427 | |||
| 1428 | /** |
||
| 1429 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1430 | * |
||
| 1431 | * Ticks a checkbox. For radio buttons, use the `selectOption` method instead. |
||
| 1432 | * |
||
| 1433 | * ``` php |
||
| 1434 | * <?php |
||
| 1435 | * $I->checkOption('#agree'); |
||
| 1436 | * ?> |
||
| 1437 | * ``` |
||
| 1438 | * |
||
| 1439 | * @param $option |
||
| 1440 | * @see \Codeception\Module\WebDriver::checkOption() |
||
| 1441 | */ |
||
| 1442 | public function checkOption($option) { |
||
| 1445 | |||
| 1446 | |||
| 1447 | /** |
||
| 1448 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1449 | * |
||
| 1450 | * Unticks a checkbox. |
||
| 1451 | * |
||
| 1452 | * ``` php |
||
| 1453 | * <?php |
||
| 1454 | * $I->uncheckOption('#notify'); |
||
| 1455 | * ?> |
||
| 1456 | * ``` |
||
| 1457 | * |
||
| 1458 | * @param $option |
||
| 1459 | * @see \Codeception\Module\WebDriver::uncheckOption() |
||
| 1460 | */ |
||
| 1461 | public function uncheckOption($option) { |
||
| 1464 | |||
| 1465 | |||
| 1466 | /** |
||
| 1467 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1468 | * |
||
| 1469 | * Fills a text field or textarea with the given string. |
||
| 1470 | * |
||
| 1471 | * ``` php |
||
| 1472 | * <?php |
||
| 1473 | * $I->fillField("//input[@type='text']", "Hello World!"); |
||
| 1474 | * $I->fillField(['name' => 'email'], '[email protected]'); |
||
| 1475 | * ?> |
||
| 1476 | * ``` |
||
| 1477 | * |
||
| 1478 | * @param $field |
||
| 1479 | * @param $value |
||
| 1480 | * @see \Codeception\Module\WebDriver::fillField() |
||
| 1481 | */ |
||
| 1482 | public function fillField($field, $value) { |
||
| 1485 | |||
| 1486 | |||
| 1487 | /** |
||
| 1488 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1489 | * |
||
| 1490 | * Clears given field which isn't empty. |
||
| 1491 | * |
||
| 1492 | * ``` php |
||
| 1493 | * <?php |
||
| 1494 | * $I->clearField('#username'); |
||
| 1495 | * ``` |
||
| 1496 | * |
||
| 1497 | * @param $field |
||
| 1498 | * @see \Codeception\Module\WebDriver::clearField() |
||
| 1499 | */ |
||
| 1500 | public function clearField($field) { |
||
| 1503 | |||
| 1504 | |||
| 1505 | /** |
||
| 1506 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1507 | * |
||
| 1508 | * Attaches a file relative to the Codeception `_data` directory to the given file upload field. |
||
| 1509 | * |
||
| 1510 | * ``` php |
||
| 1511 | * <?php |
||
| 1512 | * // file is stored in 'tests/_data/prices.xls' |
||
| 1513 | * $I->attachFile('input[@type="file"]', 'prices.xls'); |
||
| 1514 | * ?> |
||
| 1515 | * ``` |
||
| 1516 | * |
||
| 1517 | * @param $field |
||
| 1518 | * @param $filename |
||
| 1519 | * @see \Codeception\Module\WebDriver::attachFile() |
||
| 1520 | */ |
||
| 1521 | public function attachFile($field, $filename) { |
||
| 1524 | |||
| 1525 | |||
| 1526 | /** |
||
| 1527 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1528 | * |
||
| 1529 | * Finds and returns the text contents of the given element. |
||
| 1530 | * If a fuzzy locator is used, the element is found using CSS, XPath, |
||
| 1531 | * and by matching the full page source by regular expression. |
||
| 1532 | * |
||
| 1533 | * ``` php |
||
| 1534 | * <?php |
||
| 1535 | * $heading = $I->grabTextFrom('h1'); |
||
| 1536 | * $heading = $I->grabTextFrom('descendant-or-self::h1'); |
||
| 1537 | * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi'); // match with a regex |
||
| 1538 | * ?> |
||
| 1539 | * ``` |
||
| 1540 | * |
||
| 1541 | * @param $cssOrXPathOrRegex |
||
| 1542 | * |
||
| 1543 | * @return mixed |
||
| 1544 | * @see \Codeception\Module\WebDriver::grabTextFrom() |
||
| 1545 | */ |
||
| 1546 | public function grabTextFrom($cssOrXPathOrRegex) { |
||
| 1549 | |||
| 1550 | |||
| 1551 | /** |
||
| 1552 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1553 | * |
||
| 1554 | * Grabs the value of the given attribute value from the given element. |
||
| 1555 | * Fails if element is not found. |
||
| 1556 | * |
||
| 1557 | * ``` php |
||
| 1558 | * <?php |
||
| 1559 | * $I->grabAttributeFrom('#tooltip', 'title'); |
||
| 1560 | * ?> |
||
| 1561 | * ``` |
||
| 1562 | * |
||
| 1563 | * |
||
| 1564 | * @param $cssOrXpath |
||
| 1565 | * @param $attribute |
||
| 1566 | * |
||
| 1567 | * @return mixed |
||
| 1568 | * @see \Codeception\Module\WebDriver::grabAttributeFrom() |
||
| 1569 | */ |
||
| 1570 | public function grabAttributeFrom($cssOrXpath, $attribute) { |
||
| 1573 | |||
| 1574 | |||
| 1575 | /** |
||
| 1576 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1577 | * |
||
| 1578 | * Finds the value for the given form field. |
||
| 1579 | * If a fuzzy locator is used, the field is found by field name, CSS, and XPath. |
||
| 1580 | * |
||
| 1581 | * ``` php |
||
| 1582 | * <?php |
||
| 1583 | * $name = $I->grabValueFrom('Name'); |
||
| 1584 | * $name = $I->grabValueFrom('input[name=username]'); |
||
| 1585 | * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']'); |
||
| 1586 | * $name = $I->grabValueFrom(['name' => 'username']); |
||
| 1587 | * ?> |
||
| 1588 | * ``` |
||
| 1589 | * |
||
| 1590 | * @param $field |
||
| 1591 | * |
||
| 1592 | * @return mixed |
||
| 1593 | * @see \Codeception\Module\WebDriver::grabValueFrom() |
||
| 1594 | */ |
||
| 1595 | public function grabValueFrom($field) { |
||
| 1598 | |||
| 1599 | |||
| 1600 | /** |
||
| 1601 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1602 | * |
||
| 1603 | * Grabs either the text content, or attribute values, of nodes |
||
| 1604 | * matched by $cssOrXpath and returns them as an array. |
||
| 1605 | * |
||
| 1606 | * ```html |
||
| 1607 | * <a href="#first">First</a> |
||
| 1608 | * <a href="#second">Second</a> |
||
| 1609 | * <a href="#third">Third</a> |
||
| 1610 | * ``` |
||
| 1611 | * |
||
| 1612 | * ```php |
||
| 1613 | * <?php |
||
| 1614 | * // would return ['First', 'Second', 'Third'] |
||
| 1615 | * $aLinkText = $I->grabMultiple('a'); |
||
| 1616 | * |
||
| 1617 | * // would return ['#first', '#second', '#third'] |
||
| 1618 | * $aLinks = $I->grabMultiple('a', 'href'); |
||
| 1619 | * ?> |
||
| 1620 | * ``` |
||
| 1621 | * |
||
| 1622 | * @param $cssOrXpath |
||
| 1623 | * @param $attribute |
||
| 1624 | * @return string[] |
||
| 1625 | * @see \Codeception\Module\WebDriver::grabMultiple() |
||
| 1626 | */ |
||
| 1627 | public function grabMultiple($cssOrXpath, $attribute = null) { |
||
| 1630 | |||
| 1631 | |||
| 1632 | /** |
||
| 1633 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1634 | * |
||
| 1635 | * Checks that the given element exists on the page and is visible. |
||
| 1636 | * You can also specify expected attributes of this element. |
||
| 1637 | * |
||
| 1638 | * ``` php |
||
| 1639 | * <?php |
||
| 1640 | * $I->seeElement('.error'); |
||
| 1641 | * $I->seeElement('//form/input[1]'); |
||
| 1642 | * $I->seeElement('input', ['name' => 'login']); |
||
| 1643 | * $I->seeElement('input', ['value' => '123456']); |
||
| 1644 | * |
||
| 1645 | * // strict locator in first arg, attributes in second |
||
| 1646 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
| 1647 | * ?> |
||
| 1648 | * ``` |
||
| 1649 | * |
||
| 1650 | * @param $selector |
||
| 1651 | * @param array $attributes |
||
| 1652 | * @return |
||
| 1653 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1654 | * @see \Codeception\Module\WebDriver::seeElement() |
||
| 1655 | */ |
||
| 1656 | public function canSeeElement($selector, $attributes = null) { |
||
| 1659 | /** |
||
| 1660 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1661 | * |
||
| 1662 | * Checks that the given element exists on the page and is visible. |
||
| 1663 | * You can also specify expected attributes of this element. |
||
| 1664 | * |
||
| 1665 | * ``` php |
||
| 1666 | * <?php |
||
| 1667 | * $I->seeElement('.error'); |
||
| 1668 | * $I->seeElement('//form/input[1]'); |
||
| 1669 | * $I->seeElement('input', ['name' => 'login']); |
||
| 1670 | * $I->seeElement('input', ['value' => '123456']); |
||
| 1671 | * |
||
| 1672 | * // strict locator in first arg, attributes in second |
||
| 1673 | * $I->seeElement(['css' => 'form input'], ['name' => 'login']); |
||
| 1674 | * ?> |
||
| 1675 | * ``` |
||
| 1676 | * |
||
| 1677 | * @param $selector |
||
| 1678 | * @param array $attributes |
||
| 1679 | * @return |
||
| 1680 | * @see \Codeception\Module\WebDriver::seeElement() |
||
| 1681 | */ |
||
| 1682 | public function seeElement($selector, $attributes = null) { |
||
| 1685 | |||
| 1686 | |||
| 1687 | /** |
||
| 1688 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1689 | * |
||
| 1690 | * Checks that the given element is invisible or not present on the page. |
||
| 1691 | * You can also specify expected attributes of this element. |
||
| 1692 | * |
||
| 1693 | * ``` php |
||
| 1694 | * <?php |
||
| 1695 | * $I->dontSeeElement('.error'); |
||
| 1696 | * $I->dontSeeElement('//form/input[1]'); |
||
| 1697 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
| 1698 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
| 1699 | * ?> |
||
| 1700 | * ``` |
||
| 1701 | * |
||
| 1702 | * @param $selector |
||
| 1703 | * @param array $attributes |
||
| 1704 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1705 | * @see \Codeception\Module\WebDriver::dontSeeElement() |
||
| 1706 | */ |
||
| 1707 | public function cantSeeElement($selector, $attributes = null) { |
||
| 1710 | /** |
||
| 1711 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1712 | * |
||
| 1713 | * Checks that the given element is invisible or not present on the page. |
||
| 1714 | * You can also specify expected attributes of this element. |
||
| 1715 | * |
||
| 1716 | * ``` php |
||
| 1717 | * <?php |
||
| 1718 | * $I->dontSeeElement('.error'); |
||
| 1719 | * $I->dontSeeElement('//form/input[1]'); |
||
| 1720 | * $I->dontSeeElement('input', ['name' => 'login']); |
||
| 1721 | * $I->dontSeeElement('input', ['value' => '123456']); |
||
| 1722 | * ?> |
||
| 1723 | * ``` |
||
| 1724 | * |
||
| 1725 | * @param $selector |
||
| 1726 | * @param array $attributes |
||
| 1727 | * @see \Codeception\Module\WebDriver::dontSeeElement() |
||
| 1728 | */ |
||
| 1729 | public function dontSeeElement($selector, $attributes = null) { |
||
| 1732 | |||
| 1733 | |||
| 1734 | /** |
||
| 1735 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1736 | * |
||
| 1737 | * Checks that the given element exists on the page, even it is invisible. |
||
| 1738 | * |
||
| 1739 | * ``` php |
||
| 1740 | * <?php |
||
| 1741 | * $I->seeElementInDOM('//form/input[type=hidden]'); |
||
| 1742 | * ?> |
||
| 1743 | * ``` |
||
| 1744 | * |
||
| 1745 | * @param $selector |
||
| 1746 | * @param array $attributes |
||
| 1747 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1748 | * @see \Codeception\Module\WebDriver::seeElementInDOM() |
||
| 1749 | */ |
||
| 1750 | public function canSeeElementInDOM($selector, $attributes = null) { |
||
| 1753 | /** |
||
| 1754 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1755 | * |
||
| 1756 | * Checks that the given element exists on the page, even it is invisible. |
||
| 1757 | * |
||
| 1758 | * ``` php |
||
| 1759 | * <?php |
||
| 1760 | * $I->seeElementInDOM('//form/input[type=hidden]'); |
||
| 1761 | * ?> |
||
| 1762 | * ``` |
||
| 1763 | * |
||
| 1764 | * @param $selector |
||
| 1765 | * @param array $attributes |
||
| 1766 | * @see \Codeception\Module\WebDriver::seeElementInDOM() |
||
| 1767 | */ |
||
| 1768 | public function seeElementInDOM($selector, $attributes = null) { |
||
| 1771 | |||
| 1772 | |||
| 1773 | /** |
||
| 1774 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1775 | * |
||
| 1776 | * Opposite of `seeElementInDOM`. |
||
| 1777 | * |
||
| 1778 | * @param $selector |
||
| 1779 | * @param array $attributes |
||
| 1780 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1781 | * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() |
||
| 1782 | */ |
||
| 1783 | public function cantSeeElementInDOM($selector, $attributes = null) { |
||
| 1786 | /** |
||
| 1787 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1788 | * |
||
| 1789 | * Opposite of `seeElementInDOM`. |
||
| 1790 | * |
||
| 1791 | * @param $selector |
||
| 1792 | * @param array $attributes |
||
| 1793 | * @see \Codeception\Module\WebDriver::dontSeeElementInDOM() |
||
| 1794 | */ |
||
| 1795 | public function dontSeeElementInDOM($selector, $attributes = null) { |
||
| 1798 | |||
| 1799 | |||
| 1800 | /** |
||
| 1801 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1802 | * |
||
| 1803 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
| 1804 | * |
||
| 1805 | * ``` php |
||
| 1806 | * <?php |
||
| 1807 | * $I->seeNumberOfElements('tr', 10); |
||
| 1808 | * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements |
||
| 1809 | * ?> |
||
| 1810 | * ``` |
||
| 1811 | * @param $selector |
||
| 1812 | * @param mixed $expected int or int[] |
||
| 1813 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1814 | * @see \Codeception\Module\WebDriver::seeNumberOfElements() |
||
| 1815 | */ |
||
| 1816 | public function canSeeNumberOfElements($selector, $expected) { |
||
| 1819 | /** |
||
| 1820 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1821 | * |
||
| 1822 | * Checks that there are a certain number of elements matched by the given locator on the page. |
||
| 1823 | * |
||
| 1824 | * ``` php |
||
| 1825 | * <?php |
||
| 1826 | * $I->seeNumberOfElements('tr', 10); |
||
| 1827 | * $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements |
||
| 1828 | * ?> |
||
| 1829 | * ``` |
||
| 1830 | * @param $selector |
||
| 1831 | * @param mixed $expected int or int[] |
||
| 1832 | * @see \Codeception\Module\WebDriver::seeNumberOfElements() |
||
| 1833 | */ |
||
| 1834 | public function seeNumberOfElements($selector, $expected) { |
||
| 1837 | |||
| 1838 | |||
| 1839 | /** |
||
| 1840 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1841 | * |
||
| 1842 | * |
||
| 1843 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1844 | * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() |
||
| 1845 | */ |
||
| 1846 | public function canSeeNumberOfElementsInDOM($selector, $expected) { |
||
| 1849 | /** |
||
| 1850 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1851 | * |
||
| 1852 | * |
||
| 1853 | * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM() |
||
| 1854 | */ |
||
| 1855 | public function seeNumberOfElementsInDOM($selector, $expected) { |
||
| 1858 | |||
| 1859 | |||
| 1860 | /** |
||
| 1861 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1862 | * |
||
| 1863 | * Checks that the given option is selected. |
||
| 1864 | * |
||
| 1865 | * ``` php |
||
| 1866 | * <?php |
||
| 1867 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1868 | * ?> |
||
| 1869 | * ``` |
||
| 1870 | * |
||
| 1871 | * @param $selector |
||
| 1872 | * @param $optionText |
||
| 1873 | * |
||
| 1874 | * @return mixed |
||
| 1875 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1876 | * @see \Codeception\Module\WebDriver::seeOptionIsSelected() |
||
| 1877 | */ |
||
| 1878 | public function canSeeOptionIsSelected($selector, $optionText) { |
||
| 1881 | /** |
||
| 1882 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1883 | * |
||
| 1884 | * Checks that the given option is selected. |
||
| 1885 | * |
||
| 1886 | * ``` php |
||
| 1887 | * <?php |
||
| 1888 | * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1889 | * ?> |
||
| 1890 | * ``` |
||
| 1891 | * |
||
| 1892 | * @param $selector |
||
| 1893 | * @param $optionText |
||
| 1894 | * |
||
| 1895 | * @return mixed |
||
| 1896 | * @see \Codeception\Module\WebDriver::seeOptionIsSelected() |
||
| 1897 | */ |
||
| 1898 | public function seeOptionIsSelected($selector, $optionText) { |
||
| 1901 | |||
| 1902 | |||
| 1903 | /** |
||
| 1904 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1905 | * |
||
| 1906 | * Checks that the given option is not selected. |
||
| 1907 | * |
||
| 1908 | * ``` php |
||
| 1909 | * <?php |
||
| 1910 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1911 | * ?> |
||
| 1912 | * ``` |
||
| 1913 | * |
||
| 1914 | * @param $selector |
||
| 1915 | * @param $optionText |
||
| 1916 | * |
||
| 1917 | * @return mixed |
||
| 1918 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1919 | * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() |
||
| 1920 | */ |
||
| 1921 | public function cantSeeOptionIsSelected($selector, $optionText) { |
||
| 1924 | /** |
||
| 1925 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1926 | * |
||
| 1927 | * Checks that the given option is not selected. |
||
| 1928 | * |
||
| 1929 | * ``` php |
||
| 1930 | * <?php |
||
| 1931 | * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); |
||
| 1932 | * ?> |
||
| 1933 | * ``` |
||
| 1934 | * |
||
| 1935 | * @param $selector |
||
| 1936 | * @param $optionText |
||
| 1937 | * |
||
| 1938 | * @return mixed |
||
| 1939 | * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected() |
||
| 1940 | */ |
||
| 1941 | public function dontSeeOptionIsSelected($selector, $optionText) { |
||
| 1944 | |||
| 1945 | |||
| 1946 | /** |
||
| 1947 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1948 | * |
||
| 1949 | * Checks that the page title contains the given string. |
||
| 1950 | * |
||
| 1951 | * ``` php |
||
| 1952 | * <?php |
||
| 1953 | * $I->seeInTitle('Blog - Post #1'); |
||
| 1954 | * ?> |
||
| 1955 | * ``` |
||
| 1956 | * |
||
| 1957 | * @param $title |
||
| 1958 | * |
||
| 1959 | * @return mixed |
||
| 1960 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1961 | * @see \Codeception\Module\WebDriver::seeInTitle() |
||
| 1962 | */ |
||
| 1963 | public function canSeeInTitle($title) { |
||
| 1966 | /** |
||
| 1967 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1968 | * |
||
| 1969 | * Checks that the page title contains the given string. |
||
| 1970 | * |
||
| 1971 | * ``` php |
||
| 1972 | * <?php |
||
| 1973 | * $I->seeInTitle('Blog - Post #1'); |
||
| 1974 | * ?> |
||
| 1975 | * ``` |
||
| 1976 | * |
||
| 1977 | * @param $title |
||
| 1978 | * |
||
| 1979 | * @return mixed |
||
| 1980 | * @see \Codeception\Module\WebDriver::seeInTitle() |
||
| 1981 | */ |
||
| 1982 | public function seeInTitle($title) { |
||
| 1985 | |||
| 1986 | |||
| 1987 | /** |
||
| 1988 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 1989 | * |
||
| 1990 | * Checks that the page title does not contain the given string. |
||
| 1991 | * |
||
| 1992 | * @param $title |
||
| 1993 | * |
||
| 1994 | * @return mixed |
||
| 1995 | * Conditional Assertion: Test won't be stopped on fail |
||
| 1996 | * @see \Codeception\Module\WebDriver::dontSeeInTitle() |
||
| 1997 | */ |
||
| 1998 | public function cantSeeInTitle($title) { |
||
| 2001 | /** |
||
| 2002 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2003 | * |
||
| 2004 | * Checks that the page title does not contain the given string. |
||
| 2005 | * |
||
| 2006 | * @param $title |
||
| 2007 | * |
||
| 2008 | * @return mixed |
||
| 2009 | * @see \Codeception\Module\WebDriver::dontSeeInTitle() |
||
| 2010 | */ |
||
| 2011 | public function dontSeeInTitle($title) { |
||
| 2014 | |||
| 2015 | |||
| 2016 | /** |
||
| 2017 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2018 | * |
||
| 2019 | * Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`. |
||
| 2020 | * Don't confuse popups with modal windows, |
||
| 2021 | * as created by [various libraries](http://jster.net/category/windows-modals-popups). |
||
| 2022 | * @see \Codeception\Module\WebDriver::acceptPopup() |
||
| 2023 | */ |
||
| 2024 | public function acceptPopup() { |
||
| 2027 | |||
| 2028 | |||
| 2029 | /** |
||
| 2030 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2031 | * |
||
| 2032 | * Dismisses the active JavaScript popup, as created by `window.alert`, `window.confirm`, or `window.prompt`. |
||
| 2033 | * @see \Codeception\Module\WebDriver::cancelPopup() |
||
| 2034 | */ |
||
| 2035 | public function cancelPopup() { |
||
| 2038 | |||
| 2039 | |||
| 2040 | /** |
||
| 2041 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2042 | * |
||
| 2043 | * Checks that the active JavaScript popup, |
||
| 2044 | * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. |
||
| 2045 | * |
||
| 2046 | * @param $text |
||
| 2047 | * |
||
| 2048 | * @throws \Codeception\Exception\ModuleException |
||
| 2049 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2050 | * @see \Codeception\Module\WebDriver::seeInPopup() |
||
| 2051 | */ |
||
| 2052 | public function canSeeInPopup($text) { |
||
| 2055 | /** |
||
| 2056 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2057 | * |
||
| 2058 | * Checks that the active JavaScript popup, |
||
| 2059 | * as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string. |
||
| 2060 | * |
||
| 2061 | * @param $text |
||
| 2062 | * |
||
| 2063 | * @throws \Codeception\Exception\ModuleException |
||
| 2064 | * @see \Codeception\Module\WebDriver::seeInPopup() |
||
| 2065 | */ |
||
| 2066 | public function seeInPopup($text) { |
||
| 2069 | |||
| 2070 | |||
| 2071 | /** |
||
| 2072 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2073 | * |
||
| 2074 | * Checks that the active JavaScript popup, |
||
| 2075 | * as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string. |
||
| 2076 | * |
||
| 2077 | * @param $text |
||
| 2078 | * |
||
| 2079 | * @throws \Codeception\Exception\ModuleException |
||
| 2080 | * Conditional Assertion: Test won't be stopped on fail |
||
| 2081 | * @see \Codeception\Module\WebDriver::dontSeeInPopup() |
||
| 2082 | */ |
||
| 2083 | public function cantSeeInPopup($text) { |
||
| 2086 | /** |
||
| 2087 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2088 | * |
||
| 2089 | * Checks that the active JavaScript popup, |
||
| 2090 | * as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string. |
||
| 2091 | * |
||
| 2092 | * @param $text |
||
| 2093 | * |
||
| 2094 | * @throws \Codeception\Exception\ModuleException |
||
| 2095 | * @see \Codeception\Module\WebDriver::dontSeeInPopup() |
||
| 2096 | */ |
||
| 2097 | public function dontSeeInPopup($text) { |
||
| 2100 | |||
| 2101 | |||
| 2102 | /** |
||
| 2103 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2104 | * |
||
| 2105 | * Enters text into a native JavaScript prompt popup, as created by `window.prompt`. |
||
| 2106 | * |
||
| 2107 | * @param $keys |
||
| 2108 | * |
||
| 2109 | * @throws \Codeception\Exception\ModuleException |
||
| 2110 | * @see \Codeception\Module\WebDriver::typeInPopup() |
||
| 2111 | */ |
||
| 2112 | public function typeInPopup($keys) { |
||
| 2115 | |||
| 2116 | |||
| 2117 | /** |
||
| 2118 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2119 | * |
||
| 2120 | * Reloads the current page. |
||
| 2121 | * @see \Codeception\Module\WebDriver::reloadPage() |
||
| 2122 | */ |
||
| 2123 | public function reloadPage() { |
||
| 2126 | |||
| 2127 | |||
| 2128 | /** |
||
| 2129 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2130 | * |
||
| 2131 | * Moves back in history. |
||
| 2132 | * @see \Codeception\Module\WebDriver::moveBack() |
||
| 2133 | */ |
||
| 2134 | public function moveBack() { |
||
| 2137 | |||
| 2138 | |||
| 2139 | /** |
||
| 2140 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2141 | * |
||
| 2142 | * Moves forward in history. |
||
| 2143 | * @see \Codeception\Module\WebDriver::moveForward() |
||
| 2144 | */ |
||
| 2145 | public function moveForward() { |
||
| 2148 | |||
| 2149 | |||
| 2150 | /** |
||
| 2151 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2152 | * |
||
| 2153 | * Submits the given form on the page, optionally with the given form |
||
| 2154 | * values. Give the form fields values as an array. Note that hidden fields |
||
| 2155 | * can't be accessed. |
||
| 2156 | * |
||
| 2157 | * Skipped fields will be filled by their values from the page. |
||
| 2158 | * You don't need to click the 'Submit' button afterwards. |
||
| 2159 | * This command itself triggers the request to form's action. |
||
| 2160 | * |
||
| 2161 | * You can optionally specify what button's value to include |
||
| 2162 | * in the request with the last parameter as an alternative to |
||
| 2163 | * explicitly setting its value in the second parameter, as |
||
| 2164 | * button values are not otherwise included in the request. |
||
| 2165 | * |
||
| 2166 | * Examples: |
||
| 2167 | * |
||
| 2168 | * ``` php |
||
| 2169 | * <?php |
||
| 2170 | * $I->submitForm('#login', [ |
||
| 2171 | * 'login' => 'davert', |
||
| 2172 | * 'password' => '123456' |
||
| 2173 | * ]); |
||
| 2174 | * // or |
||
| 2175 | * $I->submitForm('#login', [ |
||
| 2176 | * 'login' => 'davert', |
||
| 2177 | * 'password' => '123456' |
||
| 2178 | * ], 'submitButtonName'); |
||
| 2179 | * |
||
| 2180 | * ``` |
||
| 2181 | * |
||
| 2182 | * For example, given this sample "Sign Up" form: |
||
| 2183 | * |
||
| 2184 | * ``` html |
||
| 2185 | * <form action="/sign_up"> |
||
| 2186 | * Login: |
||
| 2187 | * <input type="text" name="user[login]" /><br/> |
||
| 2188 | * Password: |
||
| 2189 | * <input type="password" name="user[password]" /><br/> |
||
| 2190 | * Do you agree to our terms? |
||
| 2191 | * <input type="checkbox" name="user[agree]" /><br/> |
||
| 2192 | * Select pricing plan: |
||
| 2193 | * <select name="plan"> |
||
| 2194 | * <option value="1">Free</option> |
||
| 2195 | * <option value="2" selected="selected">Paid</option> |
||
| 2196 | * </select> |
||
| 2197 | * <input type="submit" name="submitButton" value="Submit" /> |
||
| 2198 | * </form> |
||
| 2199 | * ``` |
||
| 2200 | * |
||
| 2201 | * You could write the following to submit it: |
||
| 2202 | * |
||
| 2203 | * ``` php |
||
| 2204 | * <?php |
||
| 2205 | * $I->submitForm( |
||
| 2206 | * '#userForm', |
||
| 2207 | * [ |
||
| 2208 | * 'user[login]' => 'Davert', |
||
| 2209 | * 'user[password]' => '123456', |
||
| 2210 | * 'user[agree]' => true |
||
| 2211 | * ], |
||
| 2212 | * 'submitButton' |
||
| 2213 | * ); |
||
| 2214 | * ``` |
||
| 2215 | * Note that "2" will be the submitted value for the "plan" field, as it is |
||
| 2216 | * the selected option. |
||
| 2217 | * |
||
| 2218 | * Also note that this differs from PhpBrowser, in that |
||
| 2219 | * ```'user' => [ 'login' => 'Davert' ]``` is not supported at the moment. |
||
| 2220 | * Named array keys *must* be included in the name as above. |
||
| 2221 | * |
||
| 2222 | * Pair this with seeInFormFields for quick testing magic. |
||
| 2223 | * |
||
| 2224 | * ``` php |
||
| 2225 | * <?php |
||
| 2226 | * $form = [ |
||
| 2227 | * 'field1' => 'value', |
||
| 2228 | * 'field2' => 'another value', |
||
| 2229 | * 'checkbox1' => true, |
||
| 2230 | * // ... |
||
| 2231 | * ]; |
||
| 2232 | * $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); |
||
| 2233 | * // $I->amOnPage('/path/to/form-page') may be needed |
||
| 2234 | * $I->seeInFormFields('//form[@id=my-form]', $form); |
||
| 2235 | * ?> |
||
| 2236 | * ``` |
||
| 2237 | * |
||
| 2238 | * Parameter values must be set to arrays for multiple input fields |
||
| 2239 | * of the same name, or multi-select combo boxes. For checkboxes, |
||
| 2240 | * either the string value can be used, or boolean values which will |
||
| 2241 | * be replaced by the checkbox's value in the DOM. |
||
| 2242 | * |
||
| 2243 | * ``` php |
||
| 2244 | * <?php |
||
| 2245 | * $I->submitForm('#my-form', [ |
||
| 2246 | * 'field1' => 'value', |
||
| 2247 | * 'checkbox' => [ |
||
| 2248 | * 'value of first checkbox', |
||
| 2249 | * 'value of second checkbox, |
||
| 2250 | * ], |
||
| 2251 | * 'otherCheckboxes' => [ |
||
| 2252 | * true, |
||
| 2253 | * false, |
||
| 2254 | * false |
||
| 2255 | * ], |
||
| 2256 | * 'multiselect' => [ |
||
| 2257 | * 'first option value', |
||
| 2258 | * 'second option value' |
||
| 2259 | * ] |
||
| 2260 | * ]); |
||
| 2261 | * ?> |
||
| 2262 | * ``` |
||
| 2263 | * |
||
| 2264 | * Mixing string and boolean values for a checkbox's value is not supported |
||
| 2265 | * and may produce unexpected results. |
||
| 2266 | * |
||
| 2267 | * Field names ending in "[]" must be passed without the trailing square |
||
| 2268 | * bracket characters, and must contain an array for its value. This allows |
||
| 2269 | * submitting multiple values with the same name, consider: |
||
| 2270 | * |
||
| 2271 | * ```php |
||
| 2272 | * $I->submitForm('#my-form', [ |
||
| 2273 | * 'field[]' => 'value', |
||
| 2274 | * 'field[]' => 'another value', // 'field[]' is already a defined key |
||
| 2275 | * ]); |
||
| 2276 | * ``` |
||
| 2277 | * |
||
| 2278 | * The solution is to pass an array value: |
||
| 2279 | * |
||
| 2280 | * ```php |
||
| 2281 | * // this way both values are submitted |
||
| 2282 | * $I->submitForm('#my-form', [ |
||
| 2283 | * 'field' => [ |
||
| 2284 | * 'value', |
||
| 2285 | * 'another value', |
||
| 2286 | * ] |
||
| 2287 | * ]); |
||
| 2288 | * ``` |
||
| 2289 | * |
||
| 2290 | * The `$button` parameter can be either a string, an array or an instance |
||
| 2291 | * of Facebook\WebDriver\WebDriverBy. When it is a string, the |
||
| 2292 | * button will be found by its "name" attribute. If $button is an |
||
| 2293 | * array then it will be treated as a strict selector and a WebDriverBy |
||
| 2294 | * will be used verbatim. |
||
| 2295 | * |
||
| 2296 | * For example, given the following HTML: |
||
| 2297 | * |
||
| 2298 | * ``` html |
||
| 2299 | * <input type="submit" name="submitButton" value="Submit" /> |
||
| 2300 | * ``` |
||
| 2301 | * |
||
| 2302 | * `$button` could be any one of the following: |
||
| 2303 | * - 'submitButton' |
||
| 2304 | * - ['name' => 'submitButton'] |
||
| 2305 | * - WebDriverBy::name('submitButton') |
||
| 2306 | * |
||
| 2307 | * @param $selector |
||
| 2308 | * @param $params |
||
| 2309 | * @param $button |
||
| 2310 | * @see \Codeception\Module\WebDriver::submitForm() |
||
| 2311 | */ |
||
| 2312 | public function submitForm($selector, $params, $button = null) { |
||
| 2315 | |||
| 2316 | |||
| 2317 | /** |
||
| 2318 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2319 | * |
||
| 2320 | * Waits up to $timeout seconds for the given element to change. |
||
| 2321 | * Element "change" is determined by a callback function which is called repeatedly |
||
| 2322 | * until the return value evaluates to true. |
||
| 2323 | * |
||
| 2324 | * ``` php |
||
| 2325 | * <?php |
||
| 2326 | * use \Facebook\WebDriver\WebDriverElement |
||
| 2327 | * $I->waitForElementChange('#menu', function(WebDriverElement $el) { |
||
| 2328 | * return $el->isDisplayed(); |
||
| 2329 | * }, 100); |
||
| 2330 | * ?> |
||
| 2331 | * ``` |
||
| 2332 | * |
||
| 2333 | * @param $element |
||
| 2334 | * @param \Closure $callback |
||
| 2335 | * @param int $timeout seconds |
||
| 2336 | * @throws \Codeception\Exception\ElementNotFound |
||
| 2337 | * @see \Codeception\Module\WebDriver::waitForElementChange() |
||
| 2338 | */ |
||
| 2339 | public function waitForElementChange($element, $callback, $timeout = null) { |
||
| 2342 | |||
| 2343 | |||
| 2344 | /** |
||
| 2345 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2346 | * |
||
| 2347 | * Waits up to $timeout seconds for an element to appear on the page. |
||
| 2348 | * If the element doesn't appear, a timeout exception is thrown. |
||
| 2349 | * |
||
| 2350 | * ``` php |
||
| 2351 | * <?php |
||
| 2352 | * $I->waitForElement('#agree_button', 30); // secs |
||
| 2353 | * $I->click('#agree_button'); |
||
| 2354 | * ?> |
||
| 2355 | * ``` |
||
| 2356 | * |
||
| 2357 | * @param $element |
||
| 2358 | * @param int $timeout seconds |
||
| 2359 | * @throws \Exception |
||
| 2360 | * @see \Codeception\Module\WebDriver::waitForElement() |
||
| 2361 | */ |
||
| 2362 | public function waitForElement($element, $timeout = null) { |
||
| 2365 | |||
| 2366 | |||
| 2367 | /** |
||
| 2368 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2369 | * |
||
| 2370 | * Waits up to $timeout seconds for the given element to be visible on the page. |
||
| 2371 | * If element doesn't appear, a timeout exception is thrown. |
||
| 2372 | * |
||
| 2373 | * ``` php |
||
| 2374 | * <?php |
||
| 2375 | * $I->waitForElementVisible('#agree_button', 30); // secs |
||
| 2376 | * $I->click('#agree_button'); |
||
| 2377 | * ?> |
||
| 2378 | * ``` |
||
| 2379 | * |
||
| 2380 | * @param $element |
||
| 2381 | * @param int $timeout seconds |
||
| 2382 | * @throws \Exception |
||
| 2383 | * @see \Codeception\Module\WebDriver::waitForElementVisible() |
||
| 2384 | */ |
||
| 2385 | public function waitForElementVisible($element, $timeout = null) { |
||
| 2388 | |||
| 2389 | |||
| 2390 | /** |
||
| 2391 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2392 | * |
||
| 2393 | * Waits up to $timeout seconds for the given element to become invisible. |
||
| 2394 | * If element stays visible, a timeout exception is thrown. |
||
| 2395 | * |
||
| 2396 | * ``` php |
||
| 2397 | * <?php |
||
| 2398 | * $I->waitForElementNotVisible('#agree_button', 30); // secs |
||
| 2399 | * ?> |
||
| 2400 | * ``` |
||
| 2401 | * |
||
| 2402 | * @param $element |
||
| 2403 | * @param int $timeout seconds |
||
| 2404 | * @throws \Exception |
||
| 2405 | * @see \Codeception\Module\WebDriver::waitForElementNotVisible() |
||
| 2406 | */ |
||
| 2407 | public function waitForElementNotVisible($element, $timeout = null) { |
||
| 2410 | |||
| 2411 | |||
| 2412 | /** |
||
| 2413 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2414 | * |
||
| 2415 | * Waits up to $timeout seconds for the given string to appear on the page. |
||
| 2416 | * |
||
| 2417 | * Can also be passed a selector to search in, be as specific as possible when using selectors. |
||
| 2418 | * waitForText() will only watch the first instance of the matching selector / text provided. |
||
| 2419 | * If the given text doesn't appear, a timeout exception is thrown. |
||
| 2420 | * |
||
| 2421 | * ``` php |
||
| 2422 | * <?php |
||
| 2423 | * $I->waitForText('foo', 30); // secs |
||
| 2424 | * $I->waitForText('foo', 30, '.title'); // secs |
||
| 2425 | * ?> |
||
| 2426 | * ``` |
||
| 2427 | * |
||
| 2428 | * @param string $text |
||
| 2429 | * @param int $timeout seconds |
||
| 2430 | * @param string $selector optional |
||
| 2431 | * @throws \Exception |
||
| 2432 | * @see \Codeception\Module\WebDriver::waitForText() |
||
| 2433 | */ |
||
| 2434 | public function waitForText($text, $timeout = null, $selector = null) { |
||
| 2437 | |||
| 2438 | |||
| 2439 | /** |
||
| 2440 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2441 | * |
||
| 2442 | * Wait for $timeout seconds. |
||
| 2443 | * |
||
| 2444 | * @param int|float $timeout secs |
||
| 2445 | * @throws \Codeception\Exception\TestRuntimeException |
||
| 2446 | * @see \Codeception\Module\WebDriver::wait() |
||
| 2447 | */ |
||
| 2448 | public function wait($timeout) { |
||
| 2451 | |||
| 2452 | |||
| 2453 | /** |
||
| 2454 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2455 | * |
||
| 2456 | * Low-level API method. |
||
| 2457 | * If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly: |
||
| 2458 | * |
||
| 2459 | * ``` php |
||
| 2460 | * $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { |
||
| 2461 | * $webdriver->get('http://google.com'); |
||
| 2462 | * }); |
||
| 2463 | * ``` |
||
| 2464 | * |
||
| 2465 | * This runs in the context of the |
||
| 2466 | * [RemoteWebDriver class](https://github.com/facebook/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php). |
||
| 2467 | * Try not to use this command on a regular basis. |
||
| 2468 | * If Codeception lacks a feature you need, please implement it and submit a patch. |
||
| 2469 | * |
||
| 2470 | * @param callable $function |
||
| 2471 | * @see \Codeception\Module\WebDriver::executeInSelenium() |
||
| 2472 | */ |
||
| 2473 | public function executeInSelenium($function) { |
||
| 2476 | |||
| 2477 | |||
| 2478 | /** |
||
| 2479 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2480 | * |
||
| 2481 | * Switch to another window identified by name. |
||
| 2482 | * |
||
| 2483 | * The window can only be identified by name. If the $name parameter is blank, the parent window will be used. |
||
| 2484 | * |
||
| 2485 | * Example: |
||
| 2486 | * ``` html |
||
| 2487 | * <input type="button" value="Open window" onclick="window.open('http://example.com', 'another_window')"> |
||
| 2488 | * ``` |
||
| 2489 | * |
||
| 2490 | * ``` php |
||
| 2491 | * <?php |
||
| 2492 | * $I->click("Open window"); |
||
| 2493 | * # switch to another window |
||
| 2494 | * $I->switchToWindow("another_window"); |
||
| 2495 | * # switch to parent window |
||
| 2496 | * $I->switchToWindow(); |
||
| 2497 | * ?> |
||
| 2498 | * ``` |
||
| 2499 | * |
||
| 2500 | * If the window has no name, match it by switching to next active tab using `switchToNextTab` method. |
||
| 2501 | * |
||
| 2502 | * Or use native Selenium functions to get access to all opened windows: |
||
| 2503 | * |
||
| 2504 | * ``` php |
||
| 2505 | * <?php |
||
| 2506 | * $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { |
||
| 2507 | * $handles=$webdriver->getWindowHandles(); |
||
| 2508 | * $last_window = end($handles); |
||
| 2509 | * $webdriver->switchTo()->window($last_window); |
||
| 2510 | * }); |
||
| 2511 | * ?> |
||
| 2512 | * ``` |
||
| 2513 | * |
||
| 2514 | * @param string|null $name |
||
| 2515 | * @see \Codeception\Module\WebDriver::switchToWindow() |
||
| 2516 | */ |
||
| 2517 | public function switchToWindow($name = null) { |
||
| 2520 | |||
| 2521 | |||
| 2522 | /** |
||
| 2523 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2524 | * |
||
| 2525 | * Switch to another frame on the page. |
||
| 2526 | * |
||
| 2527 | * Example: |
||
| 2528 | * ``` html |
||
| 2529 | * <iframe name="another_frame" src="http://example.com"> |
||
| 2530 | * |
||
| 2531 | * ``` |
||
| 2532 | * |
||
| 2533 | * ``` php |
||
| 2534 | * <?php |
||
| 2535 | * # switch to iframe |
||
| 2536 | * $I->switchToIFrame("another_frame"); |
||
| 2537 | * # switch to parent page |
||
| 2538 | * $I->switchToIFrame(); |
||
| 2539 | * |
||
| 2540 | * ``` |
||
| 2541 | * |
||
| 2542 | * @param string|null $name |
||
| 2543 | * @see \Codeception\Module\WebDriver::switchToIFrame() |
||
| 2544 | */ |
||
| 2545 | public function switchToIFrame($name = null) { |
||
| 2548 | |||
| 2549 | |||
| 2550 | /** |
||
| 2551 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2552 | * |
||
| 2553 | * Executes JavaScript and waits up to $timeout seconds for it to return true. |
||
| 2554 | * |
||
| 2555 | * In this example we will wait up to 60 seconds for all jQuery AJAX requests to finish. |
||
| 2556 | * |
||
| 2557 | * ``` php |
||
| 2558 | * <?php |
||
| 2559 | * $I->waitForJS("return $.active == 0;", 60); |
||
| 2560 | * ?> |
||
| 2561 | * ``` |
||
| 2562 | * |
||
| 2563 | * @param string $script |
||
| 2564 | * @param int $timeout seconds |
||
| 2565 | * @see \Codeception\Module\WebDriver::waitForJS() |
||
| 2566 | */ |
||
| 2567 | public function waitForJS($script, $timeout = null) { |
||
| 2570 | |||
| 2571 | |||
| 2572 | /** |
||
| 2573 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2574 | * |
||
| 2575 | * Executes custom JavaScript. |
||
| 2576 | * |
||
| 2577 | * This example uses jQuery to get a value and assigns that value to a PHP variable: |
||
| 2578 | * |
||
| 2579 | * ```php |
||
| 2580 | * <?php |
||
| 2581 | * $myVar = $I->executeJS('return $("#myField").val()'); |
||
| 2582 | * |
||
| 2583 | * // additional arguments can be passed as array |
||
| 2584 | * // Example shows `Hello World` alert: |
||
| 2585 | * $I->executeJS("window.alert(arguments[0])", ['Hello world']); |
||
| 2586 | * ``` |
||
| 2587 | * |
||
| 2588 | * @param $script |
||
| 2589 | * @param array $arguments |
||
| 2590 | * @return mixed |
||
| 2591 | * @see \Codeception\Module\WebDriver::executeJS() |
||
| 2592 | */ |
||
| 2593 | public function executeJS($script, $arguments = null) { |
||
| 2596 | |||
| 2597 | |||
| 2598 | /** |
||
| 2599 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2600 | * |
||
| 2601 | * Executes asynchronous JavaScript. |
||
| 2602 | * A callback should be executed by JavaScript to exit from a script. |
||
| 2603 | * Callback is passed as a last element in `arguments` array. |
||
| 2604 | * Additional arguments can be passed as array in second parameter. |
||
| 2605 | * |
||
| 2606 | * ```js |
||
| 2607 | * // wait for 1200 milliseconds my running `setTimeout` |
||
| 2608 | * * $I->executeAsyncJS('setTimeout(arguments[0], 1200)'); |
||
| 2609 | * |
||
| 2610 | * $seconds = 1200; // or seconds are passed as argument |
||
| 2611 | * $I->executeAsyncJS('setTimeout(arguments[1], arguments[0])', [$seconds]); |
||
| 2612 | * ``` |
||
| 2613 | * |
||
| 2614 | * @param $script |
||
| 2615 | * @param array $arguments |
||
| 2616 | * @return mixed |
||
| 2617 | * @see \Codeception\Module\WebDriver::executeAsyncJS() |
||
| 2618 | */ |
||
| 2619 | public function executeAsyncJS($script, $arguments = null) { |
||
| 2622 | |||
| 2623 | |||
| 2624 | /** |
||
| 2625 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2626 | * |
||
| 2627 | * Maximizes the current window. |
||
| 2628 | * @see \Codeception\Module\WebDriver::maximizeWindow() |
||
| 2629 | */ |
||
| 2630 | public function maximizeWindow() { |
||
| 2633 | |||
| 2634 | |||
| 2635 | /** |
||
| 2636 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2637 | * |
||
| 2638 | * Performs a simple mouse drag-and-drop operation. |
||
| 2639 | * |
||
| 2640 | * ``` php |
||
| 2641 | * <?php |
||
| 2642 | * $I->dragAndDrop('#drag', '#drop'); |
||
| 2643 | * ?> |
||
| 2644 | * ``` |
||
| 2645 | * |
||
| 2646 | * @param string $source (CSS ID or XPath) |
||
| 2647 | * @param string $target (CSS ID or XPath) |
||
| 2648 | * @see \Codeception\Module\WebDriver::dragAndDrop() |
||
| 2649 | */ |
||
| 2650 | public function dragAndDrop($source, $target) { |
||
| 2653 | |||
| 2654 | |||
| 2655 | /** |
||
| 2656 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2657 | * |
||
| 2658 | * Move mouse over the first element matched by the given locator. |
||
| 2659 | * If the first parameter null then the page is used. |
||
| 2660 | * If the second and third parameters are given, |
||
| 2661 | * then the mouse is moved to an offset of the element's top-left corner. |
||
| 2662 | * Otherwise, the mouse is moved to the center of the element. |
||
| 2663 | * |
||
| 2664 | * ``` php |
||
| 2665 | * <?php |
||
| 2666 | * $I->moveMouseOver(['css' => '.checkout']); |
||
| 2667 | * $I->moveMouseOver(null, 20, 50); |
||
| 2668 | * $I->moveMouseOver(['css' => '.checkout'], 20, 50); |
||
| 2669 | * ?> |
||
| 2670 | * ``` |
||
| 2671 | * |
||
| 2672 | * @param string $cssOrXPath css or xpath of the web element |
||
| 2673 | * @param int $offsetX |
||
| 2674 | * @param int $offsetY |
||
| 2675 | * |
||
| 2676 | * @throws \Codeception\Exception\ElementNotFound |
||
| 2677 | * @see \Codeception\Module\WebDriver::moveMouseOver() |
||
| 2678 | */ |
||
| 2679 | public function moveMouseOver($cssOrXPath = null, $offsetX = null, $offsetY = null) { |
||
| 2682 | |||
| 2683 | |||
| 2684 | /** |
||
| 2685 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2686 | * |
||
| 2687 | * Performs click with the left mouse button on an element. |
||
| 2688 | * If the first parameter `null` then the offset is relative to the actual mouse position. |
||
| 2689 | * If the second and third parameters are given, |
||
| 2690 | * then the mouse is moved to an offset of the element's top-left corner. |
||
| 2691 | * Otherwise, the mouse is moved to the center of the element. |
||
| 2692 | * |
||
| 2693 | * ``` php |
||
| 2694 | * <?php |
||
| 2695 | * $I->clickWithLeftButton(['css' => '.checkout']); |
||
| 2696 | * $I->clickWithLeftButton(null, 20, 50); |
||
| 2697 | * $I->clickWithLeftButton(['css' => '.checkout'], 20, 50); |
||
| 2698 | * ?> |
||
| 2699 | * ``` |
||
| 2700 | * |
||
| 2701 | * @param string $cssOrXPath css or xpath of the web element (body by default). |
||
| 2702 | * @param int $offsetX |
||
| 2703 | * @param int $offsetY |
||
| 2704 | * |
||
| 2705 | * @throws \Codeception\Exception\ElementNotFound |
||
| 2706 | * @see \Codeception\Module\WebDriver::clickWithLeftButton() |
||
| 2707 | */ |
||
| 2708 | public function clickWithLeftButton($cssOrXPath = null, $offsetX = null, $offsetY = null) { |
||
| 2711 | |||
| 2712 | |||
| 2713 | /** |
||
| 2714 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2715 | * |
||
| 2716 | * Performs contextual click with the right mouse button on an element. |
||
| 2717 | * If the first parameter `null` then the offset is relative to the actual mouse position. |
||
| 2718 | * If the second and third parameters are given, |
||
| 2719 | * then the mouse is moved to an offset of the element's top-left corner. |
||
| 2720 | * Otherwise, the mouse is moved to the center of the element. |
||
| 2721 | * |
||
| 2722 | * ``` php |
||
| 2723 | * <?php |
||
| 2724 | * $I->clickWithRightButton(['css' => '.checkout']); |
||
| 2725 | * $I->clickWithRightButton(null, 20, 50); |
||
| 2726 | * $I->clickWithRightButton(['css' => '.checkout'], 20, 50); |
||
| 2727 | * ?> |
||
| 2728 | * ``` |
||
| 2729 | * |
||
| 2730 | * @param string $cssOrXPath css or xpath of the web element (body by default). |
||
| 2731 | * @param int $offsetX |
||
| 2732 | * @param int $offsetY |
||
| 2733 | * |
||
| 2734 | * @throws \Codeception\Exception\ElementNotFound |
||
| 2735 | * @see \Codeception\Module\WebDriver::clickWithRightButton() |
||
| 2736 | */ |
||
| 2737 | public function clickWithRightButton($cssOrXPath = null, $offsetX = null, $offsetY = null) { |
||
| 2740 | |||
| 2741 | |||
| 2742 | /** |
||
| 2743 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2744 | * |
||
| 2745 | * Pauses test execution in debug mode. |
||
| 2746 | * To proceed test press "ENTER" in console. |
||
| 2747 | * |
||
| 2748 | * This method is useful while writing tests, |
||
| 2749 | * since it allows you to inspect the current page in the middle of a test case. |
||
| 2750 | * @see \Codeception\Module\WebDriver::pauseExecution() |
||
| 2751 | */ |
||
| 2752 | public function pauseExecution() { |
||
| 2755 | |||
| 2756 | |||
| 2757 | /** |
||
| 2758 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2759 | * |
||
| 2760 | * Performs a double-click on an element matched by CSS or XPath. |
||
| 2761 | * |
||
| 2762 | * @param $cssOrXPath |
||
| 2763 | * @throws \Codeception\Exception\ElementNotFound |
||
| 2764 | * @see \Codeception\Module\WebDriver::doubleClick() |
||
| 2765 | */ |
||
| 2766 | public function doubleClick($cssOrXPath) { |
||
| 2769 | |||
| 2770 | |||
| 2771 | /** |
||
| 2772 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2773 | * |
||
| 2774 | * Presses the given key on the given element. |
||
| 2775 | * To specify a character and modifier (e.g. ctrl, alt, shift, meta), pass an array for $char with |
||
| 2776 | * the modifier as the first element and the character as the second. |
||
| 2777 | * For special keys use key constants from WebDriverKeys class. |
||
| 2778 | * |
||
| 2779 | * ``` php |
||
| 2780 | * <?php |
||
| 2781 | * // <input id="page" value="old" /> |
||
| 2782 | * $I->pressKey('#page','a'); // => olda |
||
| 2783 | * $I->pressKey('#page',array('ctrl','a'),'new'); //=> new |
||
| 2784 | * $I->pressKey('#page',array('shift','111'),'1','x'); //=> old!!!1x |
||
| 2785 | * $I->pressKey('descendant-or-self::*[@id='page']','u'); //=> oldu |
||
| 2786 | * $I->pressKey('#name', array('ctrl', 'a'), \Facebook\WebDriver\WebDriverKeys::DELETE); //=>'' |
||
| 2787 | * ?> |
||
| 2788 | * ``` |
||
| 2789 | * |
||
| 2790 | * @param $element |
||
| 2791 | * @param $char string|array Can be char or array with modifier. You can provide several chars. |
||
| 2792 | * @throws \Codeception\Exception\ElementNotFound |
||
| 2793 | * @see \Codeception\Module\WebDriver::pressKey() |
||
| 2794 | */ |
||
| 2795 | public function pressKey($element, $char) { |
||
| 2798 | |||
| 2799 | |||
| 2800 | /** |
||
| 2801 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2802 | * |
||
| 2803 | * Append the given text to the given element. |
||
| 2804 | * Can also add a selection to a select box. |
||
| 2805 | * |
||
| 2806 | * ``` php |
||
| 2807 | * <?php |
||
| 2808 | * $I->appendField('#mySelectbox', 'SelectValue'); |
||
| 2809 | * $I->appendField('#myTextField', 'appended'); |
||
| 2810 | * ?> |
||
| 2811 | * ``` |
||
| 2812 | * |
||
| 2813 | * @param string $field |
||
| 2814 | * @param string $value |
||
| 2815 | * @throws \Codeception\Exception\ElementNotFound |
||
| 2816 | * @see \Codeception\Module\WebDriver::appendField() |
||
| 2817 | */ |
||
| 2818 | public function appendField($field, $value) { |
||
| 2821 | |||
| 2822 | |||
| 2823 | /** |
||
| 2824 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2825 | * |
||
| 2826 | * Saves current cookies into named snapshot in order to restore them in other tests |
||
| 2827 | * This is useful to save session state between tests. |
||
| 2828 | * For example, if user needs log in to site for each test this scenario can be executed once |
||
| 2829 | * while other tests can just restore saved cookies. |
||
| 2830 | * |
||
| 2831 | * ``` php |
||
| 2832 | * <?php |
||
| 2833 | * // inside AcceptanceTester class: |
||
| 2834 | * |
||
| 2835 | * public function login() |
||
| 2836 | * { |
||
| 2837 | * // if snapshot exists - skipping login |
||
| 2838 | * if ($I->loadSessionSnapshot('login')) return; |
||
| 2839 | * |
||
| 2840 | * // logging in |
||
| 2841 | * $I->amOnPage('/login'); |
||
| 2842 | * $I->fillField('name', 'jon'); |
||
| 2843 | * $I->fillField('password', '123345'); |
||
| 2844 | * $I->click('Login'); |
||
| 2845 | * |
||
| 2846 | * // saving snapshot |
||
| 2847 | * $I->saveSessionSnapshot('login'); |
||
| 2848 | * } |
||
| 2849 | * ?> |
||
| 2850 | * ``` |
||
| 2851 | * |
||
| 2852 | * @param $name |
||
| 2853 | * @return mixed |
||
| 2854 | * @see \Codeception\Module\WebDriver::saveSessionSnapshot() |
||
| 2855 | */ |
||
| 2856 | public function saveSessionSnapshot($name) { |
||
| 2859 | |||
| 2860 | |||
| 2861 | /** |
||
| 2862 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2863 | * |
||
| 2864 | * Loads cookies from a saved snapshot. |
||
| 2865 | * Allows to reuse same session across tests without additional login. |
||
| 2866 | * |
||
| 2867 | * See [saveSessionSnapshot](#saveSessionSnapshot) |
||
| 2868 | * |
||
| 2869 | * @param $name |
||
| 2870 | * @return mixed |
||
| 2871 | * @see \Codeception\Module\WebDriver::loadSessionSnapshot() |
||
| 2872 | */ |
||
| 2873 | public function loadSessionSnapshot($name) { |
||
| 2876 | |||
| 2877 | |||
| 2878 | /** |
||
| 2879 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2880 | * |
||
| 2881 | * Deletes session snapshot. |
||
| 2882 | * |
||
| 2883 | * See [saveSessionSnapshot](#saveSessionSnapshot) |
||
| 2884 | * |
||
| 2885 | * @param $name |
||
| 2886 | * @return mixed |
||
| 2887 | * @see \Codeception\Module\WebDriver::deleteSessionSnapshot() |
||
| 2888 | */ |
||
| 2889 | public function deleteSessionSnapshot($name) { |
||
| 2892 | |||
| 2893 | |||
| 2894 | /** |
||
| 2895 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2896 | * |
||
| 2897 | * Move to the middle of the given element matched by the given locator. |
||
| 2898 | * Extra shift, calculated from the top-left corner of the element, |
||
| 2899 | * can be set by passing $offsetX and $offsetY parameters. |
||
| 2900 | * |
||
| 2901 | * ``` php |
||
| 2902 | * <?php |
||
| 2903 | * $I->scrollTo(['css' => '.checkout'], 20, 50); |
||
| 2904 | * ?> |
||
| 2905 | * ``` |
||
| 2906 | * |
||
| 2907 | * @param $selector |
||
| 2908 | * @param int $offsetX |
||
| 2909 | * @param int $offsetY |
||
| 2910 | * @see \Codeception\Module\WebDriver::scrollTo() |
||
| 2911 | */ |
||
| 2912 | public function scrollTo($selector, $offsetX = null, $offsetY = null) { |
||
| 2915 | |||
| 2916 | |||
| 2917 | /** |
||
| 2918 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2919 | * |
||
| 2920 | * Opens a new browser tab (wherever it is possible) and switches to it. |
||
| 2921 | * |
||
| 2922 | * ```php |
||
| 2923 | * <?php |
||
| 2924 | * $I->openNewTab(); |
||
| 2925 | * ``` |
||
| 2926 | * Tab is opened by using `window.open` javascript in a browser. |
||
| 2927 | * Please note, that adblock can restrict creating such tabs. |
||
| 2928 | * |
||
| 2929 | * Can't be used with PhantomJS |
||
| 2930 | * |
||
| 2931 | * @see \Codeception\Module\WebDriver::openNewTab() |
||
| 2932 | */ |
||
| 2933 | public function openNewTab() { |
||
| 2936 | |||
| 2937 | |||
| 2938 | /** |
||
| 2939 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2940 | * |
||
| 2941 | * Closes current browser tab and switches to previous active tab. |
||
| 2942 | * |
||
| 2943 | * ```php |
||
| 2944 | * <?php |
||
| 2945 | * $I->closeTab(); |
||
| 2946 | * ``` |
||
| 2947 | * |
||
| 2948 | * Can't be used with PhantomJS |
||
| 2949 | * @see \Codeception\Module\WebDriver::closeTab() |
||
| 2950 | */ |
||
| 2951 | public function closeTab() { |
||
| 2954 | |||
| 2955 | |||
| 2956 | /** |
||
| 2957 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2958 | * |
||
| 2959 | * Switches to next browser tab. |
||
| 2960 | * An offset can be specified. |
||
| 2961 | * |
||
| 2962 | * ```php |
||
| 2963 | * <?php |
||
| 2964 | * // switch to next tab |
||
| 2965 | * $I->switchToNextTab(); |
||
| 2966 | * // switch to 2nd next tab |
||
| 2967 | * $I->switchToNextTab(2); |
||
| 2968 | * ``` |
||
| 2969 | * |
||
| 2970 | * Can't be used with PhantomJS |
||
| 2971 | * |
||
| 2972 | * @param int $offset 1 |
||
| 2973 | * @see \Codeception\Module\WebDriver::switchToNextTab() |
||
| 2974 | */ |
||
| 2975 | public function switchToNextTab($offset = null) { |
||
| 2978 | |||
| 2979 | |||
| 2980 | /** |
||
| 2981 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 2982 | * |
||
| 2983 | * Switches to previous browser tab. |
||
| 2984 | * An offset can be specified. |
||
| 2985 | * |
||
| 2986 | * ```php |
||
| 2987 | * <?php |
||
| 2988 | * // switch to previous tab |
||
| 2989 | * $I->switchToPreviousTab(); |
||
| 2990 | * // switch to 2nd previous tab |
||
| 2991 | * $I->switchToPreviousTab(2); |
||
| 2992 | * ``` |
||
| 2993 | * |
||
| 2994 | * Can't be used with PhantomJS |
||
| 2995 | * |
||
| 2996 | * @param int $offset 1 |
||
| 2997 | * @see \Codeception\Module\WebDriver::switchToPreviousTab() |
||
| 2998 | */ |
||
| 2999 | public function switchToPreviousTab($offset = null) { |
||
| 3002 | |||
| 3003 | |||
| 3004 | /** |
||
| 3005 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3006 | * |
||
| 3007 | * Waits for element and runs a sequence of actions inside its context. |
||
| 3008 | * Actions can be defined with array, callback, or `Codeception\Util\ActionSequence` instance. |
||
| 3009 | * |
||
| 3010 | * Actions as array are recommended for simple to combine "waitForElement" with assertions; |
||
| 3011 | * `waitForElement($el)` and `see('text', $el)` can be simplified to: |
||
| 3012 | * |
||
| 3013 | * ```php |
||
| 3014 | * <?php |
||
| 3015 | * $I->performOn($el, ['see' => 'text']); |
||
| 3016 | * ``` |
||
| 3017 | * |
||
| 3018 | * List of actions can be pragmatically build using `Codeception\Util\ActionSequence`: |
||
| 3019 | * |
||
| 3020 | * ```php |
||
| 3021 | * <?php |
||
| 3022 | * $I->performOn('.model', ActionSequence::build() |
||
| 3023 | * ->see('Warning') |
||
| 3024 | * ->see('Are you sure you want to delete this?') |
||
| 3025 | * ->click('Yes') |
||
| 3026 | * ); |
||
| 3027 | * ``` |
||
| 3028 | * |
||
| 3029 | * Actions executed from array or ActionSequence will print debug output for actions, and adds an action name to |
||
| 3030 | * exception on failure. |
||
| 3031 | * |
||
| 3032 | * Whenever you need to define more actions a callback can be used. A WebDriver module is passed for argument: |
||
| 3033 | * |
||
| 3034 | * ```php |
||
| 3035 | * <?php |
||
| 3036 | * $I->performOn('.rememberMe', function (WebDriver $I) { |
||
| 3037 | * $I->see('Remember me next time'); |
||
| 3038 | * $I->seeElement('#LoginForm_rememberMe'); |
||
| 3039 | * $I->dontSee('Login'); |
||
| 3040 | * }); |
||
| 3041 | * ``` |
||
| 3042 | * |
||
| 3043 | * In 3rd argument you can set number a seconds to wait for element to appear |
||
| 3044 | * |
||
| 3045 | * @param $element |
||
| 3046 | * @param $actions |
||
| 3047 | * @param int $timeout |
||
| 3048 | * @see \Codeception\Module\WebDriver::performOn() |
||
| 3049 | */ |
||
| 3050 | public function performOn($element, $actions, $timeout = null) { |
||
| 3053 | |||
| 3054 | |||
| 3055 | /** |
||
| 3056 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3057 | * |
||
| 3058 | * |
||
| 3059 | * @see \hipanel\tests\_support\Helper\CredentialsProvider::getClientCredentials() |
||
| 3060 | */ |
||
| 3061 | public function getClientCredentials() { |
||
| 3064 | |||
| 3065 | |||
| 3066 | /** |
||
| 3067 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3068 | * |
||
| 3069 | * |
||
| 3070 | * @see \hipanel\tests\_support\Helper\CredentialsProvider::getSellerCredentials() |
||
| 3071 | */ |
||
| 3072 | public function getSellerCredentials() { |
||
| 3075 | |||
| 3076 | |||
| 3077 | /** |
||
| 3078 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3079 | * |
||
| 3080 | * |
||
| 3081 | * @see \hipanel\tests\_support\Helper\CredentialsProvider::getManagerCredentials() |
||
| 3082 | */ |
||
| 3083 | public function getManagerCredentials() { |
||
| 3086 | |||
| 3087 | |||
| 3088 | /** |
||
| 3089 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3090 | * |
||
| 3091 | * |
||
| 3092 | * @see \hipanel\tests\_support\Helper\CredentialsProvider::getAdminCredentials() |
||
| 3093 | */ |
||
| 3094 | public function getAdminCredentials() { |
||
| 3097 | |||
| 3098 | |||
| 3099 | /** |
||
| 3100 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3101 | * |
||
| 3102 | * |
||
| 3103 | * @see \hipanel\tests\_support\Helper\CredentialsProvider::restartBrowser() |
||
| 3104 | */ |
||
| 3105 | public function restartBrowser() { |
||
| 3108 | |||
| 3109 | |||
| 3110 | /** |
||
| 3111 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3112 | * |
||
| 3113 | * |
||
| 3114 | * @see \hipanel\tests\_support\Helper\CredentialsProvider::needPage() |
||
| 3115 | */ |
||
| 3116 | public function needPage($url) { |
||
| 3119 | |||
| 3120 | |||
| 3121 | /** |
||
| 3122 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3123 | * |
||
| 3124 | * |
||
| 3125 | * @see \hipanel\tests\_support\Helper\CredentialsProvider::storeSession() |
||
| 3126 | */ |
||
| 3127 | public function storeSession($name) { |
||
| 3130 | |||
| 3131 | |||
| 3132 | /** |
||
| 3133 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3134 | * |
||
| 3135 | * |
||
| 3136 | * @see \hipanel\tests\_support\Helper\CredentialsProvider::retrieveSession() |
||
| 3137 | */ |
||
| 3138 | public function retrieveSession($name) { |
||
| 3141 | |||
| 3142 | |||
| 3143 | /** |
||
| 3144 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3145 | * |
||
| 3146 | * |
||
| 3147 | * @see \hipanel\tests\_support\Helper\PnotifyHelper::closeNotification() |
||
| 3148 | */ |
||
| 3149 | public function closeNotification($text) { |
||
| 3152 | |||
| 3153 | |||
| 3154 | /** |
||
| 3155 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3156 | * |
||
| 3157 | * @param $textOnButton |
||
| 3158 | * @throws \Codeception\Exception\ModuleException |
||
| 3159 | * @see \hipanel\tests\_support\Helper\PressButtonHelper::pressButton() |
||
| 3160 | */ |
||
| 3161 | public function pressButton($textOnButton) { |
||
| 3164 | |||
| 3165 | |||
| 3166 | /** |
||
| 3167 | * [!] Method is generated. Documentation taken from corresponding module. |
||
| 3168 | * |
||
| 3169 | * @param int $timeOut |
||
| 3170 | * @throws \Codeception\Exception\ModuleException |
||
| 3171 | * @see \hipanel\tests\_support\Helper\PressButtonHelper::waitForPageUpdate() |
||
| 3172 | */ |
||
| 3173 | public function waitForPageUpdate($timeOut = null) { |
||
| 3176 | } |
||
| 3177 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.