Stud.IP  4.2 Revision
WebGuy Class Reference
Inheritance diagram for WebGuy:
Inheritance graph
Collaboration diagram for WebGuy:
Collaboration graph

Public Member Functions

 setHeader ($header, $value)
 
 amHttpAuthenticated ($username, $password)
 
 amOnUrl ($url)
 
 amOnSubdomain ($subdomain)
 
 executeInGuzzle ($function)
 
 amOnPage ($page)
 
 click ($link, $context=null)
 
 canSee ($text, $selector=null)
 
 see ($text, $selector=null)
 
 cantSee ($text, $selector=null)
 
 dontSee ($text, $selector=null)
 
 canSeeLink ($text, $url=null)
 
 seeLink ($text, $url=null)
 
 cantSeeLink ($text, $url=null)
 
 dontSeeLink ($text, $url=null)
 
 canSeeInCurrentUrl ($uri)
 
 seeInCurrentUrl ($uri)
 
 cantSeeInCurrentUrl ($uri)
 
 dontSeeInCurrentUrl ($uri)
 
 canSeeCurrentUrlEquals ($uri)
 
 seeCurrentUrlEquals ($uri)
 
 cantSeeCurrentUrlEquals ($uri)
 
 dontSeeCurrentUrlEquals ($uri)
 
 canSeeCurrentUrlMatches ($uri)
 
 seeCurrentUrlMatches ($uri)
 
 cantSeeCurrentUrlMatches ($uri)
 
 dontSeeCurrentUrlMatches ($uri)
 
 grabFromCurrentUrl ($uri=null)
 
=agree]');

[!] Method is generated. Documentation taken from corresponding module.

Assert if the specified checkbox is checked. Use css selector or xpath to match.

Example:

<?php
$I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
$I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
$I->seeCheckboxIsChecked('//form/input[@type=checkbox and
?>
Parameters
$checkbox
See also
::seeCheckboxIsChecked()
 canSeeCheckboxIsChecked ($checkbox)
 
 seeCheckboxIsChecked ($checkbox)
 
 cantSeeCheckboxIsChecked ($checkbox)
 
 dontSeeCheckboxIsChecked ($checkbox)
 
=search]','Search');

[!] Method is generated. Documentation taken from corresponding module.

Checks that an input field or textarea doesn't contain value. Field is matched either by label or CSS or Xpath Example:

<?php
$I->dontSeeInField('Body','Type your comment here');
$I->dontSeeInField('form textarea[name=body]','Type your comment here');
$I->dontSeeInField('form input[type=hidden]','hidden_value');
$I->dontSeeInField('#searchform input','Search');
$I->dontSeeInField('//form/*[
$I->seeInField(['name' => 'search'], 'Search');
?>
Parameters
$field
$value
See also
::dontSeeInField()
 canSeeInField ($field, $value)
 
 seeInField ($field, $value)
 
 cantSeeInField ($field, $value)
 
 dontSeeInField ($field, $value)
 
 submitForm ($selector, $params, $button=null)
 
 fillField ($field, $value)
 
=account]', 'Monthly');

[!] Method is generated. Documentation taken from corresponding module.

Selects an option in select tag or in radio button group.

Example:

<?php
$I->selectOption('form select[name=account]', 'Premium');
$I->selectOption('form input[name=payment]', 'Monthly');
$I->selectOption('//form/select[
?>

Can select multiple options if second argument is array:

<?php
$I->selectOption('Which OS do you use?', array('Windows','Linux'));
?>
Parameters
$select
$option
See also
::selectOption()
 selectOption ($select, $option)
 
 checkOption ($option)
 
 uncheckOption ($option)
 
 attachFile ($field, $filename)
 
 sendAjaxGetRequest ($uri, $params=null)
 
 sendAjaxPostRequest ($uri, $params=null)
 
 sendAjaxRequest ($method, $uri, $params=null)
 
 grabTextFrom ($cssOrXPathOrRegex)
 
 grabAttributeFrom ($cssOrXpath, $attribute)
 
 grabValueFrom ($field)
 
 setCookie ($name, $val)
 
 grabCookie ($name)
 
 canSeeCookie ($name)
 
 seeCookie ($name)
 
 cantSeeCookie ($name)
 
 dontSeeCookie ($name)
 
 resetCookie ($name)
 
 canSeeElement ($selector, $attributes=null)
 
 seeElement ($selector, $attributes=null)
 
 cantSeeElement ($selector, $attributes=null)
 
 dontSeeElement ($selector, $attributes=null)
 
 canSeeNumberOfElements ($selector, $expected)
 
 seeNumberOfElements ($selector, $expected)
 
 canSeeOptionIsSelected ($select, $optionText)
 
 seeOptionIsSelected ($select, $optionText)
 
 cantSeeOptionIsSelected ($select, $optionText)
 
 dontSeeOptionIsSelected ($select, $optionText)
 
 canSeePageNotFound ()
 
 seePageNotFound ()
 
 canSeeResponseCodeIs ($code)
 
 seeResponseCodeIs ($code)
 
 canSeeInTitle ($title)
 
 seeInTitle ($title)
 
 cantSeeInTitle ($title)
 
 dontSeeInTitle ($title)
 

Detailed Description

Inherited Methods void wantToTest($text) void wantTo($text) void execute($callable) void expectTo($prediction) void expect($prediction) void amGoingTo($argumentation) void am($role) void lookForwardTo($achieveValue) void comment($description) void haveFriend($name, $actorClass = null)

Member Function Documentation

◆ amHttpAuthenticated()

amHttpAuthenticated (   $username,
  $password 
)

[!] Method is generated. Documentation taken from corresponding module.

Authenticates user for HTTP_AUTH

Parameters
$username
$password
See also
::amHttpAuthenticated()

◆ amOnPage()

amOnPage (   $page)

[!] Method is generated. Documentation taken from corresponding module.

Opens the page. Requires relative uri as parameter

Example:

<?php
// opens front page
$I->amOnPage('/');
// opens /register page
$I->amOnPage('/register');
?>
Parameters
$page
See also
::amOnPage()

◆ amOnSubdomain()

amOnSubdomain (   $subdomain)

[!] Method is generated. Documentation taken from corresponding module.

Sets 'url' configuration parameter to hosts subdomain. It does not open a page on subdomain. Use amOnPage for that

<?php
// If config is: 'http://mysite.com'
// or config is: 'http://www.mysite.com'
// or config is: 'http://company.mysite.com'
$I->amOnSubdomain('user');
$I->amOnPage('/');
// moves to http://user.mysite.com/
?>
Parameters
$subdomain
Returns
mixed
See also
::amOnSubdomain()

◆ amOnUrl()

amOnUrl (   $url)

[!] Method is generated. Documentation taken from corresponding module.

Open web page at absolute URL. Base url will be reconfigured to use the host of provided Url.

<?php
$I->amOnUrl('http://codeception.com');
$I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart
?>
See also
::amOnUrl()

◆ attachFile()

attachFile (   $field,
  $filename 
)

[!] Method is generated. Documentation taken from corresponding module.

Attaches file from Codeception data directory to upload field.

Example:

<?php
// file is stored in 'tests/_data/prices.xls'
$I->attachFile('input[@type="file"]', 'prices.xls');
?>
Parameters
$field
$filename
See also
::attachFile()

◆ canSee()

canSee (   $text,
  $selector = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Check if current page contains the text specified. Specify the css selector to match only specific region.

Examples:

<?php
$I->see('Logout'); // I can suppose user is logged in
$I->see('Sign Up','h1'); // I can suppose it's a signup page
$I->see('Sign Up','//body/h1'); // with XPath
?>
Parameters
$text
null$selectorConditional Assertion: Test won't be stopped on fail
See also
::see()

◆ canSeeCheckboxIsChecked()

canSeeCheckboxIsChecked (   $checkbox)

◆ canSeeCookie()

canSeeCookie (   $name)

[!] Method is generated. Documentation taken from corresponding module.

Checks that cookie is set.

Parameters
$cookie
Returns
mixed Conditional Assertion: Test won't be stopped on fail
See also
::seeCookie()

◆ canSeeCurrentUrlEquals()

canSeeCurrentUrlEquals (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current url is equal to value. Unlike seeInCurrentUrl performs a strict check.

<?php
// to match root url
$I->seeCurrentUrlEquals('/');
?>
Parameters
$uriConditional Assertion: Test won't be stopped on fail
See also
::seeCurrentUrlEquals()

◆ canSeeCurrentUrlMatches()

canSeeCurrentUrlMatches (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current url is matches a RegEx value

<?php
// to match root url
$I->seeCurrentUrlMatches('~$/users/(\d+)~');
?>
Parameters
$uriConditional Assertion: Test won't be stopped on fail
See also
::seeCurrentUrlMatches()

◆ canSeeElement()

canSeeElement (   $selector,
  $attributes = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if element exists on a page, matching it by CSS or XPath. You can also specify expected attributes of this element.

<?php
$I->seeElement('.error');
$I->seeElement('//form/input[1]');
$I->seeElement('input', ['name' => 'login']);
$I->seeElement('input', ['value' => '123456']);
// strict locator in first arg, attributes in second
$I->seeElement(['css' => 'form input'], ['name' => 'login']);
?>
Parameters
$selector
array$attributes
Returns
Conditional Assertion: Test won't be stopped on fail
See also
::seeElement()

◆ canSeeInCurrentUrl()

canSeeInCurrentUrl (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current uri contains a value

<?php
// to match: /home/dashboard
$I->seeInCurrentUrl('home');
// to match: /users/1
$I->seeInCurrentUrl('/users/');
?>
Parameters
$uriConditional Assertion: Test won't be stopped on fail
See also
::seeInCurrentUrl()

◆ canSeeInField()

canSeeInField (   $field,
  $value 
)

◆ canSeeInTitle()

canSeeInTitle (   $title)

[!] Method is generated. Documentation taken from corresponding module.

Checks that page title contains text.

<?php
$I->seeInTitle('Blog - Post #1');
?>
Parameters
$title
Returns
mixed Conditional Assertion: Test won't be stopped on fail
See also
::seeInTitle()

◆ canSeeLink()

canSeeLink (   $text,
  $url = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if there is a link with text specified. Specify url to match link with exact this url.

Examples:

<?php
$I->seeLink('Logout'); // matches <a href="#">Logout</a>
$I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
?>
Parameters
$text
null$urlConditional Assertion: Test won't be stopped on fail
See also
::seeLink()

◆ canSeeNumberOfElements()

canSeeNumberOfElements (   $selector,
  $expected 
)

[!] Method is generated. Documentation taken from corresponding module.

Tests number of $elements on page

<?php
$I->seeNumberOfElements('tr', 10);
$I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
?>
Parameters
$selector
mixed$expected,
  • string: strict number
  • array: range of numbers [0,10] Conditional Assertion: Test won't be stopped on fail
See also
::seeNumberOfElements()

◆ canSeeOptionIsSelected()

canSeeOptionIsSelected (   $select,
  $optionText 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if option is selected in select field.

<?php
$I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
?>
Parameters
$selector
$optionText
Returns
mixed Conditional Assertion: Test won't be stopped on fail
See also
::seeOptionIsSelected()

◆ canSeePageNotFound()

canSeePageNotFound ( )

[!] Method is generated. Documentation taken from corresponding module.

Asserts that current page has 404 response status code. Conditional Assertion: Test won't be stopped on fail

See also
::seePageNotFound()

◆ canSeeResponseCodeIs()

canSeeResponseCodeIs (   $code)

[!] Method is generated. Documentation taken from corresponding module.

Checks that response code is equal to value provided.

Parameters
$code
Returns
mixed Conditional Assertion: Test won't be stopped on fail
See also
::seeResponseCodeIs()

◆ cantSee()

cantSee (   $text,
  $selector = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Check if current page doesn't contain the text specified. Specify the css selector to match only specific region.

Examples:

<?php
$I->dontSee('Login'); // I can suppose user is already logged in
$I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
$I->dontSee('Sign Up','//body/h1'); // with XPath
?>
Parameters
$text
null$selectorConditional Assertion: Test won't be stopped on fail
See also
::dontSee()

◆ cantSeeCheckboxIsChecked()

cantSeeCheckboxIsChecked (   $checkbox)

[!] Method is generated. Documentation taken from corresponding module.

Assert if the specified checkbox is unchecked. Use css selector or xpath to match.

Example:

<?php
$I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
$I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
?>
Parameters
$checkboxConditional Assertion: Test won't be stopped on fail
See also
::dontSeeCheckboxIsChecked()

◆ cantSeeCookie()

cantSeeCookie (   $name)

[!] Method is generated. Documentation taken from corresponding module.

Checks that cookie doesn't exist

Parameters
$cookie
Returns
mixed Conditional Assertion: Test won't be stopped on fail
See also
::dontSeeCookie()

◆ cantSeeCurrentUrlEquals()

cantSeeCurrentUrlEquals (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current url is not equal to value. Unlike dontSeeInCurrentUrl performs a strict check.

<?php
// current url is not root
$I->dontSeeCurrentUrlEquals('/');
?>
Parameters
$uriConditional Assertion: Test won't be stopped on fail
See also
::dontSeeCurrentUrlEquals()

◆ cantSeeCurrentUrlMatches()

cantSeeCurrentUrlMatches (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current url does not match a RegEx value

<?php
// to match root url
$I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
?>
Parameters
$uriConditional Assertion: Test won't be stopped on fail
See also
::dontSeeCurrentUrlMatches()

◆ cantSeeElement()

cantSeeElement (   $selector,
  $attributes = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath You can also specify expected attributes of this element.

Example:

<?php
$I->dontSeeElement('.error');
$I->dontSeeElement('//form/input[1]');
$I->dontSeeElement('input', ['name' => 'login']);
$I->dontSeeElement('input', ['value' => '123456']);
?>
Parameters
$selectorConditional Assertion: Test won't be stopped on fail
See also
::dontSeeElement()

◆ cantSeeInCurrentUrl()

cantSeeInCurrentUrl (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current uri does not contain a value

<?php
$I->dontSeeInCurrentUrl('/users/');
?>
Parameters
$uriConditional Assertion: Test won't be stopped on fail
See also
::dontSeeInCurrentUrl()

◆ cantSeeInField()

cantSeeInField (   $field,
  $value 
)

◆ cantSeeInTitle()

cantSeeInTitle (   $title)

[!] Method is generated. Documentation taken from corresponding module.

Checks that page title does not contain text.

Parameters
$title
Returns
mixed Conditional Assertion: Test won't be stopped on fail
See also
::dontSeeInTitle()

◆ cantSeeLink()

cantSeeLink (   $text,
  $url = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if page doesn't contain the link with text specified. Specify url to narrow the results.

Examples:

<?php
$I->dontSeeLink('Logout'); // I suppose user is not logged in
?>
Parameters
$text
null$urlConditional Assertion: Test won't be stopped on fail
See also
::dontSeeLink()

◆ cantSeeOptionIsSelected()

cantSeeOptionIsSelected (   $select,
  $optionText 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if option is not selected in select field.

<?php
$I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
?>
Parameters
$selector
$optionText
Returns
mixed Conditional Assertion: Test won't be stopped on fail
See also
::dontSeeOptionIsSelected()

◆ checkOption()

checkOption (   $option)

[!] Method is generated. Documentation taken from corresponding module.

Ticks a checkbox. For radio buttons use selectOption method.

Example:

<?php
$I->checkOption('#agree');
?>
Parameters
$option
See also
::checkOption()

◆ click()

click (   $link,
  $context = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Perform a click on link or button. Link or button are found by their names or CSS selector. Submits a form if button is a submit type.

If link is an image it's found by alt attribute value of image. If button is image button is found by it's value If link or button can't be found by name they are searched by CSS selector.

The second parameter is a context: CSS or XPath locator to narrow the search.

Examples:

<?php
// simple link
$I->click('Logout');
// button of form
$I->click('Submit');
// CSS button
$I->click('#form input[type=submit]');
// XPath
$I->click('//form/*[@type=submit]');
// link in context
$I->click('Logout', '#nav');
// using strict locator
$I->click(['link' => 'Login']);
?>
Parameters
$link
$context
See also
::click()

◆ dontSee()

dontSee (   $text,
  $selector = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Check if current page doesn't contain the text specified. Specify the css selector to match only specific region.

Examples:

<?php
$I->dontSee('Login'); // I can suppose user is already logged in
$I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
$I->dontSee('Sign Up','//body/h1'); // with XPath
?>
Parameters
$text
null$selector
See also
::dontSee()

◆ dontSeeCheckboxIsChecked()

dontSeeCheckboxIsChecked (   $checkbox)

[!] Method is generated. Documentation taken from corresponding module.

Assert if the specified checkbox is unchecked. Use css selector or xpath to match.

Example:

<?php
$I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
$I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
?>
Parameters
$checkbox
See also
::dontSeeCheckboxIsChecked()

◆ dontSeeCookie()

dontSeeCookie (   $name)

[!] Method is generated. Documentation taken from corresponding module.

Checks that cookie doesn't exist

Parameters
$cookie
Returns
mixed
See also
::dontSeeCookie()

◆ dontSeeCurrentUrlEquals()

dontSeeCurrentUrlEquals (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current url is not equal to value. Unlike dontSeeInCurrentUrl performs a strict check.

<?php
// current url is not root
$I->dontSeeCurrentUrlEquals('/');
?>
Parameters
$uri
See also
::dontSeeCurrentUrlEquals()

◆ dontSeeCurrentUrlMatches()

dontSeeCurrentUrlMatches (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current url does not match a RegEx value

<?php
// to match root url
$I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
?>
Parameters
$uri
See also
::dontSeeCurrentUrlMatches()

◆ dontSeeElement()

dontSeeElement (   $selector,
  $attributes = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath You can also specify expected attributes of this element.

Example:

<?php
$I->dontSeeElement('.error');
$I->dontSeeElement('//form/input[1]');
$I->dontSeeElement('input', ['name' => 'login']);
$I->dontSeeElement('input', ['value' => '123456']);
?>
Parameters
$selector
See also
::dontSeeElement()

◆ dontSeeInCurrentUrl()

dontSeeInCurrentUrl (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current uri does not contain a value

<?php
$I->dontSeeInCurrentUrl('/users/');
?>
Parameters
$uri
See also
::dontSeeInCurrentUrl()

◆ dontSeeInField()

dontSeeInField (   $field,
  $value 
)

◆ dontSeeInTitle()

dontSeeInTitle (   $title)

[!] Method is generated. Documentation taken from corresponding module.

Checks that page title does not contain text.

Parameters
$title
Returns
mixed
See also
::dontSeeInTitle()

◆ dontSeeLink()

dontSeeLink (   $text,
  $url = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if page doesn't contain the link with text specified. Specify url to narrow the results.

Examples:

<?php
$I->dontSeeLink('Logout'); // I suppose user is not logged in
?>
Parameters
$text
null$url
See also
::dontSeeLink()

◆ dontSeeOptionIsSelected()

dontSeeOptionIsSelected (   $select,
  $optionText 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if option is not selected in select field.

<?php
$I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
?>
Parameters
$selector
$optionText
Returns
mixed
See also
::dontSeeOptionIsSelected()

◆ executeInGuzzle()

executeInGuzzle (   $function)

[!] Method is generated. Documentation taken from corresponding module.

Low-level API method. If Codeception commands are not enough, use Guzzle HTTP Client methods directly

Example:

<?php
$I->executeInGuzzle(function (\GuzzleHttp\Client $client) {
$client->get('/get', ['query' => ['foo' => 'bar']]);
});
?>

It is not recommended to use this command on a regular basis. If Codeception lacks important Guzzle Client methods, implement them and submit patches.

Parameters
callable$function
See also
::executeInGuzzle()

◆ fillField()

fillField (   $field,
  $value 
)

[!] Method is generated. Documentation taken from corresponding module.

Fills a text field or textarea with value.

Example:

<?php
$I->fillField("//input[@type='text']", "Hello World!");
$I->fillField(['name' => 'email'], 'jon@mail.com');
?>
Parameters
$field
$value
See also
::fillField()

◆ grabAttributeFrom()

grabAttributeFrom (   $cssOrXpath,
  $attribute 
)

[!] Method is generated. Documentation taken from corresponding module.

Grabs attribute value from an element. Fails if element is not found.

<?php
$I->grabAttributeFrom('#tooltip', 'title');
?>
Parameters
$cssOrXpath
$attribute

◆ grabCookie()

grabCookie (   $name)

[!] Method is generated. Documentation taken from corresponding module.

Grabs a cookie value.

Parameters
$cookie
Returns
mixed
See also
::grabCookie()

◆ grabFromCurrentUrl()

grabFromCurrentUrl (   $uri = null)

[!] Method is generated. Documentation taken from corresponding module.

Takes a parameters from current URI by RegEx. If no url provided returns full URI.

<?php
$user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
$uri = $I->grabFromCurrentUrl();
?>
Parameters
null$uri

◆ grabTextFrom()

grabTextFrom (   $cssOrXPathOrRegex)

[!] Method is generated. Documentation taken from corresponding module.

Finds and returns text contents of element. Element is searched by CSS selector, XPath or matcher by regex.

Example:

<?php
$heading = $I->grabTextFrom('h1');
$heading = $I->grabTextFrom('descendant-or-self::h1');
$value = $I->grabTextFrom('~<input value=(.*?)]~sgi');
?>
Parameters
$cssOrXPathOrRegex
Returns
mixed
See also
::grabTextFrom()

◆ grabValueFrom()

grabValueFrom (   $field)

[!] Method is generated. Documentation taken from corresponding module.

Parameters
$field
Returns
array|mixed|null|string
See also
::grabValueFrom()

◆ resetCookie()

resetCookie (   $name)

[!] Method is generated. Documentation taken from corresponding module.

Unsets cookie

Parameters
$cookie
Returns
mixed
See also
::resetCookie()

◆ see()

see (   $text,
  $selector = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Check if current page contains the text specified. Specify the css selector to match only specific region.

Examples:

<?php
$I->see('Logout'); // I can suppose user is logged in
$I->see('Sign Up','h1'); // I can suppose it's a signup page
$I->see('Sign Up','//body/h1'); // with XPath
?>
Parameters
$text
null$selector
See also
::see()

◆ seeCheckboxIsChecked()

seeCheckboxIsChecked (   $checkbox)

◆ seeCookie()

seeCookie (   $name)

[!] Method is generated. Documentation taken from corresponding module.

Checks that cookie is set.

Parameters
$cookie
Returns
mixed
See also
::seeCookie()

◆ seeCurrentUrlEquals()

seeCurrentUrlEquals (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current url is equal to value. Unlike seeInCurrentUrl performs a strict check.

<?php
// to match root url
$I->seeCurrentUrlEquals('/');
?>
Parameters
$uri
See also
::seeCurrentUrlEquals()

◆ seeCurrentUrlMatches()

seeCurrentUrlMatches (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current url is matches a RegEx value

<?php
// to match root url
$I->seeCurrentUrlMatches('~$/users/(\d+)~');
?>
Parameters
$uri
See also
::seeCurrentUrlMatches()

◆ seeElement()

seeElement (   $selector,
  $attributes = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if element exists on a page, matching it by CSS or XPath. You can also specify expected attributes of this element.

<?php
$I->seeElement('.error');
$I->seeElement('//form/input[1]');
$I->seeElement('input', ['name' => 'login']);
$I->seeElement('input', ['value' => '123456']);
// strict locator in first arg, attributes in second
$I->seeElement(['css' => 'form input'], ['name' => 'login']);
?>
Parameters
$selector
array$attributes
Returns
See also
::seeElement()

◆ seeInCurrentUrl()

seeInCurrentUrl (   $uri)

[!] Method is generated. Documentation taken from corresponding module.

Checks that current uri contains a value

<?php
// to match: /home/dashboard
$I->seeInCurrentUrl('home');
// to match: /users/1
$I->seeInCurrentUrl('/users/');
?>
Parameters
$uri
See also
::seeInCurrentUrl()

◆ seeInField()

seeInField (   $field,
  $value 
)

◆ seeInTitle()

seeInTitle (   $title)

[!] Method is generated. Documentation taken from corresponding module.

Checks that page title contains text.

<?php
$I->seeInTitle('Blog - Post #1');
?>
Parameters
$title
Returns
mixed
See also
::seeInTitle()

◆ seeLink()

seeLink (   $text,
  $url = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if there is a link with text specified. Specify url to match link with exact this url.

Examples:

<?php
$I->seeLink('Logout'); // matches <a href="#">Logout</a>
$I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
?>
Parameters
$text
null$url
See also
::seeLink()

◆ seeNumberOfElements()

seeNumberOfElements (   $selector,
  $expected 
)

[!] Method is generated. Documentation taken from corresponding module.

Tests number of $elements on page

<?php
$I->seeNumberOfElements('tr', 10);
$I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
?>
Parameters
$selector
mixed$expected,
  • string: strict number
  • array: range of numbers [0,10]
See also
::seeNumberOfElements()

◆ seeOptionIsSelected()

seeOptionIsSelected (   $select,
  $optionText 
)

[!] Method is generated. Documentation taken from corresponding module.

Checks if option is selected in select field.

<?php
$I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
?>
Parameters
$selector
$optionText
Returns
mixed
See also
::seeOptionIsSelected()

◆ seePageNotFound()

seePageNotFound ( )

[!] Method is generated. Documentation taken from corresponding module.

Asserts that current page has 404 response status code.

See also
::seePageNotFound()

◆ seeResponseCodeIs()

seeResponseCodeIs (   $code)

[!] Method is generated. Documentation taken from corresponding module.

Checks that response code is equal to value provided.

Parameters
$code
Returns
mixed
See also
::seeResponseCodeIs()

◆ selectOption()

selectOption (   $select,
  $option 
)

◆ sendAjaxGetRequest()

sendAjaxGetRequest (   $uri,
  $params = null 
)

[!] Method is generated. Documentation taken from corresponding module.

If your page triggers an ajax request, you can perform it manually. This action sends a GET ajax request with specified params.

See ->sendAjaxPostRequest for examples.

Parameters
$uri
$params
See also
::sendAjaxGetRequest()

◆ sendAjaxPostRequest()

sendAjaxPostRequest (   $uri,
  $params = null 
)

[!] Method is generated. Documentation taken from corresponding module.

If your page triggers an ajax request, you can perform it manually. This action sends a POST ajax request with specified params. Additional params can be passed as array.

Example:

Imagine that by clicking checkbox you trigger ajax request which updates user settings. We emulate that click by running this ajax request manually.

<?php
$I->sendAjaxPostRequest('/updateSettings', array('notifications' => true)); // POST
$I->sendAjaxGetRequest('/updateSettings', array('notifications' => true)); // GET
Parameters
$uri
$params
See also
::sendAjaxPostRequest()

◆ sendAjaxRequest()

sendAjaxRequest (   $method,
  $uri,
  $params = null 
)

[!] Method is generated. Documentation taken from corresponding module.

If your page triggers an ajax request, you can perform it manually. This action sends an ajax request with specified method and params.

Example:

You need to perform an ajax request specifying the HTTP method.

<?php
$I->sendAjaxRequest('PUT', '/posts/7', array('title' => 'new title'));
Parameters
$method
$uri
$params
See also
::sendAjaxRequest()

◆ setCookie()

setCookie (   $name,
  $val 
)

[!] Method is generated. Documentation taken from corresponding module.

Sets a cookie.

Parameters
$cookie
$value
Returns
mixed
See also
::setCookie()

◆ setHeader()

setHeader (   $header,
  $value 
)

[!] Method is generated. Documentation taken from corresponding module.

See also
::setHeader()

◆ submitForm()

submitForm (   $selector,
  $params,
  $button = null 
)

[!] Method is generated. Documentation taken from corresponding module.

Submits a form located on page. Specify the form by it's css or xpath selector. Fill the form fields values as array.

Skipped fields will be filled by their values from page. You don't need to click the 'Submit' button afterwards. This command itself triggers the request to form's action.

You can optionally specify what button's value to include in the request with the last parameter as an alternative to explicitly setting its value in the second parameter, as button values are not otherwise included in the request.

Examples:

<?php
$I->submitForm('#login', array('login' => 'davert', 'password' => '123456'));
// or
$I->submitForm('#login', array('login' => 'davert', 'password' => '123456'), 'submitButtonName');

For a sample Sign Up form:

<form action="/sign_up">
Login: <input type="text" name="user[login]" /><br/>
Password: <input type="password" name="user[password]" /><br/>
Do you agree to out terms? <input type="checkbox" name="user[agree]" /><br/>
Select pricing plan <select name="plan"><option value="1">Free</option><option value="2" selected="selected">Paid</option></select>
<input type="submit" name="submitButton" value="Submit" />
</form>

You could write the following to submit it:

<?php
$I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)), 'submitButton');

Note that "2" will be the submitted value for the "plan" field, as it is the selected option.

You can also emulate a JavaScript submission by not specifying any buttons in the third parameter to submitForm.

<?php
$I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)));
Parameters
$selector
$params
$button
See also
::submitForm()

◆ uncheckOption()

uncheckOption (   $option)

[!] Method is generated. Documentation taken from corresponding module.

Unticks a checkbox.

Example:

<?php
$I->uncheckOption('#notify');
?>
Parameters
$option
See also
::uncheckOption()

The documentation for this class was generated from the following file: