Created
September 9, 2020 19:36
-
-
Save gitsper/ab23d13936632fd18c379bf33c335d0b to your computer and use it in GitHub Desktop.
script that you can hook up to cron or systemd so you don't have to fill out the damn survey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
file : nocovid | |
author : Kacper | |
""" | |
import sys | |
assert sys.version_info.major == 3, 'Tested with python 3, so use that' | |
from webbot import Browser | |
from time import sleep | |
username = '' | |
password = '' | |
badge = '/tmp/badge.png' | |
debug = False | |
print('Filling survey...', end=' ') | |
web = Browser(showWindow=debug) | |
web.go_to('https://patientconnect.bu.edu') | |
web.type(username, id='j_username') | |
web.type(password, id='j_password') | |
web.click('Continue') | |
if not web.exists('Complete Survey'): | |
print('Login failed, check your credentials and try again. ⛔') | |
exit() | |
web.click('Complete Survey') | |
web.click('Continue') | |
web.click('No', multiple=True) | |
web.click('Continue') | |
if not web.exists('Your survey(s) have been submitted successfully'): | |
print('Failed. 👎') | |
exit() | |
print('Success. 👍') | |
print('Saving badge...', end=' ') | |
web.click('Show Badge') | |
web.set_window_rect(width=800, height=1200) | |
sleep(5) | |
if web.save_screenshot(badge): | |
print('badge saved to "%s"' % badge) | |
else: | |
print('could not save badge to "%s"' % badge) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment