This is a fork of Stalk-the-DMV.
I'm a college student trying to grab an appointment for a behind-the-wheel test. Unfortunately, appointments are literally booked out three months in advance. There are occasional openings when someone cancels, but these are hard to find and usually snatched up instantly. I went looking for bots online to automate this appointment search for me, but none of them work ever since the DMV deployed a ReCaptcha on the appointment finder page.
To solve this, I integrated the automated captcha-solving extension Buster with Stalk-the-DMV, and added an automatic appointment scheduling feature. This bot will search through a list of DMV offices, logging down available appointments, and if an appointment is within a specified number of days, it'll automatically schedule it for you.
Features:
numDays
(you can adjust this in settings.py
), the bot will schedule the appointment for you.appt_confirmation.png
and registers your phone number for appointment notifications from the DMV.Note: This has only been tested on Mac
Grab your local copy.
git clone https://github.com/jerrylin3321/dmvbuster.git
Install the dependencies, which includes python libraries.
pip install -r requirements.txt
Install ChromeDriver from here. Move the file to the same directory as main.py
and unzip it.
Obtain a slack token. I would create a new Slack workspace, and inside, create a channel called #dmv
for this. Then, create a config file - this should be kept hidden! In the current directory, enter the following:
echo "SLACK_TOKEN='your-token-here'" >> creds.py
Don't forget to replace the string above with your own slack token.
When that is done, open settings.py
and update it with your information.
SLACK_CHANNEL = '#dmv' # this should be the slack channel which you want to send messages to
URL = 'https://www.dmv.ca.gov/wasapp/foa/driveTest.do' # the url for the DMV web form
LOCATIONS = ['WATSONVILLE', 'GILROY', 'CAPITOLA', 'HOLLISTER', 'SALINAS', 'SEASIDE', "LOS BANOS", 'MODESTO']
PROFILE = { 'firstName': 'IAN', 'lastName': 'MCEWAN', 'birthMonth': '06', 'birthDay': '21', 'birthYear': '1948', 'dl_number': 'Y1234567', 'areaCode': '999', 'telPrefix': '123', 'telSuffix': '4567', 'numDays': '14' #If the bot finds an appointment within numDays days, it will schedule the appointment; otherwise, it'll just record it and send to Slack
}
6. Run the bot.
python main.py
## How does this work?
The bot uses Selenium, an automated testing Python library. It iterates through the list of DMV locations given, searching one location every 120 seconds and checking if there are any appointments at the specified location. If there are, it will log this in a database, and send it to a Slack channel. If the appointment is within `numDays`, the bot will schedule it for you, enter your phone number in to receive appointment reminders, and take a screenshot `appt_confirmation.png`.
#### How does it solve Captchas?
It uses Buster, a Chrome extension, to bypass the reCaptcha. Buster uses speech-to-text algorithms to translate the audio reCaptcha into text. However, reCaptcha has algorithms in place that somehow detect the use of Buster. There are three errors you might encounter:
1. ReCaptcha asks you to solve multiple audio captchas. It will say "Multiple solutions required."
2. ReCaptcha will tell you that it has detected automated queries from your computer.
3. It will tell you that it is "unable to connect to reCaptcha."
These are normal. For the first error, the bot will use Buster to solve another reCaptcha. Upon encountering the second or third error, the bot will simply exit the reCaptcha and reattempt a new reCaptcha. The bot will continue to do this until you've successfully reached the appointment finder page. This process may take a while, but eventually, reCaptcha will allow you to access the next page.
Occasionally, there will be a Selenium error not covered by these three cases. In this case, the bot will simply quit this iteration and, after 120 seconds, restart and search the next location.
## Notes
* If you already have an appointment scheduled, this bot will override the appointment! If you've already booked an appointment, you should make sure to set `numDays` correctly so that you can find a closer appointment than your current one.
* I tried running this in headless ChromeDriver, but headless ChromeDriver doesn't support extensions like Buster, which is critical for solving reCaptcha.
* Debugging tips: use the logs. Also, Selenium has a handy screenshot function - use `driver.save_screenshot('debugging.png')`.
#### Usage
This should only be used for personal purposes, not commercial activities. This program's intent is to help individual people book more convenient appointments that other people have canceled. This is not a hack; it simply automates the manual process of checking offices.
I hope you find this helpful! Please let me know if you're having problems getting this to work by raising an issue; I'll do my best to help.