Skip to content

Commit

Permalink
Add logging for debugging the login form
Browse files Browse the repository at this point in the history
  • Loading branch information
tdryer committed Sep 20, 2016
1 parent 1f31a92 commit 1eaae4c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hangups/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,23 @@ def submit_form(self, form_selector, input_dict):
Raises GoogleAuthError if form can not be submitted.
"""
logger.info(
'Submitting form on page %r', self._page.url.split('?')[0]
)
logger.info(
'Page contains forms: %s',
[elem.get('id') for elem in self._page.soup.select('form')]
)
try:
form = self._page.soup.select(form_selector)[0]
except IndexError:
raise GoogleAuthError(
'Failed to find form {!r} in page'.format(form_selector)
)
logger.info(
'Page contains inputs: %s',
[elem.get('id') for elem in form.select('input')]
)
for selector, value in input_dict.items():
try:
form.select(selector)[0]['value'] = value
Expand Down

0 comments on commit 1eaae4c

Please sign in to comment.