chore: minor cleanup

This commit is contained in:
eneller
2025-07-02 09:38:21 +02:00
parent 47a9c5fa2b
commit 95d26a1e97
2 changed files with 6 additions and 3 deletions

View File

@@ -8,8 +8,10 @@ from enum import Enum
import csv import csv
from uulm_utils.common import cli, browser_options, run_playwright from uulm_utils.common import cli, browser_options, run_playwright
Selection = Enum('Selection', ['TREE_WALK', 'TREE_LEAF', 'ITEM_SELECTED']) Selection = Enum('Selection', ['TREE_WALK', 'TREE_LEAF', 'ITEM_SELECTED'])
CAMPUSONLINE_LOC = 'li.treelist > a' CAMPUSONLINE_LOC = 'li.treelist > a'
CAMPUSONLINE_URL = 'https://campusonline.uni-ulm.de'
async def selection_or_walk(locators: list[Locator]): async def selection_or_walk(locators: list[Locator]):
option_walk = questionary.Choice(title= 'Walk the Tree from here', value=Selection.TREE_WALK, checked=True) option_walk = questionary.Choice(title= 'Walk the Tree from here', value=Selection.TREE_WALK, checked=True)
@@ -41,7 +43,7 @@ async def campusonline(filename, username, password, headless):
async for browser, context in run_playwright(headless): async for browser, context in run_playwright(headless):
page = await context.new_page() page = await context.new_page()
# login # login
await page.goto("https://campusonline.uni-ulm.de") await page.goto(CAMPUSONLINE_URL)
await page.get_by_role("textbox", name="Benutzerkennung").click() await page.get_by_role("textbox", name="Benutzerkennung").click()
await page.get_by_role("textbox", name="Benutzerkennung").fill(username) await page.get_by_role("textbox", name="Benutzerkennung").fill(username)
await page.get_by_role("textbox", name="Passwort").fill(password) await page.get_by_role("textbox", name="Passwort").fill(password)

View File

@@ -6,6 +6,8 @@ from typing import cast
from uulm_utils.common import cli, fcfs_options, browser_options, run_playwright, logger from uulm_utils.common import cli, fcfs_options, browser_options, run_playwright, logger
CORONANG_VERSION='v1.8.00'
CORONANG_URL="https://campusonline.uni-ulm.de/CoronaNG/user/mycorona.html"
@cli.command() @cli.command()
@fcfs_options @fcfs_options
@@ -16,8 +18,6 @@ async def coronang(target_times, username, password, headless, offset):
Automatically register for courses on CoronaNG by specifying one or more timestamps of the format "HH:MM:SS". Automatically register for courses on CoronaNG by specifying one or more timestamps of the format "HH:MM:SS".
Please beware that CoronaNG only allows one active session at all times. Please beware that CoronaNG only allows one active session at all times.
''' '''
CORONANG_VERSION='v1.8.00'
CORONANG_URL="https://campusonline.uni-ulm.de/CoronaNG/user/mycorona.html"
logger.debug('Parsed input times as %s', target_times) logger.debug('Parsed input times as %s', target_times)
before_seconds = timedelta(seconds=offset) before_seconds = timedelta(seconds=offset)
target_times = sorted(list(target_times)) target_times = sorted(list(target_times))
@@ -64,6 +64,7 @@ async def coronang(target_times, username, password, headless, offset):
await page.get_by_role("table", name="Ihre Beobachtungen. Sie kö").get_by_role("button").click() await page.get_by_role("table", name="Ihre Beobachtungen. Sie kö").get_by_role("button").click()
await page.get_by_role("table", name="Ihre Beobachtungen. Sie kö").get_by_role("combobox").select_option("5") await page.get_by_role("table", name="Ihre Beobachtungen. Sie kö").get_by_role("combobox").select_option("5")
await page.get_by_role("cell", name="An Markierten teilnehmen Ausf").get_by_role("button").click() await page.get_by_role("cell", name="An Markierten teilnehmen Ausf").get_by_role("button").click()
#async with page.expect_response()
await page.reload() await page.reload()
# window ended? # window ended?
# check window of offset before and after target # check window of offset before and after target