ScodocTestClient/suppressionSiteDepartement.py

52 lines
1.3 KiB
Python
Raw Normal View History

# coding: utf8
import unittest
import time
import subprocess
import HtmlTestRunner
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
2021-07-24 08:41:26 +02:00
SCHEMA,
BASE_URL,
NOM_DPT,
LINK_SCODOC_SERVER,
2021-07-24 08:41:26 +02:00
BASE_SSH_URL,
NAVIGATEUR,
)
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.select import Select
2021-07-24 08:41:26 +02:00
URL = SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite"
ACRONYME_FORMATION = "FormationTEST"
def main():
if NAVIGATEUR == "firefox":
driver = webdriver.Firefox()
else:
driver = webdriver.Chrome()
driver.get(
2021-07-24 08:41:26 +02:00
SCHEMA
+ "://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@"
2021-07-24 08:41:26 +02:00
+ BASE_SSH_URL
+ "force_admin_authentication"
)
2021-07-24 08:41:26 +02:00
driver.get(SCHEMA + "://" + BASE_URL + "scodoc_admin")
time.sleep(2)
try:
2021-06-25 00:45:50 +02:00
select = Select(driver.find_element_by_id("delete-dept"))
select.select_by_visible_text(NOM_DPT)
2021-06-25 00:45:50 +02:00
driver.find_element_by_id("delete-dept").submit()
driver.close()
except NoSuchElementException:
driver.close()