This issue occurred after the first steps.
OS: Mac
I have declared DesiredCapabilities
and trying to run the IPhone simulator using Xcode.
public class DC_Demo{
public static void main (String[] args) throws MalformedURLException {
DesiredCapabilities des = new DesiredCapabilities();
des.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone X");
des.setCapability(MobileCapabilityType.PLATFORM_NAME, "IOS");
des.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
des.setCapability(MobileCapabilityType.APP, "//Macintosh HD//Users//isururodrigo//Development//VS-Staging.app");
IOSDriver<IOSElement> driver = new IOSDriver<>(new URL("http://127.0.0.1:4723/wd/hub"),des);
}
}
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at DC_Demo_VisitSinga.main(DC_Demo_VisitSinga.java:21) Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
If you are using Maven project, then in your pom.xml
file, add latest version of guava library.
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
</dependency>
Or if you're using Java project, then download latest version of the same library and add it in your build path.
This should solve the problem.