executeInSelenium(function(\WebDriver\Session $webdriver) {
* $webdriver->back();
* });
* ```
*
* Use [WebDriver Session API](https://github.com/facebook/php-webdriver)
* Not recommended this command too be used on regular basis.
* If Codeception lacks important Selenium methods implement then and submit patches.
*
* @param callable $function
* @see Codeception\Module\Selenium2::executeInSelenium()
* @return \Codeception\Maybe
*/
public function executeInSelenium($function) {
$this->scenario->addStep(new \Codeception\Step\Action('executeInSelenium', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This 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
* 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');
* ?>
* ```
* @param $link
* @param $context
* @see Codeception\Module\Selenium2::click()
* @return \Codeception\Maybe
*/
public function click($link, $context = null, $strict = null) {
$this->scenario->addStep(new \Codeception\Step\Action('click', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Accept alert or confirm popup
*
* Example:
* ``` php
* click('Show alert popup');
* $I->acceptPopup();
*
* ```
* @see Codeception\Module\Selenium2::acceptPopup()
* @return \Codeception\Maybe
*/
public function acceptPopup() {
$this->scenario->addStep(new \Codeception\Step\Action('acceptPopup', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Dismiss alert or confirm popup
*
* Example:
* ``` php
* click('Show confirm popup');
* $I->cancelPopup();
*
* ```
* @see Codeception\Module\Selenium2::cancelPopup()
* @return \Codeception\Maybe
*/
public function cancelPopup() {
$this->scenario->addStep(new \Codeception\Step\Action('cancelPopup', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks if popup contains the $text
*
* Example:
* ``` php
* click('Show alert popup');
* $I->seeInPopup('Error message');
*
* ```
*
* @param string $text
* Conditional Assertion: Test won't be stopped on fail
* @see Codeception\Module\Selenium2::seeInPopup()
* @return \Codeception\Maybe
*/
public function canSeeInPopup($text) {
$this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInPopup', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Checks if popup contains the $text
*
* Example:
* ``` php
* click('Show alert popup');
* $I->seeInPopup('Error message');
*
* ```
*
* @param string $text
* @see Codeception\Module\Selenium2::seeInPopup()
* @return \Codeception\Maybe
*/
public function seeInPopup($text) {
$this->scenario->addStep(new \Codeception\Step\Assertion('seeInPopup', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Check if popup don't contains the $text
*
* Example:
* ``` php
* click();
* $I->dontSeeInPopup('Error message');
*
* ```
*
* @param string $text
* Conditional Assertion: Test won't be stopped on fail
* @see Codeception\Module\Selenium2::dontSeeInPopup()
* @return \Codeception\Maybe
*/
public function cantSeeInPopup($text) {
$this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPopup', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Check if popup don't contains the $text
*
* Example:
* ``` php
* click();
* $I->dontSeeInPopup('Error message');
*
* ```
*
* @param string $text
* @see Codeception\Module\Selenium2::dontSeeInPopup()
* @return \Codeception\Maybe
*/
public function dontSeeInPopup($text) {
$this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInPopup', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Switch to another window identified by its name.
*
* The window can only be identified by its name. If the $name parameter is blank it will switch to the parent window.
*
* Example:
* ``` html
*
* ```
*
* ``` php
* click("Open window");
* # switch to another window
* $I->switchToWindow("another_window");
* # switch to parent window
* $I->switchToWindow();
* ?>
* ```
*
* If the window has no name, the only way to access it is via the `executeInSelenium()` method like so:
*
* ```
* executeInSelenium(function (\Webdriver\Session $webdriver) {
* $handles=$webdriver->window_handles();
* $last_window = end($handles);
* $webdriver->focusWindow($last_window);
* });
* ?>
* ```
*
* @param string|null $name
* @see Codeception\Module\Selenium2::switchToWindow()
* @return \Codeception\Maybe
*/
public function switchToWindow($name = null) {
$this->scenario->addStep(new \Codeception\Step\Action('switchToWindow', func_get_args()));
if ($this->scenario->running()) {
$result = $this->scenario->runStep();
return new Maybe($result);
}
return new Maybe();
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
* Switch to another frame
*
* Example:
* ``` html
*