Wait before taking screenshot with Ruby and Playwright
Install Playwright and Playwright client for Ruby
npm install firstname.lastname@example.org gem install playwright-ruby-client
Take a screenshot and save to file
Wait for the specified number of milliseconds before taking the screenshot.
require 'playwright' Playwright.create(playwright_cli_executable_path: './node_modules/.bin/playwright') do |playwright| playwright.chromium.launch(headless: false) do |browser| page = browser.new_page page.goto('https://www.bbc.co.uk/news/business-63709754') page.wait_for_timeout(3000); page.screenshot(path: './wait.png') end end
Find out how to take a full-page screenshot with Ruby and Playwright.
We created Urlbox to make converting HTML to images easy
Learn more about our website screenshot API.