Got the basics of playwright working and taking screenshots! Great first step.
This commit is contained in:
@ -1,2 +1,23 @@
|
|||||||
import re
|
import re
|
||||||
from playwright.sync_api import Page, expect
|
import sys
|
||||||
|
from playwright.sync_api import sync_playwright, Playwright
|
||||||
|
|
||||||
|
def run(playwright: Playwright):
|
||||||
|
print("running")
|
||||||
|
webkit = playwright.webkit
|
||||||
|
browser = webkit.launch()
|
||||||
|
context = browser.new_context()
|
||||||
|
page = context.new_page()
|
||||||
|
BASEURL = "https://walmart.northpass.com/app/courses/"
|
||||||
|
USERID = "?uid=7beg87y4-fh24-4929-3rt5-24kdn87s5241"
|
||||||
|
COURSEID = sys.argv[1]
|
||||||
|
print(COURSEID)
|
||||||
|
print(USERID)
|
||||||
|
example = page.goto(f"{BASEURL}{COURSEID}{USERID}")
|
||||||
|
page.screenshot(path="/Users/normrasmussen/Downloads/screenshot1.png", full_page=True)
|
||||||
|
page.locator('#course-mobile > div.np-top-cta.stick-to-bottom > a').click()
|
||||||
|
page.screenshot(path="/Users/normrasmussen/Downloads/screenshot2.png", full_page=True)
|
||||||
|
browser.close()
|
||||||
|
|
||||||
|
with sync_playwright() as playwright:
|
||||||
|
run(playwright)
|
||||||
|
|||||||
BIN
Scripts/Auto_Scrape_Screenshots/~/Downloads/screenshot.png
Normal file
BIN
Scripts/Auto_Scrape_Screenshots/~/Downloads/screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
Reference in New Issue
Block a user