Unable to click buttons in Android chrome on real device

Hi all,

I’m trying to run the our script in real Android device, but after input username and password, the login button is not clickable…so I tried to just click the login button after the page is loaded…but doesn’t work
Appium version:
1.4.16
Chrome version:
51
Chromedriver version:
22
Android version:
6.0

Here’s how to set capablity:

      	Logging.info("Start android test :>>>> .............." + hub + platform);
  	capability = new DesiredCapabilities();
  	DesiredCapabilities.android();
      	capability.setCapability("platformName","Android");
        	capability.setCapability("deviceName", "02157df2da6c3c2a"); // here need to check the adb devices to set the deviceName
        	capability.setCapability("app", "chrome");
		//capability.setCapability("nativeWebTap", true);
        	capability.setCapability(CapabilityType.VERSION, "6.0");
		capability.setJavascriptEnabled(true);
		capability.setCapability("disable-popup-blocking", "true"); 
		capability.setCapability("autoWebview", "true");
		capability.setCapability("androidPackage", "com.android.chrome");
                   driver.set(new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capability));

Here’s step:

  Base.base.getDriver().get("http://10.13.6.151:8080//mail");
  Base.base.getDriver().findElement(By.xpath("//div[contains(@id,'loginButton')]")).click();

Logs:

info: --> POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/url {"url":"http://10.13.6.151:8080/mail"}
info: JSONWP Proxy: Proxying [POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/url] to [POST http://127.0.0.1:9515/wd/hub/session/3c4771824bf5786b222807477f18ace0/url] with body: {"url":"http://10.13.6.151:8080/mail"}
info: JSONWP Proxy: Got response with status 200: {"sessionId":"3c4771824bf5786b222807477f18ace0","status":0,"value":null}
info: JSONWP Proxy: Replacing sessionId 3c4771824bf5786b222807477f18ace0 with 3c4771824bf5786b222807477f18ace0
info: <-- POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/url 200 115.597 ms - 72 
info: --> POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/element {"using":"xpath","value":"//div[contains(@id,'loginButton')]"}
info: JSONWP Proxy: Proxying [POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/element] to [POST http://127.0.0.1:9515/wd/hub/session/3c4771824bf5786b222807477f18ace0/element] with body: {"using":"xpath","value":"//div[contains(@id,'loginButton')]"}
info: JSONWP Proxy: Got response with status 200: {"sessionId":"3c4771824bf5786b222807477f18ace0","status":0,"value":{"ELEMENT":"0.15128376602881333-2"}}
info: JSONWP Proxy: Replacing sessionId 3c4771824bf5786b222807477f18ace0 with 3c4771824bf5786b222807477f18ace0
info: <-- POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/element 200 86.431 ms - 103 
info: --> POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/element/0.15128376602881333-2/click {"id":"0.15128376602881333-2"}
info: JSONWP Proxy: Proxying [POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/element/0.15128376602881333-2/click] to [POST http://127.0.0.1:9515/wd/hub/session/3c4771824bf5786b222807477f18ace0/element/0.15128376602881333-2/click] with body: {"id":"0.15128376602881333-2"}
info: JSONWP Proxy: Got response with status 200: {"sessionId":"3c4771824bf5786b222807477f18ace0","status":0,"value":null}
info: JSONWP Proxy: Replacing sessionId 3c4771824bf5786b222807477f18ace0 with 3c4771824bf5786b222807477f18ace0
info: <-- POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/element/0.15128376602881333-2/click 200 186.738 ms - 72 
info: --> POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/frame {"id":null}
info: JSONWP Proxy: Proxying [POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/frame] to [POST http://127.0.0.1:9515/wd/hub/session/3c4771824bf5786b222807477f18ace0/frame] with body: {"id":null}
info: JSONWP Proxy: Got response with status 200: {"sessionId":"3c4771824bf5786b222807477f18ace0","status":0,"value":null}
info: JSONWP Proxy: Replacing sessionId 3c4771824bf5786b222807477f18ace0 with 3c4771824bf5786b222807477f18ace0
info: <-- POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/frame 200 17.824 ms - 72 
info: --> POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/timeouts {"type":"implicit","ms":80000}
info: JSONWP Proxy: Proxying [POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/timeouts] to [POST http://127.0.0.1:9515/wd/hub/session/3c4771824bf5786b222807477f18ace0/timeouts] with body: {"type":"implicit","ms":80000}
info: JSONWP Proxy: Got response with status 200: {"sessionId":"3c4771824bf5786b222807477f18ace0","status":0,"value":null}
info: JSONWP Proxy: Replacing sessionId 3c4771824bf5786b222807477f18ace0 with 3c4771824bf5786b222807477f18ace0
info: <-- POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/timeouts 200 5.203 ms - 72 
info: --> POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/frame {"id":null}
info: JSONWP Proxy: Proxying [POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/frame] to [POST http://127.0.0.1:9515/wd/hub/session/3c4771824bf5786b222807477f18ace0/frame] with body: {"id":null}
info: JSONWP Proxy: Got response with status 200: {"sessionId":"3c4771824bf5786b222807477f18ace0","status":0,"value":null}
info: JSONWP Proxy: Replacing sessionId 3c4771824bf5786b222807477f18ace0 with 3c4771824bf5786b222807477f18ace0
info: <-- POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/frame 200 20.705 ms - 72 
info: --> POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/timeouts {"type":"implicit","ms":80000}
info: JSONWP Proxy: Proxying [POST /wd/hub/session/3c4771824bf5786b222807477f18ace0/timeouts] to [POST http://127.0.0.1:9515/wd/hub/session/3c4771824bf5786b222807477f18ace0/timeouts] with body: {"type":"implicit","ms":80000}

is there any one who could help me?..

please provide the screenshot for that particular element.

Sure,

here’s the dom of the element

The log in button:

Use this :slight_smile:
driver.findElement(By.xpath("//*[normalize-space()=‘Login’]")).click();

it doesnt work for me , seemed not root cause… and btw, all these script is passed in safari of IOS simulator …but just cannot click the button of android on real device…

try this… may be it will work:
driver.findElement(By.xpath("//span[contains(., “” + document + “”)]"))).click();

https://bugs.chromium.org/p/chromedriver/issues/detail?id=1313 ?

Hi all,

Thanks for your help, finally , found out, the button is not support click event, it only has key press, key up,key down…
But very strange is that , with same code , it could be run on safari of IOS simulator…

so finally, I use follow line to tap the login button:

TouchAction ta = new TouchAction(webdriver);
ta.singTab(loginElement);

Hi, i am facing similar issue on android devices/emulator, posted here - .click() is not working on android device or emulator

Also tried with tap and press/release action but not working, any suggestions?