I have a case when the button was clicked i need to check the spinner shouldBe(hidden).At the same time the page is changed to another page. At code line (2) the element is still visible on the page, so the element has time to be initialized, but as soon as the transition to another page occurs, in this method (code line 3) the element no longer exists, and ElementShould will call getText() and getTagName() element.
which in leads to an error java.lang.ClassCastException: com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to java.lang.String
Tell us about your environment
Selenide Version: 5.13
StackTrace
java.lang.ClassCastException: class com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to class java.lang.String (com.google.common.collect.Maps$TransformedEntriesMap is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
at org.openqa.selenium.remote.RemoteWebElement.getText(RemoteWebElement.java:167)
at com.codeborne.selenide.impl.Describe.serialize(Describe.java:120)
at com.codeborne.selenide.impl.Describe.describe(Describe.java:147)
at com.codeborne.selenide.ex.ElementShould.<init>(ElementShould.java:16)
at com.codeborne.selenide.impl.WebElementSource.checkCondition(WebElementSource.java:94)
at com.codeborne.selenide.commands.Should.execute(Should.java:30)
at com.codeborne.selenide.commands.Should.execute(Should.java:14)
at com.codeborne.selenide.commands.Commands.execute(Commands.java:152)
at com.codeborne.selenide.impl.SelenideElementProxy.dispatchAndRetry(SelenideElementProxy.java:104)
at com.codeborne.selenide.impl.SelenideElementProxy.invoke(SelenideElementProxy.java:70)
at com.sun.proxy.$Proxy25.shouldBe(Unknown Source) - Condition(hidden)
at all.objects.mobile.entries.NewBasketGroupV4Mobile.clickCheckoutButton(NewBasketGroupV4Mobile.java:35)
@Manchiken Looks like a bug in RemoteWebElement. We can make a workaround in Selenide, but it's better to report this bug to Selenium WebDriver project.
The problem
element.shouldBe(Condition) throws ClassCastException
Details
I have a case when the button was clicked i need to check the spinner shouldBe(hidden).At the same time the page is changed to another page. At code line (2) the element is still visible on the page, so the element has time to be initialized, but as soon as the transition to another page occurs, in this method (code line 3) the element no longer exists, and ElementShould will call getText() and getTagName() element. which in leads to an error java.lang.ClassCastException: com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to java.lang.String
Tell us about your environment
StackTrace