cli: produce correct HTML5 and fix JS query

This commit is contained in:
Benjamin Dauvergne 2020-10-29 11:29:23 +01:00
parent 3ecce46175
commit 5549ecbf24
1 changed files with 3 additions and 1 deletions

View File

@ -99,9 +99,11 @@ def request(backend, amount, param):
if kind == FORM:
print(what)
with tempfile.NamedTemporaryFile(mode='w', delete=False) as fd:
print('<!doctype html> <html> <head> <meta charset="utf-8"> </head> <body>', file=fd)
print(what, file=fd)
print('''<script>document.getElementsByName('Submit')[0].click()</script>''', file=fd)
print('''<script>document.querySelector('input[type="submit"]').click()</script>''', file=fd)
subprocess.call(['gnome-www-browser', fd.name])
print('</body> <html>', file=fd)
elif kind == URL:
print('Please click on URL:', what)
subprocess.call(['gnome-www-browser', what])