raise ExpectedElementNotFound if nb charms not found
This commit is contained in:
parent
f46de51fde
commit
3e8b59dbd0
1 changed files with 2 additions and 5 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from weboob.tools.browser import ExpectedElementNotFound
|
||||||
from weboob.backends.aum.pages.base import PageBase
|
from weboob.backends.aum.pages.base import PageBase
|
||||||
from logging import error
|
from logging import error
|
||||||
|
|
||||||
|
|
@ -39,15 +40,11 @@ class HomePage(PageBase):
|
||||||
tables = self.document.getElementsByTagName('table')
|
tables = self.document.getElementsByTagName('table')
|
||||||
for table in tables:
|
for table in tables:
|
||||||
if table.hasAttribute('style') and table.getAttribute('style') == 'background-color:black;background-image:url(http://s.adopteunmec.com/img/barmec.gif);background-repeat:no-repeat':
|
if table.hasAttribute('style') and table.getAttribute('style') == 'background-color:black;background-image:url(http://s.adopteunmec.com/img/barmec.gif);background-repeat:no-repeat':
|
||||||
|
|
||||||
fonts = table.getElementsByTagName('font')
|
fonts = table.getElementsByTagName('font')
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
for font in fonts:
|
for font in fonts:
|
||||||
if font.hasAttribute('color') and font.getAttribute('color') == '#ff0198':
|
if font.hasAttribute('color') and font.getAttribute('color') == '#ff0198':
|
||||||
i += 1
|
i += 1
|
||||||
if i == 3:
|
if i == 3:
|
||||||
return int(font.firstChild.data)
|
return int(font.firstChild.data)
|
||||||
|
raise ExpectedElementNotFound(u'Could not parse number of charms available')
|
||||||
error('Error: Unable to find the available charms counter')
|
|
||||||
return 0
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue