wip: element screenshot
This commit is contained in:
72
.gitignore
vendored
72
.gitignore
vendored
@@ -1,9 +1,74 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,venv,dotenv
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode,venv,dotenv
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/venv,dotenv,python,visualstudiocode,images
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=venv,dotenv,python,visualstudiocode,images
|
||||
|
||||
### dotenv ###
|
||||
.env
|
||||
|
||||
### Images ###
|
||||
# JPEG
|
||||
*.jpg
|
||||
*.jpeg
|
||||
*.jpe
|
||||
*.jif
|
||||
*.jfif
|
||||
*.jfi
|
||||
|
||||
# JPEG 2000
|
||||
*.jp2
|
||||
*.j2k
|
||||
*.jpf
|
||||
*.jpx
|
||||
*.jpm
|
||||
*.mj2
|
||||
|
||||
# JPEG XR
|
||||
*.jxr
|
||||
*.hdp
|
||||
*.wdp
|
||||
|
||||
# Graphics Interchange Format
|
||||
*.gif
|
||||
|
||||
# RAW
|
||||
*.raw
|
||||
|
||||
# Web P
|
||||
*.webp
|
||||
|
||||
# Portable Network Graphics
|
||||
*.png
|
||||
|
||||
# Animated Portable Network Graphics
|
||||
*.apng
|
||||
|
||||
# Multiple-image Network Graphics
|
||||
*.mng
|
||||
|
||||
# Tagged Image File Format
|
||||
*.tiff
|
||||
*.tif
|
||||
|
||||
# Scalable Vector Graphics
|
||||
*.svg
|
||||
*.svgz
|
||||
|
||||
# Portable Document Format
|
||||
*.pdf
|
||||
|
||||
# X BitMap
|
||||
*.xbm
|
||||
|
||||
# BMP
|
||||
*.bmp
|
||||
*.dib
|
||||
|
||||
# ICO
|
||||
*.ico
|
||||
|
||||
# 3D Images
|
||||
*.3dm
|
||||
*.max
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
@@ -206,5 +271,4 @@ pip-selfcheck.json
|
||||
.history
|
||||
.ionide
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,venv,dotenv
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/venv,dotenv,python,visualstudiocode,images
|
||||
|
||||
11
main.py
11
main.py
@@ -1,5 +1,6 @@
|
||||
import re, os
|
||||
from playwright.sync_api import Playwright, sync_playwright, expect
|
||||
import time
|
||||
from playwright.sync_api import Playwright, ViewportSize, sync_playwright, expect
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
@@ -9,6 +10,8 @@ def run(playwright: Playwright) -> None:
|
||||
browser = playwright.chromium.launch(headless=False)
|
||||
context = browser.new_context()
|
||||
page = context.new_page()
|
||||
# set viewport size for screenshot later on
|
||||
page.set_viewport_size({"width": 1600, "height": 900})
|
||||
page.goto("https://www.spielerplus.de/en-gb/site/login")
|
||||
page.get_by_role("dialog", name="Fair play in data privacy").click()
|
||||
page.get_by_role("link", name="Close").click()
|
||||
@@ -17,11 +20,17 @@ def run(playwright: Playwright) -> None:
|
||||
page.get_by_role("textbox", name="E-Mail").press("Tab")
|
||||
page.get_by_role("textbox", name="Password").fill(os.getenv("PLAYERPLUS_PASSWORD"))
|
||||
page.get_by_role("button", name="Login").click()
|
||||
page.wait_for_load_state('domcontentloaded')
|
||||
time.sleep(10)
|
||||
page.goto("https://www.spielerplus.de/en/site/events")
|
||||
page.get_by_role("link").filter(has_text=re.compile(r"^$")).click()
|
||||
page.get_by_role("button", name="Show Participants").click()
|
||||
time.sleep(10)
|
||||
#page.wait_for_selector('.modal-content')
|
||||
page.locator('#participation-modal').screenshot(path='/home/en/Code/projects/playerplus-screenshot/ss.jpg')
|
||||
|
||||
# ---------------------
|
||||
time.sleep(100)
|
||||
context.close()
|
||||
browser.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user