from playwright.sync_api import sync_playwright pages={'전사캠페인_096':'https://www.komipo.co.kr/esg/board/BRD_000096/boardMain.do?mnCd=ESG03030203', '자료공유_097':'https://www.komipo.co.kr/esg/board/BRD_000097/boardMain.do?mnCd=ESG03030303'} with sync_playwright() as p: b=p.chromium.launch();pg=b.new_page(viewport={'width':1200,'height':1600},ignore_https_errors=True) for n,u in pages.items(): try: pg.goto(u,wait_until='load',timeout=30000); pg.wait_for_timeout(1800) except Exception as e: print('err',n,str(e)[:40]);continue (pg.query_selector('#content') or pg).screenshot(path='_nshots_tab/%s.png'%n) print('shot',n) b.close()