fix login on accounts with several subaccounts

This commit is contained in:
Romain Bignon 2013-04-01 14:47:11 +02:00
commit 3f5b2c6d41
2 changed files with 31 additions and 7 deletions

View file

@ -18,6 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from mechanize import FormNotFoundError
from decimal import Decimal, InvalidOperation
import re
@ -39,6 +40,25 @@ class LoginPage(BasePage):
class LoginResultPage(BasePage):
def on_loaded(self):
for script in self.document.xpath('//script'):
text = script.text
if text is None:
continue
m = re.search("window.location.replace\('([^']+)'\);", text)
if m:
self.browser.location(m.group(1))
try:
self.browser.select_form(name='banque')
except FormNotFoundError:
pass
else:
self.browser.set_all_readonly(False)
self.browser['typeCompte'] = 'P'
self.browser.submit()
def confirm(self):
self.browser.location('MainAuth?typeDemande=AC', no_login=True)