Ran Spark script for screenshots.

This commit is contained in:
Norm Rasmussen
2025-10-24 14:54:00 -04:00
parent e74a528c04
commit 6b802300ec

View File

@ -6,14 +6,14 @@ import glob
import os
from datetime import date
# 2aed7eac-321f-4ba2-9ee8-7f8c90006459
BASEURL = "https://walmart.northpass.com/app/courses/"
USERID = "?uid=7beg87y4-fh24-4929-3rt5-24kdn87s5241"
COURSEID = sys.argv[1]
DIR = "./"
def run(playwright: Playwright):
print("running")
print("Launching Playwright")
webkit = playwright.webkit
browser = webkit.launch()
context = browser.new_context(
@ -29,16 +29,17 @@ def run(playwright: Playwright):
# Extract all hrefs from the course outline
course_links = page.locator('.np-course-outline-content-section a').evaluate_all('elements => elements.map(el => el.href)')
page.screenshot(path=f"{DIR}-{course_name}_{screen_num}.png", full_page=True)
page.screenshot(path=f"{DIR}{course_name}_{screen_num}.png", full_page=True)
print("Course outline links:")
for idx, link in enumerate(course_links):
screen_num += 1
print(f"{idx + 1}. {link}")
print(f"The Activity URL is: {idx + 1}. {link}")
page.goto(f"{link}")
page.screenshot(path=f"{DIR}-{course_name}_{screen_num}.png", full_page=True)
page.screenshot(path=f"{DIR}{course_name}_{screen_num}.png", full_page=True)
print(f"The filename and path is: {DIR}{course_name}_{screen_num}.png")
browser.close()
# find_pictures()
find_pictures(DIR)
def find_pictures(DIR):