/** * Ensures the element is a checkbox * * @param Element $element * @param string $xpath * @param string $type * @param string $action * * @throws DriverException */ private function ensureInputType(Element $element, $xpath, $type, $action) { if ('input' !== strtolower($element->name()) || $type !== strtolower($element->attribute('type'))) { $message = 'Impossible to %s the element with XPath "%s" as it is not a %s input'; throw new DriverException(sprintf($message, $action, $xpath, $type)); } }