-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Open
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-javaJava BindingsJava BindingsD-chromeI-defectSomething is not working as intendedSomething is not working as intendedOS-mac
Description
Description
- after loading the page i am trying to click on a login link
- i expect it to click
- getting the following exception
REST API Reason:java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class org.openqa.selenium.WebElement (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; org.openqa.selenium.WebElement is in unnamed module of loader...
- stacktrace :
[31mjava.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class org.openqa.selenium.WebElement (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; org.openqa.selenium.WebElement is in unnamed module of loader 'app') at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElement(ElementLocation.java:166) at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:59) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:367) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:361) at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:194) at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:190) at org.openqa.selenium.support.ui.ExpectedConditions$22.apply(ExpectedConditions.java:627) at org.openqa.selenium.support.ui.ExpectedConditions$22.apply(ExpectedConditions.java:624) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:203)
Reproducible Code
public void tapLoginButton(WebDriver driver) {
By loginLocator = By.xpath("//p[contains(text(),'Login')]");
safeClick(driver, loginLocator, 10);
}
public void safeClick(WebDriver driver, By locator, int timeoutSeconds) {
WebElement element = waitForElementClickable(driver, locator, timeoutSeconds);
element.click();
}
public WebElement waitForElementClickable(WebDriver driver, By locator, int timeoutSeconds) {
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(timeoutSeconds));
return wait.until(ExpectedConditions.elementToBeClickable(locator));
}
Other Information
- Locally does not seem to be happening
- Java version 11
- Observing this randomly on this particular point of our script on trying to interact with this
<p class="D_le M_lK D_lf M_lL D_lj M_lP D_ll M_lR D_lp M_lV D_ls M_lY D_la" style="color:unset">Login</p>
- We tried this on browserstack chrome version 138/140 and OS 10 and 11
- sorry, cant share the URL
- We tried without waiting for the element to be clickable by directly clicking on the element, still got the same error
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-javaJava BindingsJava BindingsD-chromeI-defectSomething is not working as intendedSomething is not working as intendedOS-mac