Add Template

master
yuuki76 3 years ago
parent 37732f9877
commit 457fd92e55
Signed by: yuuki76
GPG Key ID: 729B523D11F3A8D7

@ -0,0 +1,66 @@
#必ずchromewebdriverをインストールしてから行ってください
#コマンドプロンプトでpip install selenium と打ってseleniumをインストール
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import time
options = Options()
options.add_argument('--disable-gpu');
options.add_argument('--disable-extensions');
options.add_argument('--proxy-server="direct://"');
options.add_argument('--proxy-bypass-list=*');
options.add_argument('--start-maximized');
#options.add_argument('--headless');
#上の行はブラウザを立ち上げずに処理したい場合は#を消してください
DRIVER_PATH = "Path"
#PathにはdriverのPathを
driver = webdriver.Chrome(executable_path=DRIVER_PATH, chrome_options=options)
url = "https://www.tv-asahi.co.jp/apps/apply/post.php?fid=8978"
driver.get(url)
age = driver.find_element_by_name("quest[1]")
age.send_keys("年齢")
#年齢には自分の年齢を数字で
sex = driver.find_element_by_xpath("/html/body/div/form/div[2]/div/span[1]/label/input")
sex.click()
area_element = driver.find_element_by_name("quest[3]")
area_select_element = Select(area_element)
area_select_element.select_by_value("番号")
#番号には1〜47の適当な数字を入れてください
title1 = driver.find_element_by_name("quest[8]")
title1.send_keys("アニメタイトル1")
#アニメタイトル1には好きなアニメタイトル
song1 = driver.find_element_by_name("quest[9]")
song1.send_keys("アニソン1")
#アニソン1にはアニメタイトル1で好きなアニソン
title2 = driver.find_element_by_name("quest[10]")
title2.send_keys("アニメタイトル2")
#アニメタイトル2には好きなアニメタイトル
song2 = driver.find_element_by_name("quest[11]")
song2.send_keys("アニソン2")
#アニソン2にはアニメタイトル2で好きなアニソン
title3 = driver.find_element_by_name("quest[12]")
title3.send_keys("アニメタイトル3")
#アニメタイトル3には好きなアニメタイトル
song3 = driver.find_element_by_name("quest[13]")
song3.send_keys("アニソン3")
#アニソン3にはアニメタイトル3で好きなアニソン
submit_button = driver.find_element_by_xpath("/html/body/div/form/div[10]/input")
submit_button.click()
WebDriverWait(driver, 2)
send_button = driver.find_element_by_xpath("/html/body/form/div/input[1]")
send_button.click()
Loading…
Cancel
Save