Write a Script: Use Playwright to navigate to the page, locate the comment you want to capture, and then take a screenshot.
from playwright.sync_api import sync_playwright def screenshot_comment(url, comment_selector, output_path): with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page() page.goto(url) comment = page.query_selector(comment_selector) if comment: comment.screenshot(path=output_path) browser.close() # Usage screenshot_comment('https://example.com', 'css-selector-for-comment', 'comment.png')
Replace
'https://example.com'
with the URL of the page,'css-selector-for-comment'
with the CSS selector for the comment you want to screenshot, and'comment.png'
with your desired file name.
This will capture the comment and save it as an image file.