Facebook\WebDriver\Exception\ElementNotVisibleException: element not interactable

1.7k Views Asked by At

I have to test using dusk and I have this tag for 3 times

<div class="form-group">
    <input type="email" name="email[]" class="form-control" placeholder="Enter teammate's email">
</div>
<div class="form-group">
    <input type="email" name="email[]" class="form-control" placeholder="Enter teammate's email">
</div>
<div class="form-group">
    <input type="email" name="email[]" class="form-control" placeholder="Enter teammate's email">
</div>

and I tried these to run it

->type('input[name=email[]]', $userEmail)->type('email[]', $userEmail)->type('input[type=email]', $userEmail)

but not working what is the correct one to type the email ??

1

There are 1 best solutions below

0
Jonas Staudenmeir On

The first option doesn't work because of the square brackets. You need to wrap the name in double quotes:

->type('input[name="email[]"]', $userEmail)

You can also use the second option:

->type('email[]', $userEmail)

Typing in all three inputs requires a loop:

foreach ($browser->elements('input[name="email[]"]') as $element) {
    $element->sendKeys($userEmail);
}