You are here

protected function FormManipulationTrait::inputCheckableControl 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::inputCheckableControl()

Check control over an input element of radio or checkbox type

Parameters

$xpath:

Return value

bool

Throws

DriverException

2 calls to FormManipulationTrait::inputCheckableControl()
FormManipulationTrait::check in vendor/jcalderonzumba/mink-phantomjs-driver/src/FormManipulationTrait.php
We click on the checkbox or radio when possible and needed
FormManipulationTrait::uncheck in vendor/jcalderonzumba/mink-phantomjs-driver/src/FormManipulationTrait.php
We click on the checkbox or radio when possible and needed

File

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

Class

FormManipulationTrait
Trait FormManipulationTrait @package Zumba\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

protected function inputCheckableControl($xpath) {
  $element = $this
    ->findElement($xpath, 1);
  $tagName = strtolower($this->browser
    ->tagName($element["page_id"], $element["ids"][0]));
  $attributes = $this->browser
    ->attributes($element["page_id"], $element["ids"][0]);
  if ($tagName != "input") {
    throw new DriverException("Can not check when the element is not of the input type");
  }
  if (!in_array($attributes["type"], array(
    "checkbox",
    "radio",
  ))) {
    throw new DriverException("Can not check when the element is not checkbox or radio");
  }
  return true;
}