You are here

public function FormManipulationTrait::isSelected 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::isSelected()

Checks if the option is selected or not

Parameters

string $xpath:

Return value

bool

Throws

DriverException

File

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

Class

FormManipulationTrait
Trait FormManipulationTrait @package Zumba\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

public function isSelected($xpath) {
  $elements = $this
    ->findElement($xpath, 1);
  $javascript = $this
    ->javascriptTemplateRender("is_selected.js.twig", array(
    "xpath" => $xpath,
  ));
  $tagName = $this->browser
    ->tagName($elements["page_id"], $elements["ids"][0]);
  if (strcmp(strtolower($tagName), "option") !== 0) {
    throw new DriverException("Can not assert on element that is not an option");
  }
  return $this->browser
    ->evaluate($javascript);
}