Hello all,
I am trying to automate Android application and it is developed in ReactNative. I am not able to click on button because button is clickable=false and I don’t have any Resource id or content desc so i m unable to locate element…please help me
Thank You
@Ajinkya share to as at https://gist.github.com/ your output with needed screen of:
// java
System.out.println(driver.getPageSource())
and which button you trying to tap.
@Aleksei I am trying to tap login button but it is clickable = false I am trying to tap button with its coordinates but it throws me exception
@Ajinkya we do not have your code and your app to check. share something with us and we can help. code (how you try to tap) and pageSource.
Actions action= new Actions(driver);
WebElement elt = driver.findElementByClassName(“android.widget.FrameLayout[0]”);
action.moveToElement(elt, 611, 722).click().perform();
I am trying this
and driver.findElement(By.className(“android.view.ViewGroup[@index=‘4’]”)).click();
This way but not able to click
// Actions action= new Actions(driver);
// action.moveToElement(elt, 611, 722).click().perform(); - not correct.
// it is needed something like
new TouchAction((MobileDriver) drive).press(startx, starty).waitAction(duration).moveTo(endx, endy).release().perform();
// driver.findElement(By.className(“android.view.ViewGroup[@index=‘4’]”)).click(); ->
driver.findElements(MobileBy.className(“android.view.ViewGroup”)).get(3).click(); // starting from 0,1,2,3,....
driver.findElements(MobileBy.className(“android.view.ViewGroup”)).get(3).click();
It is also not working beceause Clickable= ‘false’ in UI automator
@Ajinkya they are it is coordinates. use your X,Y from to. you can also use elements instead of coordinates.
Still it is not working it giving exception
Exception in thread “main” java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver cannot be cast to io.appium.java_client.MobileDriver
your driver should be AppiumDriver
Sorry didn’t get this answer of AppiumDriver?? actually i have appium driver but i cannot understand where I have to declare him or how to declare?
@Ajinkya - here to try https://github.com/appium/java-client/blob/master/src/test/java/io/appium/java_client/appium/AndroidTest.java
Hi,
I have tried my code with your code of Appium Driver but I am getting this error
Exception in thread “main” java.lang.NoClassDefFoundError: org/openqa/selenium/NoSuchSessionException
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:111)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:73)
at sunrise.SampleProg.main(SampleProg.java:47)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.NoSuchSessionException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 3 more