From 246de2a31a33c9dc3123713fa09c794fa6210696 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 7 Jan 2025 18:44:56 +0200 Subject: [PATCH] Throw exception, when doing a "setValue" call on checkbox with a non-boolean value --- src/Selenium2Driver.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index db12549a..fe8b1650 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -787,7 +787,11 @@ public function setValue(string $xpath, $value) } if ('checkbox' === $elementType) { - if ($element->selected() xor (bool) $value) { + if (!is_bool($value)) { + throw new DriverException('Only boolean values can be used for a checkbox input.'); + } + + if ($element->selected() xor $value) { $this->clickOnElement($element); }