squibby
1235
4
Testing

Selecting elements in Laravel Dusk

Posted 2 years ago by squibby

I'm struggling to select certain elemets in Laravel Dusk. In paticular I have some checkboxes which are hidden that are recreated and styled in js/css.

My HTML is something like below.

<div class="mt-checkbox-inline">
    <label class="mt-checkbox">
            <input id="broadcast_check" type="checkbox" name="options[]" value="broadcast"> BROADCAST
             <span></span>
     </label>

      <label class="mt-checkbox">
             <input id="document_check" type="checkbox" name="options[]" value="document"> DOCUMENTS
             <span></span>
     </label>
        
                                        
     <div class="errorbox"></div>
 </div>

I want to be able to programmatically check the checkboxes.

I get error:

Facebook\WebDriver\Exception\UnknownServerException: unknown error: Element <input id="broadcast_check" type="checkbox" name="options[]" value="broadcast"> is not clickable at point (190, 375). Other element would receive the click: <label class="mt-checkbox">...</label>

I have tried various options:

->check('options[]','broadcast')
->check('#broadcast_check')
->check('broadcast')

How can I go about selecting elements in dusk?

Please sign in or create an account to participate in this conversation.