This is my code:
def parse(self, response):
return scrapy.FormRequest.from_response(
response,
formdata={'uuid': 'user', 'password': 'cons'},
callback=self.after_login
)
def after_login(self, response):
# check login succeed before going on
if "authentication failed" in response.body:
self.log("Login failed", level=log.ERROR)
else:
self.log('LOGGED')
sel = Selector(response)
sel.xpath("//div[@class='amount cSpringGreen']/text()").extract()
But nothing appears when I execute it. The way it should work is after login in a website show that information. The html code is this.
<h1 class="hide2"></h1>
<div id="vodaint-local" class="wrapper rhomb">
<div class="spring">
<script type="text/javascript">
<div class="mod mod-selectsizeheader vodaint-local">
<div id="mivf" class="content">
<div id="navigation-breadcrumb" class="belt">
<div class="belt">
<div class="miVFR">
<div class="mainMiVF cf">
<div class="headerMiVF cf">
<div class="bodyMiVF cf">
<div class="mainNav" style="height: auto;">
<div class="mainContent withHeader" style="height: 585px;">
<style>
<div id="contentSpinner" style="margin-bottom: 432px; display: none;">
<script>
<section>
<script type="text/javascript">
<div class="mainContentContainer home">
<div class="headerBanner">
<script type="text/javascript">
<div class="lineContainer ">
<h6 class="topHeading prepago"> </h6>
<div class="columnGroup cf">
<div class="column newPromo">
<div class="columnContent">
<p class="cTitle"> Tu saldo</p>
--THIS IS THE INFO I WANT TO SHOW--
<div class="amount cSpringGreen">
0,
<span> 96</span>
€
</div>
Thanks!
EDIT: in this pastebin you can find the whole HTML file http://pastebin.com/B2HpACCw the thing that I want to show after the login is "0'96", THANKS!