From 45246e2645371804c0d8211eb276c6c63928d06b Mon Sep 17 00:00:00 2001 From: Marco Hermo Date: Mon, 8 Nov 2021 13:25:32 +1300 Subject: [PATCH] Avoids selecting values from other select boxes Using the `$element` as the parent context when selecting options. In this way, we can prevent select choosing options from other select boxes having similar values. --- src/FacebookWebDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FacebookWebDriver.php b/src/FacebookWebDriver.php index 98870c72..0f535754 100755 --- a/src/FacebookWebDriver.php +++ b/src/FacebookWebDriver.php @@ -1152,7 +1152,7 @@ private function selectOptionOnElement(RemoteWebElement $element, $value, $multi $escapedValue = $this->xpathEscaper->escapeLiteral($value); // The value of an option is the normalized version of its text when it has no value attribute $optionQuery = sprintf('.//option[@value = %s or (not(@value) and normalize-space(.) = %s)]', $escapedValue, $escapedValue); - $option = $this->findElement($optionQuery); + $option = $this->findElement($optionQuery, $element); // Avoids selecting values from other select boxes if ($multiple || !$element->getAttribute('multiple')) { if (!$option->isSelected()) {