I have elements in a page as follows:
<input name="birth_date" autocomplete="off" value="12/09/2022">
<input name="birth_date" autocomplete="off" value="12/09/2022">
and I want to enter data on the first element with that name.
I would like to avoid xpath.
I have tried:
$browser->type('input[name=\'birth_date\']:first','12/10/2022');
$browser->type("input[name='birth_date']:first",'12/10/2022');
but keep getting invalid selector: An invalid or illegal selector was specified.
CodePudding user response:
You can try with this selector:
input[name="birth_date"]:first-of-type
With your code could be something like:
$browser->type('input[name="birth_date"]:first-of-type','12/10/2022');