Closed Fodoj closed 4 months ago
It's described here and works https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing#dockerizing-system-tests
I have this setup already working. The article was written in 2020, Browserless 2.0 was released in December 2023. Browserless 1.x works without any issues, but new one works as describe in the issue above.
Got it, I'll check then.
Did you ever manage to get it working or find out what the issue was? @Fodoj
It's not my top priority but it works, so I don't know what is not working:
require "ferrum"
browser = Ferrum::Browser.new(ws_url: "wss://chrome.browserless.io?token=xxx")
browser.version
page = browser.create_page
page.go "http://example.com"
page.screenshot(path: "a.png")
sleep 5
browser.quit
As of my knowledge, browserless.io SaaS doesn't offer browserless 2.0 yet.
Just fyi, from Browserless support. In my case I was testing with local containers, not with the cloud offering.
I figured out that Ferrum is stripping the query params, and in a newer version of ferrum that added ws support without a url, it is obtaining the ws_url from /json/version which incorrectly sets ws_url to 0.0.0.0:3000 :)
I am in the process of submitting a PR that fixes this
As of my knowledge, browserless.io SaaS doesn't offer browserless 2.0 yet.
Ah I see now. That's why it working. Then I need more tests and check out the PR
@route try with production-sfo.browserless.io endpoint, per their support this one is backed by v2 (or just local container)
Fixed in master
Did anyone manage to make it work with Browserless 2.0? I am running everything in containers, meaning my rails app container connects to browsleress container. Even with the HEAD version, if I pass ws_url, it still stays localhost:4000 and tests are failing:
Cuprite
Ferrum
https://github.com/rubycdp/ferrum/blob/main/lib/ferrum/browser.rb#L242
Result:
Because of this my tests won't even start, as they quickly fail during initialization phase.