简体   繁体   中英

Laravel dusk how to click select option dynamic

i am having problem with clicking select option in laravel dusk

select option is not fixed I want to click from start to end

$browser->click('#js-select-variant-7');
$options = $browser->elements('#js-select-variant-7 option');
foreach ($options as $index => $option) {
   $option->click();
   sleep(5);
}

thanks all;

You should first define the values or get them from the database.

$values = [23, 24, 25, 26];
foreach ($values as $value) {
   $browser
       ->select('#js-select-variant-7', $value)
       ->pause(5000);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM