Reputation: 109
I'm trying to fill the inputs of a form:
<form name="step_one_login_form" action="/" method="post">
<input type="hidden" name="form_name" value="step_one_login_form">
<input type="hidden" name="return_url" value="index.php?
<div id="haveaccount" style="display:block;">
<div class="panel_login">
<div class="panel_login_row">
<div class="panel_login_fieldname">
<label for="login_checkout" class="cm-required cm-trim cm-email">Email:</label>
<span class="panel_login_fieldabout">(Required)</span>
</div>
<div class="panel_login_field">
**<input type="text" id="login_checkout" name="user_login" size="30" value=""class="panel_login_textbox">**
Since the class or id of the form is not given, I don't understand the way to do it.
Upvotes: 3
Views: 6411
Reputation: 3811
Since it has the name
attribute, you can reference it with that.
casper.fill('form[name="step_one_login_form"]', {
'user_login': 'USER_NAME'
});
You could also use the Casper#fillSelectors
method:
casper.fillSelectors('form[name="step_one_login_form"]', {
'#login_checkout': 'USER_NAME'
});
Upvotes: 7