4 * This file is part of the Mink package.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Mink\Exception;
13 use Behat\Mink\Driver\DriverInterface;
14 use Behat\Mink\Element\Element;
15 use Behat\Mink\Session;
18 * Exception thrown when an expectation on the HTML of an element fails.
20 * @author Konstantin Kudryashov <ever.zet@gmail.com>
22 class ElementHtmlException extends ExpectationException
32 * Initializes exception.
34 * @param string $message optional message
35 * @param DriverInterface|Session $driver driver instance
36 * @param Element $element element
37 * @param \Exception $exception expectation exception
39 public function __construct($message, $driver, Element $element, \Exception $exception = null)
41 $this->element = $element;
43 parent::__construct($message, $driver, $exception);
46 protected function getContext()
48 return $this->element->getOuterHtml();