1

我必须使用黄昏进行测试,我有这个标签 3 次

<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>

我试过这些来运行它

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

但不工作 输入电子邮件的正确方法是什么?

4

1 回答 1

0

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);
}
于 2019-05-21T22:44:38.263 回答