Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Help refresh the Walgreens covid vaccine appointment page

UserScript for refreshing the Walgreens covid vaccine appointment page

Please note that you must be eligible to get the vaccine. If you are not eligible for the vaccine, this will not help you. In that case the only thing you can do is try showing up at the end of the day at a vaccination site to see if they have any leftovers that need to be used up.

This script will check a box stating that you are elligible according to your state.


  1. Install the TamperMonkey extension.
  2. Add these scripts.
  3. Check that the script is running on the walgreens page by clicking on the TaperMonkey extension icon. Note that it will only run on the pages mentioned after the @match metadata.
  4. Enter your location into the search box


This is a WIP. It is fragile: if Walgreens changes anything about their page it might fail. There are two problems with the script:

  • memory usage: I believe the Walgreens site has memory leaks and that continually cycling through it will eventually cause OOM errors
  • logout: this script will attempt to detect when you are logged out and reload the page but this is not entirely reliable

If you have problems, start by looking at the logging statement this script produces (you will want to remove most log levels to reduce the Walgreens output).

Once an appointment is available it just stops and shows an alert. Currently it will compare the appointment date to the date April 12, which was a day of increased eligiibility.

You will probably still benefit from using an additional tool such as to send you an additional email alert when appointments are available.

The script is set to wait 20 seconds after clicking a button that changes the page.

// ==UserScript==
// @namespace
// @name walgreens-covid
// @version 1
// @grant GM_getValue
// @grant GM_setValue
// @run-at document-end
// @match
// @match
// @match
// ==/UserScript==
'use strict';
var minDayOfMonth = 12;
var delay = 10000;
var unavailable = function(){
var a = document.querySelector('#wag-body-main-container .ApptScreens');
return !a || !!a.textContent.match(/unavailable|not available/);
function available(){
let available = visibleTextNextAvailable().match(/with available appointments/);
if (available) {
return available;
// Also can look for a button: Show Map
function notify(){
var msg = "READY!";
let date = document.querySelector(".main-content .text-center");
if (date) {
var dparse = Date.parse(document.querySelector(".main-content .text-center").textContent);
var d = new Date();
if (d.getDate() < minDayOfMonth) {
var nextDate = document.querySelector("a.nextDate");
if (nextDate) {
if (nextDate.attributes["aria-disabled"]) {
msg = "too early!";
} else {;
} else {
var timeSlot = document.querySelector(".timeSlot");;
var confirm = document.querySelector(".confirmDoseTimeslots");
msg = "BOOKED!";
msg += " " + d.toDateString();
function scheduleOrSearch() {
var button = document.querySelector('#wag-body-main-container .common-container button')
if (button) {
Array.from(document.querySelectorAll('.FirstDose_radio')).filter((n) => n.textContent.match(/No/)).map((n) => n.querySelector("input").click());
// var contBtn = document.getElementById("continueBtn");
if (button.attributes.class.textContent.match(/btn__disabled/)) {
console.log("scheduleOrSearch button disabled");
console.log("scheduleOrSearch clicked button");;
} else {
console.log("scheduleOrSearch no button");
function visibleTextNextAvailable() {
let nextAvailable = document.querySelector('#wag-body-main-container .nextAvailability');
return nextAvailable ? Array.from(nextAvailable.childNodes).filter((e) => !== "none").map((e) => e.textContent).join() : ""
function checkBackSoon(){
var result = visibleTextNextAvailable().match(/check back soon/)
if (result) {
return result
function goBack() {
document.querySelectorAll('#wag-body-main-container button').forEach(function(e){
e.textContent == "Back" &&;
function serviceUnavailableReload(){
if (e.textContent.match(/ervice unavailable/)) {
console.log("ServiceUnavailableReload: unavailable so reloading");
} else if (e.textContent.match(/ppointments unavailable/)) {
console.log("unavailable: no appointments");
window.stopCheck = false;
function check(){
if (window.stopCheck) {
if (available()) { notify(); return }
if (checkBackSoon()) {
} else {
// There is also slert__green
var nextStep = document.querySelector(".nextStep a");
if (nextStep) {
console.log("click Next Step");
else {
return setTimeout(check, delay);
console.log("Starting Tampermonkey script");
// ==UserScript==
// @name Walgreens-eligibility
// @namespace
// @version 0.1
// @description try to take over the world!
// @author You
// @match
// @match
// @match
// @match
// @icon
// @grant none
// ==/UserScript==
(function() {
'use strict';
function takeSurvey(){
var survey = document.querySelector('.state-screeningsurvey');
if (survey) {
if (survey.textContent.match(/See if you're eligible/)) {
Array.from(document.querySelectorAll(".sv_q_radiogroup")).filter((n) => n.textContent.match(/meet my county/))[0].querySelector('input').click();
var covidScreen = document.querySelector('.covid-survey-wrapper .heading');
if (covidScreen) {
if (covidScreen.textContent.match(/COVID-19 Vaccination Screening/)) {
Array.from(document.querySelectorAll('label.sv_q_radiogroup_control_item')).filter((n) => n.textContent.match(/No/)).map((n) => n.querySelector("input").click())
// next page
document.querySelector('.button-agree a').click()
}, 20000)
var agree = document.querySelector('.button-agree a');
if (agree) {;
console.log("Starting Tampermonkey script");
setTimeout(takeSurvey, 10000);
// Your code here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment