Skip to content

[πŸ› Bug]:Mobile Web testing with Android, Apple devices used to work fine until 4months ago, but Android device started to fail at click() actions, except for using JavaScriptExecutorΒ #16352

@vnuta9

Description

@vnuta9

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions