-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
Description
I have been using JDK 17/21, on Mac Tahoe 26, Selenium-Java client 4.35 to automate a mobile web site on Android, and iOS devices.
After 4 months on the same issue. In between this time, I spent working on other things, and only on iPhone. With fresh restart and this time with help from chatGPT plus , I did this following checkpoint verification
.
β
Checklist #1: Key finding β element.isDisplayed() returns false
This is the core reason your .click() call is failing on Android.
If isDisplayed() is false, Selenium will not allow the element to be clicked using .click() β even if itβs present in the DOM and enabled.
The element is either:
Not in the viewport,
Obscured by another element (e.g., toolbar, popup, keyboard),
Or styled with display: none, visibility: hidden, or opacity: 0.
β isDisplayed() returning false directly leads to ExpectedConditions.elementToBeClickable() failing.
β Checklist #2: TimeoutException in ExpectedConditions.elementToBeClickable
as expected, since .isDisplayed() is false, the condition never becomes true β TimeoutException.
Confirms again: Appium sees the element, but it's not rendered as visible.
β Checklist #3 and #4: Everything looks correct here
The automationName, permissions, Chrome version, and chromedriver are all correct β so this is not a compatibility issue.
π Summary
This is not a code issue, version mismatch, or a timing bug β it's a viewport/visibility/UI issue specific to Android rendering.
β Solutions β
π οΈ Option 1: Use JavaScript click after scrolling into view (which is proven already to be working )
β
This bypasses isDisplayed() because JavaScript can click even invisible elements β although risky if the element truly isn't actionable.
π§© Option 2: Conditional fallback click()
If you want to fallback to JS click only when .click() fails:
β
π§©β
I could NOT follow either of the solution options because at this point I would need to edit 21 very long programs with multitude of click() actions. It is too much work and complicated.
β
π§©β
If I want to follow Mykola Mokhnach advise,
It looks like a bug in chromedriver to me, which is maintained by Google. UIA2 driver just acts as a proxy in such case.Eventually I would advice to collect chromedriver logs and report the issue to Google, especially if you confirm that an older Chromedriver version works as expected.
I could not collect chromedriver logs plus where and how to contact Google? I am only one guy against a Director who is from Finance area. Feeling all alone in this.
Please help, advise.
Reproducible Code
// WebElement loginButton = waitingDriver.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[@id='login']")));
// loginButton.click(); --->> NOT working, so using JavaScriptExecutor based method
elementJSClick(loginButton);
//click 'stock' radio button
waitingDriver.until(ExpectedConditions.elementToBeClickable(By.cssSelector("input#type_stock"))).click();--->> NOT working <<----
βΉοΈ Last known working version: chrome browser prior to 138