0

I was able to click on links and texts but I cannot click on Button using Chrome with Android Appium

public void testcheck() {
    System.out.println("Select");
    //<a id="vivKo" href="javascript:void(0);" class="btn btn- green vivKo at_vivKo">
    //<span class="text">vivKo</span>
  //  <i class="fa fa-chevron-right"></i>  </a>
    //driver.findElementByXPath("//span[contains(., \"" + vivKo + "\")]").click();
    WebElement vova = (WebElement) driver.findElementByXPath("//*[@id=vivKo']");
    TouchAction ta = new TouchAction(driver);
    ta.longPress(vova);
    //WebElement vova = (WebElement) driver.findElementByXPath("//*[@id='vivKo']");
    driver.findElement(By.xpath("//*[@id='vivKo']")).click();
    WebElement elementToClick = driver.findElement(By.xpath("//*[@id='vivKo']"));
    Actions actions = new Actions(driver);
    new WebDriverWait(driver, 60).until(ExpectedConditions.visibilityOf(vova));
    actions.moveToElement(elementToClick).click().build().perform();

Error: FAILED: testcheck

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (180, 630)
(Session info: chrome=62.0.3202.84)
(Driver info: chromedriver=2.30.477690 (c53f4ad87510ee97b5c3425a14c0e79780cdf262),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 237 milliseconds
Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'
System info: host: 'AMAC02T90QRGTFM', ip: '192.168.14.180', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{deviceScreenSize=1440x2960, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=9887fc35525a485333, platform=LINUX, deviceUDID=9887fc35525a485333, desired={platformVersion=7.0, browserName=Chrome, platformName=Android, deviceName=Vovchik}, platformVersion=7.0, webStorageEnabled=false, locationContextEnabled=false, takesScreenshot=true, browserName=Chrome, javascriptEnabled=true, deviceModel=SM-G950U, platformName=Android, deviceManufacturer=samsung}]
Session ID: 10923751-6fb6-48d1-b61d-50be29f84770
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at 
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • You are seeing `Element is not clickable at point` which is possible duplicate of [Selenium Web Driver & Java. Element is not clickable at point (36, 72). Other element would receive the click:](https://stackoverflow.com/questions/44912203/selenium-web-driver-java-element-is-not-clickable-at-point-36-72-other-el) – undetected Selenium Nov 17 '17 at 08:24
  • Thanks! How would you scroll down I tried scrollTo() does not work. – jack daniel Nov 17 '17 at 08:38

1 Answers1

0

If you know there is an element that not displayed on screen but still possible to get it via driver, you can swipe up (e.g. 100 px) before you try to click it.

int x = element.getLocation().getX();
int y = element.getLocation().getY();
new TouchAction(driver)
  .press(x, y)
  .waitAction(ofMillis(500))
  .moveTo(x, y+100)
  .release()
  .perform();

Of course, you can calculate more accurate px shift taking in account screen size.

dmle
  • 3,498
  • 1
  • 14
  • 22