From 721bf6888034928e9b6a98ea9adb9eb7b1c180ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6der?= Date: Mon, 26 Jan 2026 16:50:23 +0100 Subject: [PATCH] Fix student name lookup. Update gitignore. --- .gitignore | 5 ++++- moodle_quiz_pdf_export.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 69f6bcc..02d12a9 100644 --- a/.gitignore +++ b/.gitignore @@ -168,5 +168,8 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +.DS_Store + pdfs/ -export/ \ No newline at end of file +export/ +/**/*.pdf \ No newline at end of file diff --git a/moodle_quiz_pdf_export.py b/moodle_quiz_pdf_export.py index 4292de0..9a2ba06 100644 --- a/moodle_quiz_pdf_export.py +++ b/moodle_quiz_pdf_export.py @@ -75,8 +75,8 @@ for idx, url in enumerate(attempt_links, start=1): try: # Try to get the student's name near the profile picture - student_name_elem = driver.find_element(By.CSS_SELECTOR, "td.cell a[href*='/user/view.php']") - student_name = student_name_elem.text.strip() + student_name_elem = driver.find_element(By.CLASS_NAME, "userinitials") + student_name = student_name_elem.accessible_name.strip() except NoSuchElementException: # Fallback if name is not found student_name = f"student_{idx}"