You are here

public function FormManipulationTrait::isChecked in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/jcalderonzumba/mink-phantomjs-driver/src/FormManipulationTrait.php \Zumba\Mink\Driver\FormManipulationTrait::isChecked()

Checks if the radio or checkbox is checked

Parameters

string $xpath:

Return value

bool

Throws

DriverException

File

vendor/jcalderonzumba/mink-phantomjs-driver/src/FormManipulationTrait.php, line 140

Class

FormManipulationTrait
Trait FormManipulationTrait @package Zumba\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

public function isChecked($xpath) {
  $this
    ->findElement($xpath, 1);
  $javascript = $this
    ->javascriptTemplateRender("is_checked.js.twig", array(
    "xpath" => $xpath,
  ));
  $checked = $this->browser
    ->evaluate($javascript);
  if ($checked === null) {
    throw new DriverException("Can not check when the element is not checkbox or radio");
  }
  return $checked;
}