Skip to content

Instantly share code, notes, and snippets.

@TirolJPN
Last active July 24, 2019 15:46
Show Gist options
  • Save TirolJPN/3d7f715fdad95858d356e3173a7dd6f0 to your computer and use it in GitHub Desktop.
Save TirolJPN/3d7f715fdad95858d356e3173a7dd6f0 to your computer and use it in GitHub Desktop.
# PythonでSeleniumのwebdriverモジュールをインポート
from selenium import webdriver
from selenium.webdriver.support.select import Select
from selenium.webdriver.chrome.options import Options
# 操作するブラウザを開く
# e.g. /Users/Kenta/Desktop/Selenium/chromedriver
options = webdriver.ChromeOptions()
# options.add_argument('--kiosk')
driver = webdriver.Chrome('../selenium/chromedriver',chrome_options=options)
# 操作するページを開き、操作
# step1
driver.get('http://localhost:8888/eccube-4.0.2/install/step1')
driver.find_element_by_class_name('btn-primary').click()
# step2
driver.find_element_by_class_name('btn-primary').click()
# step3
driver.find_element_by_id('install_step3_shop_name').send_keys('MySQL')
driver.find_element_by_id('install_step3_email').send_keys('test@test.com')
driver.find_element_by_id('install_step3_login_id').send_keys('admin')
driver.find_element_by_id('install_step3_login_pass').send_keys('password')
driver.find_element_by_id('install_step3_admin_dir').send_keys('test')
# SSL制限はhttps経由でなければチェックボックスを押せない
driver.find_element_by_xpath("//input[@id='install_step3_admin_force_ssl']").click()
driver.find_element_by_class_name('btn-primary').click()
# step4
Select(driver.find_element_by_id('install_step4_database')).select_by_value('pdo_mysql')
driver.find_element_by_id('install_step4_database_host').send_keys('localhost')
driver.find_element_by_id('install_step4_database_port').send_keys('3306')
driver.find_element_by_id('install_step4_database_name').send_keys('eccube_402')
driver.find_element_by_id('install_step4_database_user').send_keys('root')
driver.find_element_by_id('install_step4_database_password').send_keys('root')
driver.find_element_by_class_name('btn-primary').click()
# step5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment