Skip to content

Commit

Permalink
Added support for setHtml()
Browse files Browse the repository at this point in the history
DriverInterface.php updated for use with MinkSelenium2Driver's new setHtml() method.
Element.php updated containing the actual setHtml() method (same location of setValue() method).
  • Loading branch information
J7mbo committed May 6, 2014
1 parent 46c3876 commit 6c7ba08
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Behat/Mink/Driver/DriverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,17 @@ public function getText($xpath);
*/
public function getHtml($xpath);

/**
* Sets element's inner html by it's XPath query
*
* @param string $xpath
* @param string $html
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function setHtml($xpath, $html);

/**
* Returns element's outer html by it's XPath query.
*
Expand Down
12 changes: 12 additions & 0 deletions src/Behat/Mink/Element/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ public function getHtml()
return $this->getSession()->getDriver()->getHtml($this->getXpath());
}

/**
* Sets element innerHTML
*
* @param $html
*
* @return mixed
*/
public function setHtml($html)
{
return $this->getSession()->getDriver()->setHtml($this->getXpath(), $html);
}

/**
* Returns element outer html.
*
Expand Down

0 comments on commit 6c7ba08

Please sign in to comment.