doumao6048 2019-05-21 13:07
浏览 169

Facebook \ WebDriver \ Exception \ ElementNotVisibleException:元素不可交互

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条回答 默认 最新

  • doutang7415 2019-05-21 22:44
    关注

    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);
    }
    
    评论

报告相同问题?