1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

コロナワクチン予約システムに自動ログインして予約可能会場があったら音を鳴らす

Last updated at Posted at 2021-09-01

#ログインしてチェックボックスにチェックを入れるだけの簡単なコード

##コード

import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import chromedriver_binary

# 接種券番号とか
account = ''
password = ''
# 自治体によってURLが違う
url1 = ''
url2 = f'{url1}department/search'

def login_kakunin():
    driver.get(url1)
    time.sleep(5)
    # login
    id = driver.find_elements_by_class_name("validate-input_input")
    id[0].send_keys(account)
    id[1].send_keys(password)
    chk = driver.find_element_by_xpath("//input[@type='checkbox']")
    chk.click()
    btn = driver.find_element_by_xpath("//button[@type='submit']")
    btn.click()
    iftxt = ""
    while iftxt == "":
        # 接種会場
        driver.get(url2)
        time.sleep(5)
        chk = driver.find_element_by_xpath("//input[@type='checkbox']")
        chk.click()
        time.sleep(5)
        ifText = driver.find_element_by_class_name(
            "page-department-search_nav-header__count")
        if ifText.text == "会場表示: 0件":
            print("空いている会場なし")
            time.sleep(5)
        else:
            iftxt = ifText.text
            print("空いてる会場あり")
   
driver = webdriver.Chrome()

login_kakunin()

##実行

  • 他に方法いくらでもあると思うけど思いついたのだけ

Win

  • else句に入れて音をならす
import winsound
winsound.beep(800, 1000)

Mac

  • シェルで処理する
python hoge.py; say Done
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?