NEW: Adding some Behat steps for css selectors and Dialog confirmation

This commit is contained in:
Kirk Mayo 2014-01-16 15:23:28 +13:00
parent c456dbac5d
commit 4dc379a38a
1 changed files with 26 additions and 0 deletions

View File

@ -345,6 +345,32 @@ JS;
$element->click();
}
/**
* Click on the element with the provided xpath query
*
* @When /^I click on the element with css selector "([^"]*)"$/
*/
public function iClickOnTheElementWithCSSSelector($cssSelector) {
$session = $this->getSession();
$element = $session->getPage()->find(
'xpath',
$session->getSelectorsHandler()->selectorToXpath('css', $cssSelector) // just changed xpath to css
);
if (null === $element) {
throw new \InvalidArgumentException(sprintf('Could not evaluate CSS Selector: "%s"', $cssSelector));
}
$element->click();
}
/**
* @Given /^I click on the element with css selector "([^"]*)", confirming the dialog$/
*/
public function iClickOnTheElementWithCSSSelectorConfirmingTheDialog($cssSelector) {
$this->iClickOnTheElementWithCSSSelector($cssSelector);
$this->iConfirmTheDialog();
}
/**
* @Given /^I type "([^"]*)" into the dialog$/
*/