From 941c085b0a73d8c50b0b2c391df3358d5eacf8a3 Mon Sep 17 00:00:00 2001 From: Bagrat Aznauryan Date: Fri, 23 Aug 2024 01:29:01 +0400 Subject: [PATCH] feat: allow to slow down browser actions --- lib/wallaby/chrome.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/wallaby/chrome.ex b/lib/wallaby/chrome.ex index cb693d16..b5360ef9 100644 --- a/lib/wallaby/chrome.ex +++ b/lib/wallaby/chrome.ex @@ -397,6 +397,12 @@ defmodule Wallaby.Chrome do defp delegate(fun, element_or_session, args \\ []) do check_logs!(element_or_session, fn -> + delay = Application.get_env(:wallaby, :slow_down, 0) + + if delay > 0 do + :timer.sleep(delay) + end + apply(WebdriverClient, fun, [element_or_session | args]) end) end