Closed oomelianchuk closed 3 months ago
The problem is that SERE takes place while Selenide tries to get the actual visibility value. That's why the cause for both. really failed should assertion and one with SERE is null
. The stack trace is also the same:
com.codeborne.selenide.impl.WebElementSource.checkCondition(WebElementSource.java: 94),
com.codeborne.selenide.commands.Should.execute(Should.java: 30),
com.codeborne.selenide.commands.Should.execute(Should.java: 14),
com.codeborne.selenide.commands.Commands.execute(Commands.java: 153),
com.codeborne.selenide.impl.SelenideElementProxy.dispatchAndRetry(SelenideElementProxy.java: 104),
com.codeborne.selenide.impl.SelenideElementProxy.invoke(SelenideElementProxy.java: 70),
com.sun.proxy.$Proxy36.shouldBe(UnknownSource),
The only difference between these exceptions is that one with SERE contains Actual value: StaleElementReferenceException: stale element refe
instead of actual value. Checking for this text in the exception message could be the way to improve the SelenideAddons.$safe
method. As the text we would look for is more specific than StaleElementReferenceException
, the probability of catching the wrong exception is low.
Ready for final test.
Sometimes
StaleElementReferenceException
is not contained in the exception cause but only in the exception message, like in the example below:Please think about improving the
SelenideAddons.$safe
method to catch SERE also in this case.