You are here

public function FormManipulationTrait::setValue in Zircon Profile 8

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

Parameters

string $xpath:

string $value:

Throws

DriverException

File

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

Class

FormManipulationTrait
Trait FormManipulationTrait @package Zumba\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

public function setValue($xpath, $value) {
  $this
    ->findElement($xpath, 1);

  //This stuff is BECAUSE the way the driver works for setting values when being checkboxes, radios, etc.
  if (is_bool($value)) {
    $value = $this
      ->boolToString($value);
  }
  $javascript = $this
    ->javascriptTemplateRender("set_value.js.twig", array(
    "xpath" => $xpath,
    "value" => json_encode($value),
  ));
  $this->browser
    ->evaluate($javascript);
}