Last active
July 1, 2016 21:01
-
-
Save alnutile/8365634 to your computer and use it in GitHub Desktop.
Dealing with Alerts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @hidden | |
* | |
* @Then /^I click on the alert window$/ | |
*/ | |
public function iClickOnTheAlertWindow() { | |
$this->getMainContext()->getSession()->getDriver()->getWebDriverSession()->accept_alert(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @hidden | |
* | |
* @Then /^I switch to popup by clicking "([^"]*)" and clicking alert$/ | |
*/ | |
public function iSwitchToPopupByClickingAndClickingAlert($arg1) { | |
$originalWindowName = $this->getMainContext()->getSession()->getWindowName(); //Get the original name | |
$this->setMainWindow(); | |
$this->getMainContext()->getSession()->getPage()->clickLink("$arg1"); | |
$this->iClickOnTheAlertWindow(); | |
$popupName = $this->getNewPopup($originalWindowName); | |
//Switch to the popup Window | |
$this->getMainContext()->getSession()->switchToWindow($popupName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment