Skip to content

Instantly share code, notes, and snippets.

@gitsper
Created September 9, 2020 19:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitsper/ab23d13936632fd18c379bf33c335d0b to your computer and use it in GitHub Desktop.
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
#!/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