Support multiple account for details operation

This commit is contained in:
Florent 2012-08-27 14:54:50 +02:00
commit adce6d0c83
4 changed files with 59 additions and 45 deletions

View file

@ -30,18 +30,16 @@ class HomePage(BasePage):
def get_list(self):
l = []
divabo = self.document.xpath('//div[@class="idAbonne pointer"]')[0]
owner = unicode(divabo.xpath('p')[0].text.replace(' - ', ''))
phone = unicode(divabo.xpath('p/span')[0].text)
self.browser.logger.debug('Found ' + owner + ' has subscriber')
self.browser.logger.debug('Found ' + phone + ' has phone number')
phoneplan = unicode(self.document.xpath('//div[@class="forfaitChoisi"]')[0].text.lstrip().rstrip())
self.browser.logger.debug('Found ' + phoneplan + ' has subscription type')
for divabo in self.document.xpath('//div[@class="idAbonne pointer"]'):
owner = unicode(divabo.xpath('p')[0].text.replace(' - ', ''))
phone = unicode(divabo.xpath('p/span')[0].text)
self.browser.logger.debug('Found ' + owner + ' as subscriber')
self.browser.logger.debug('Found ' + phone + ' as phone number')
phoneplan = unicode(self.document.xpath('//div[@class="forfaitChoisi"]')[0].text.lstrip().rstrip())
self.browser.logger.debug('Found ' + phoneplan + ' as subscription type')
subscription = Subscription(phone)
subscription.label = phone + ' - ' + phoneplan
subscription.subscriber = owner
subscription = Subscription(phone)
subscription.label = phone + ' - ' + phoneplan
subscription.subscriber = owner
l.append(subscription)
return l
yield subscription