Ran Spark script for screenshots.
This commit is contained in:
@ -6,14 +6,14 @@ import glob
|
|||||||
import os
|
import os
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
|
# 2aed7eac-321f-4ba2-9ee8-7f8c90006459
|
||||||
BASEURL = "https://walmart.northpass.com/app/courses/"
|
BASEURL = "https://walmart.northpass.com/app/courses/"
|
||||||
USERID = "?uid=7beg87y4-fh24-4929-3rt5-24kdn87s5241"
|
USERID = "?uid=7beg87y4-fh24-4929-3rt5-24kdn87s5241"
|
||||||
COURSEID = sys.argv[1]
|
COURSEID = sys.argv[1]
|
||||||
DIR = "./"
|
DIR = "./"
|
||||||
|
|
||||||
def run(playwright: Playwright):
|
def run(playwright: Playwright):
|
||||||
print("running")
|
print("Launching Playwright")
|
||||||
webkit = playwright.webkit
|
webkit = playwright.webkit
|
||||||
browser = webkit.launch()
|
browser = webkit.launch()
|
||||||
context = browser.new_context(
|
context = browser.new_context(
|
||||||
@ -29,16 +29,17 @@ def run(playwright: Playwright):
|
|||||||
|
|
||||||
# Extract all hrefs from the course outline
|
# 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)')
|
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:")
|
print("Course outline links:")
|
||||||
for idx, link in enumerate(course_links):
|
for idx, link in enumerate(course_links):
|
||||||
screen_num += 1
|
screen_num += 1
|
||||||
print(f"{idx + 1}. {link}")
|
print(f"The Activity URL is: {idx + 1}. {link}")
|
||||||
page.goto(f"{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()
|
browser.close()
|
||||||
# find_pictures()
|
find_pictures(DIR)
|
||||||
|
|
||||||
|
|
||||||
def find_pictures(DIR):
|
def find_pictures(DIR):
|
||||||
|
|||||||
Reference in New Issue
Block a user