vendredi 1 février 2019

laravel dusk random select prevent the first option

This is a select

<select id='fruit' name='fruit'>
    <option value="">please select one fruit</option>
    <option value="apple">apple</option>
    <option value="banana">banana</option>
    <option value="orange">orange</option>
</select>

This is my test

/** @test  */
public function form_test()
{
    $this->browse(function (Browser $browser) {
        $browser->select('fruit');
    }
}

When I testing the form, I need to random select fruit but not the first "please select one fruit" element, but when I use ->select(), sometimes it select the first "please select one fruit" element, is there a way to prevent?

Aucun commentaire:

Enregistrer un commentaire