Python Playwright fullscreen maximize nocache save html
from playwright.sync_api import sync_playwright
with sync_playwright() as peijdz:
browser = peijdz.chromium.launch( headless = True , args = ["--start-fullscreen"] )
bejzurl1= "https://jednostavno.somware.org/"
bejzurl2= "https://misli.somware.org/"
context = browser.new_context (
locale = "en-US" ,
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36 Edg/98.0.1108.43" ,
color_scheme = "dark" ,
base_url = bejzurl1 ,
viewport = { "width" : 1920 , "height" : 1080 } ,
device_scale_factor = 1,
extra_http_headers = { 'Cache-Control' : 'no-store' , 'Pragma' : 'no-cache' , 'baseURL' : bejzurl2 , 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36 Edg/98.0.1108.43' }
)
page = context.new_page()
url ="https://jednostavno.somware.org"
page.goto (url)
page.click('button:has-text("Klikni ovdje kliknuvši ovdje")') # simuliraj klik na gumb
page.pdf (path="le_page.pdf")
html =page.content()
tekst =page.inner_text(selector="body")
print (html , file=open("le_page.html" ,"w", encoding="utf8"))
print (tekst , file=open("le_page.txt" ,"w", encoding="utf8"))
context.close()
browser.close()
https://playwright.dev/python/
python playwright fullscreen maximize maximized nocache no cache uncache xpython xplaywright xfullscreen xmaximize xmaximized xnocache xno xcache xuncache chromium xchromium xchrome chrome save page savepage xsave xpage xsavepage fetch xfetch source xsource as text txt xtext xtxt