Skip to content

Commit

Permalink
fix ->select()ing random elements (#822)
Browse files Browse the repository at this point in the history
only choose a random element from a `<select>` input if no second parameter is passed
  • Loading branch information
browner12 authored Sep 29, 2020
1 parent 7877ff2 commit 15ae198
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Concerns/InteractsWithElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function select($field, $value = null)

$options = $element->findElements(WebDriverBy::cssSelector('option:not([disabled])'));

if (is_null($value)) {
if (func_num_args() === 1) {
$options[array_rand($options)]->click();
} else {
if (is_bool($value)) {
Expand Down

0 comments on commit 15ae198

Please sign in to comment.