Skip to content

Commit

Permalink
Avoids selecting values from other select boxes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Marco Hermo authored and emteknetnz committed Nov 8, 2021
1 parent 59aaf02 commit 45246e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/FacebookWebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 45246e2

Please sign in to comment.