# coding: utf8
from setting import (
    SCODOC_ADMIN_ID,
    SCODOC_ADMIN_PASS,
    SCHEMA,
    SCODOC_SERVER,
    SCODOC_PORT,
    NOM_DPT,
    LINK_SCODOC_SERVER,
    BASE_SSH_URL,
    NAVIGATEUR,
)
from selenium import webdriver

URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"

ACRONYME_FORMATION = "FormationTEST"


def main():
    if NAVIGATEUR == "firefox":
        driver = webdriver.Firefox()
    else:
        driver = webdriver.Chrome()
    auth_page = URL_AUTH + ("?next=" + URL_HOME).replace("/", "%2F")
    driver.get(auth_page)
    driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
    driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
    driver.find_element_by_id("submit").click()
    # driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + "scodoc_admin")
    # time.sleep(2)
    # try:
    #    select = Select(driver.find_element_by_id("delete-dept"))
    #    select.select_by_visible_text(NOM_DPT)
    #    driver.find_element_by_id("delete-dept").submit()
    #    driver.close()
    # except NoSuchElementException:
    driver.close()
