diff --git a/BTCPayServer.Tests/Extensions.cs b/BTCPayServer.Tests/Extensions.cs index cca9a6de9..b35c89a10 100644 --- a/BTCPayServer.Tests/Extensions.cs +++ b/BTCPayServer.Tests/Extensions.cs @@ -49,12 +49,14 @@ namespace BTCPayServer.Tests } // Sometimes, selenium is flaky... - public static IWebElement FindElementUntilNotStaled(this IWebDriver driver, By by) + public static IWebElement FindElementUntilNotStaled(this IWebDriver driver, By by, Action act) { retry: try { - return driver.FindElement(by); + var el = driver.FindElement(by); + act(el); + return el; } catch (StaleElementReferenceException) { diff --git a/BTCPayServer.Tests/PayJoinTests.cs b/BTCPayServer.Tests/PayJoinTests.cs index ef29a431a..95a25704a 100644 --- a/BTCPayServer.Tests/PayJoinTests.cs +++ b/BTCPayServer.Tests/PayJoinTests.cs @@ -255,8 +255,8 @@ namespace BTCPayServer.Tests s.Driver.FindElement(By.Id("bip21parse")).Click(); s.Driver.SwitchTo().Alert().SendKeys(bip21); s.Driver.SwitchTo().Alert().Accept(); - s.Driver.FindElementUntilNotStaled(By.Id("Outputs_0__Amount")).Clear(); - s.Driver.FindElementUntilNotStaled(By.Id("Outputs_0__Amount")).SendKeys("0.023"); + s.Driver.FindElementUntilNotStaled(By.Id("Outputs_0__Amount"), we => we.Clear()); + s.Driver.FindElementUntilNotStaled(By.Id("Outputs_0__Amount"), we => we.SendKeys("0.023")); s.Driver.FindElement(By.Id("SignTransaction")).Click();