当我调用表单帖子时我没有得到登录应该是因为输入名称就像数组,例如logn [username]和login [passwords]这就是为什么我不接受有一些方法来发送数组输入的名称?或者使用输入ID吗?
start_urls = ['https://b2b.fluidra.es/customer/account/login']
def parse(self, response):
yield scrapy.FormRequest.from_response(
response,
formxpath='//form[@id="login-form"]',
formdata={
'login[username]': 'MISUSER@USER.COM',
'login[password]': 'XXXXXXXXXX'
},
callback=self.start_requests_action
)
<form action="https://b2b.fluidra.es/customer/account/loginPost/referer/aHR0cDovL2IyYi5mbHVpZHJhLmVzL2Nhc2NhZGEtc2lsa2Zsb3cuaHRtbA,,/" method="post" id="login-form">
<div class="fieldset">
<div class="col2-set">
<div class="col-1 registered-users">
<h2 class="legend">Clientes registrados</h2>
<p>Si tienes una cuenta con nosotros, accede usando tu dirección de email.</p>
<ul class="form-list">
<li>
<label for="email" class="required"><em>*</em>Dirección de email</label>
<div class="input-box">
<input name="login[username]" value="" id="email" class="input-text required-entry validate-email" title="Dirección de email" type="text">
</div>
</li>
<li>
<label for="pass" class="required"><em>*</em>Contraseña</label>
<div class="input-box">
<input name="login[password]" class="input-text required-entry validate-password" id="pass" title="Contraseña" type="password">
</div>
</li>
<li class="note">
<a href="https://b2b.fluidra.es/customer/account/forgotpassword/">¿Olvidaste tu contraseña?</a>
</li>
<li class="buttons-set">
<button type="submit" class="button" name="send" id="send2"><span><span>Entrar</span></span></button>
</li>
</ul>
<p class="required">* Campos requeridos</p>
<script type="text/javascript">
//<![CDATA[
var showTooltip = function() {
this.rememberTip = new Enterprise.Widget.Dialog(
'¿Qué es esto?',
'<p>Checking "Remember Me" will let you access your shopping cart on this computer when you are logged out</p>'+
'<div class="buttons-set"><button type="button" class="button btn-close"><span><span>Cerrar</span></span></button></div>',
'popup-remember-tip'
),
$(this.rememberTip.getContent()).select('button.btn-close')[0].onclick = this.rememberTip.hide.bind(this.rememberTip);
this.rememberTip.show();
return false;
}
document.observe("dom:loaded", function() {
$$('#remember-me-box a').each(function(element) {
Event.observe(element, 'click', showTooltip);
});
});
//]]>
</script>
</div>
<div class="col-2 new-users">
<h2 class="legend">Nuevos clientes</h2>
<p>Sólo usuarios registrados pueden ver precios, realizar pedidos y consultar el estado de estos en nuestra tienda. Para registrarte deberás rellenar el formulario que aparece tras hacer click en Registrarse.</p>
<div class="buttons-set">
<button type="button" class="button" onclick="window.location='https://b2b.fluidra.es/customer/account/create/';"><span><span>Registrarse</span></span></button>
</div>
</div>
</div>
</div>
<div class="masque">
<img src="https://b2b.fluidra.es/skin/frontend/default/fluidra/images/bg_items_product1.png" alt="">
</div>
</form>