1
0

More than 1 year has passed since last update.

pytnonでMoodleの出席を自動化させてみた

Posted at

はじめに

今更ではありますが、一年前に書いたコードを紹介したいと思います。
経緯は察してください...

環境

ソフトウェア
  anaconda3 64-bit
  Visual Studio Code
実行環境
  Chrome

ソースコード

anaconda prompt

conda install selenium

python

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import chromedriver_binary
import time
# ブラウザを開く(Chrome)
driver = webdriver.Chrome()
#TOP画面を開く
driver.get("Moodelのリンク")
time.sleep(3)
# ログインボタンをクリック
login_btn = driver.find_element_by_xpath('//*[@id="region-main"]/div/div[2]/div/div/div/div/div/div[2]/div[3]/div/a')
login_btn.click()
#登録してるグーグルメールアドレスを入力
login_id = driver.find_element_by_id("identifierId")
time.sleep(1)
login_id.send_keys("メールアドレス") 
time.sleep(1)
#次へ
element0 = driver.find_element_by_class_name("VfPpkd-RLmnJb")
element0.click()
time.sleep(1)
#パスワード入力
login_pw = driver.find_element_by_name('password')
time.sleep(1)
login_pw.send_keys("パスワード")
#次へ
element0 = driver.find_element_by_class_name("VfPpkd-RLmnJb")
element0.click()
time.sleep(20)
# ブラウザを終了
driver.close()

参考資料
https://aiacademy.jp/media/?p=346

1
0
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
0