Created
March 22, 2023 22:40
-
-
Save drnic/284bc36a99ca879136e6e503fe79cc9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "playwright" | |
uri = "wss://chrome.browserless.io/playwright?token=#{browserless_api_key}" | |
Playwright.connect_to_playwright_server(uri) do |playwright| | |
playwright.chromium.launch do |browser| | |
page = browser.new_page | |
page.goto("https://github.com/YusukeIwaki") | |
page.screenshot(path: "./YusukeIwaki.png") | |
end | |
end |
The error I get looks like:
/Users/drnic/.rvm/gems/ruby-3.2.1/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/promises.rb:1258:in `raise': Error: Executable doesn't exist at /usr/src/app/chromium-1028/chrome-linux/chrome (Playwright::Error)
╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
#export DEFAULT_URL_HOST=http://localhost:3000
║ Please run the following command to download new browsers: ║
║ ║
║ npx playwright install ║
║ ║
║ <3 Playwright Team ║
╚═════════════════════════════════════════════════════════════════════════╝
Perhaps there's an issue related to playwright versions. The playwright rubygem seems to want playwright verson 1.31.1
$ bundle exec ruby -e "require 'playwright'; puts Playwright::COMPATIBLE_PLAYWRIGHT_VERSION.strip"
1.31.1
But looking at the gem I'm unsure where this version number is used; or how it might affect the connection to browserless.
The playwright version could be the issue, make sure you install a supported playwright version, since playwright is tightly version coupled -> https://www.browserless.io/docs/versions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My
package.json
contains"playwright": "1.27.1",
andGemfile
containsgem "playwright-ruby-client", "~> 1.31"