From 645ac43c8a8b85f9afba5eb28d9684746be11ad8 Mon Sep 17 00:00:00 2001 From: alinmarsh <72171439+alinmarsh@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:54:48 -0500 Subject: [PATCH] fix: return error when session not created (#1) --- lib/wallaby/webdriver_client.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/wallaby/webdriver_client.ex b/lib/wallaby/webdriver_client.ex index 92adf7d6..abbe5785 100644 --- a/lib/wallaby/webdriver_client.ex +++ b/lib/wallaby/webdriver_client.ex @@ -23,7 +23,13 @@ defmodule Wallaby.WebdriverClient do def create_session(base_url, capabilities) do params = %{desiredCapabilities: capabilities} - request(:post, "#{base_url}session", params) + case request(:post, "#{base_url}session", params) do + {:ok, %{"status" => status} = nonzero_status_response} when status != 0 -> + {:error, nonzero_status_response} + + response -> + response + end end @doc """