fixing captcha

This commit is contained in:
Vincent Paredes 2015-08-25 17:52:57 +02:00 committed by Romain Bignon
commit 85cbefaca4

View file

@ -62,7 +62,7 @@ class LoginPage(Page):
self.browser.controls.append(ClientForm.TextControl('text', 'ads_token_js', {'value': ''}))
code = ''.join(self.document.xpath('//script[contains(text(), "autosubmit")]/text()'))
code = re.sub('if \(autosubmit.*', '', code)
code = re.search('(function .*)try', code).group(1)
js = Javascript(code)
func_name = re.search(r'function (\w+)\(e\)', code).group(1)
self.browser['ads_token_js'] = str(js.call(func_name, self.browser['ads_token']))