java-client icon indicating copy to clipboard operation
java-client copied to clipboard

Unable to resolve findElementByAndroidUIAutomator with java client 7.3.0 version

Open VigneshSrinivasaRaghavan opened this issue 6 years ago • 2 comments

Description

Unable to resolve findElementByAndroidUIAutomator with java client 7.3.0

Environment

  • Java client build version or git revision if you use some snapshot: java client 7.3.0
  • Appium server version or git revision if you use some snapshot: Appium-1.14.2
  • Desktop OS/version used to run Appium if necessary: Mac OS 10.15.3
  • Real device or emulator/simulator: Simulator

Code To Reproduce Issue [ Good To Have ]

package basics; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.MobileBy; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; import io.appium.java_client.remote.MobileCapabilityType;

public class Test { public static void main(String[] args) throws Exception { File f = new File("src/test/java"); File fs = new File(f,"ApiDemos-debug.apk");

	DesiredCapabilities cap = new DesiredCapabilities();
	cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus 6 API 28");
	cap.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
	
	URL url = new URL("http://127.0.0.1:4723/wd/hub");
	AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(url,cap);
	driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	driver.findElementByAndroidUIAutomator // findElementByAndroidUIAutomator cannot be resolved or is not a field
}

} Screenshot 2020-04-21 at 6 56 58 PM

Hi,

Any update on this. Please reply

You need to provide a parameter of UiSelector string. ex. driver.findElementByAndroidUiAutomator("new UiSelector().text("text")); or String uiSelector = "new UiSelector().text("text")"; driver.findElementByAndroidUiAutomator(uiSelector); or driver.findElement(MobileBy.(uiSelector));

QAthulhu avatar Apr 30 '20 02:04 QAthulhu