Skip to content

Instantly share code, notes, and snippets.

@benspargo89
Created August 30, 2020 13:17
Show Gist options
  • Save benspargo89/36da68d6049a3ff71a6acfcbf0f0e174 to your computer and use it in GitHub Desktop.
Save benspargo89/36da68d6049a3ff71a6acfcbf0f0e174 to your computer and use it in GitHub Desktop.
AR Boat License Automation
##I Tested to see if this stil works. The CSS had changed a bit. I updated the xpaths for the login steps, but I don't have any more
##videos to watch so I couldn't check the page continue or the timer find stuff. Pretty easy to help trouble shoot if it doesn't work
##when you try it.
##You'll need Chromedriver in the same path as the python script
##https://chromedriver.storage.googleapis.com/index.html?path=84.0.4147.30/
from bs4 import BeautifulSoup as soup
from selenium import webdriver
import time
url = 'https://www.boat-ed.com/site/login/'
driver= webdriver.Chrome()
html = driver.get(url)
username = driver.find_element_by_xpath('//*[@id="account-username"]')
password = driver.find_element_by_xpath('//*[@id="account-password"]')
username.send_keys("your_username") ## Change this
password.send_keys("your_password") ## and this
driver.find_element_by_xpath('//*[@id="new_account"]/input[3]').click()
html = driver.page_source
page_soup = soup(html, "html.parser")
link = page_soup.findAll("a", {"class":"page continue"})[0].get('href')
link = "https://www.boat-ed.com" + link
driver.get(link)
while True:
try:
driver.find_element_by_xpath('//*[@id="timer_span_next"]').click()
print('Found the link, moving to the next page')
except:
print('Timer still running')
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment