【python】【selenium】~seleniumでmaimaiでらっくすNETを自動化~
スポンサーリンク
KeyKです。
せっかくpython + seleniumでサンプルを動かしたので、今日は試しにmaimaiでらっくすNETを開いてみます。
Sample Programm
セガIDとパスワードをmaimaiでらっくすNETのものにするとアクセスできます。20秒ほど待つと、MASTERのランクを見られるページまで勝手に進みます。
import time from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains driver = webdriver.Chrome() driver.get('https://maimaidx.jp/maimai-mobile/') driver.maximize_window() time.sleep(2) search_box = driver.find_element_by_name("segaId") search_box.send_keys('SEGA ID') time.sleep(2) search_box = driver.find_element_by_name("password") search_box.send_keys('PASSWORD') search_box.submit() time.sleep(2) driver.find_element_by_xpath("/html/body/div[2]/div[2]/form/button").click() time.sleep(2) driver.find_element_by_xpath("/html/body/div[2]/header/div/div[2]/a[1]").click() time.sleep(2) driver.find_element_by_xpath("/html/body/div[2]/div[1]/a[2]").click() time.sleep(2) driver.find_element_by_xpath("/html/body/div[2]/div[3]/div/form/div/button[4]").click() time.sleep(2) element = driver.find_element_by_xpath("/html/body/div[2]/div[8]") actions = ActionChains(driver) actions.move_to_element(element) actions.perform()