-
-
Notifications
You must be signed in to change notification settings - Fork 210
Description
Elixir and Erlang/OTP versions
% elixir -v
Erlang/OTP 27 [erts-15.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.18.0 (compiled with Erlang/OTP 27)
Operating system
MacOS 13.1
Browser
selenium
Driver
selenium
Correct Configuration
- I confirm that I have Wallaby configured correctly.
Current behavior
im using selenium docker image: selenium/standalone-chromium (4.27.0 grid version, 131 chrome version) (there is no working chrome standalone docker for m1 mac).
Image starts up and i can access selenium grid ui, i can use curl to create session:
% curl -X POST http://localhost:4444/wd/hub/session \
-H "Content-Type: application/json" \
-d '{
"capabilities": {
"alwaysMatch": {
"browserName": "chrome",
"goog:chromeOptions": {
"args": ["--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]
}
}
}
}'
i have wallaby configured:
config :wallaby,
otp_app: :my_app,
driver: Wallaby.Selenium,
selenium: [
capabilities: %{
"goog:chromeOptions": %{
args: ["--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]
},
browserName: "chrome"
}
]Wallaby.start_session() returns (RuntimeError) Could not start a new session. No nodes support the capabilities in the request
#782 it turns out 4.8.3 version should be used (last published docker image 2 years ago without m1 arm support).
Debugging internally, i noticed, that wallaby wraps capabilities config into desiredCapabilities that is no longer working for newer versions of selenium.
# lib/wallaby/webdriver_client.ex:24
- params = %{desiredCapabilities: capabilities}
+ params = %{capabilities: capabilities}
# lib/wallaby/selenium.ex
- id = response["sessionId"]
+ id = get_in(response, ["value", "sessionId"])Capabilities has different payload structure (note payload is wrapped in alwaysMatch):
config :wallaby,
otp_app: :my_app,
driver: Wallaby.Selenium,
selenium: [
capabilities: %{
alwaysMatch: %{
"goog:chromeOptions": %{
args: ["--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]
},
browserName: "chrome"
}
}
]With those changes fallowing code gets executed properly:
defmodule Knabis.Source.Fetcher do
alias Wallaby.{Browser, Session}
def fetch(url) do
{:ok, session} =
Wallaby.start_session()
session
|> Browser.visit(url)
|> Browser.text()
|> finalize_session(session)
end
defp finalize_session(result, session) do
Wallaby.end_session(session)
result
end
endExpected behavior
To work with never selenium.
I understand there might be more update work/testing needed to fully support newer selenium endpoints, so i don't expect this to be implemented right away.
Bottom line: other people should not spend few days debugging it, please add those caveats in documentation, that legacy version of selenium only is supported.
Test Code & HTML
Im not sure what to put here.
Demonstration Project
No response