Skip to content

Commit bedccba

Browse files
authored
Merge pull request #405 from aik099/setvalue-checkbox-validation-feat
Throw exception, when doing a "setValue" call on checkbox with a non-boolean value
2 parents 0f020ab + 246de2a commit bedccba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Selenium2Driver.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,11 @@ public function setValue(string $xpath, $value)
787787
}
788788

789789
if ('checkbox' === $elementType) {
790-
if ($element->selected() xor (bool) $value) {
790+
if (!is_bool($value)) {
791+
throw new DriverException('Only boolean values can be used for a checkbox input.');
792+
}
793+
794+
if ($element->selected() xor $value) {
791795
$this->clickOnElement($element);
792796
}
793797

0 commit comments

Comments
 (0)