2

I am getting the above error while trying to run an appium test. The jars I use are:

The jars in my lib folder:

The jars in my lib folder

My app is coming up after

driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), caps);

But in the next step,

driver.wait(5000);

it fails with the exception:

Exception I get

I am a beginner in appium, hence downloaded the jar files mentioned above looking at dependencies. I have tried multiple combinations of version numbers of jars, but it still gives the exception. Can you please let me know how to proceed? I use Ant to build the project.

I have also used java client 6.1.0, but using it doesn't even bring my app up. I have used the latest gson jar as well which is 2.8.5

My build.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>

<property name="build.dir" location="bin">
</property>
<property name="src.dir" location="src">
</property>
<property name="docs.dir" location="docs">
</property>
<property name="dist.dir" location="dist">
</property>
<property name="lib.dir" location="lib">
</property>
<property name="resources.dir" location="resources">
</property>
<path id="build.classpath">
    <fileset dir="${lib.dir}" includes = "gson-2.8.5.jar">
        <include name="*.jar"/>
    </fileset>
</path>
<pathconvert property="classpathProp" refid="build.classpath" />
<echo>Classpath is ${classpathProp}</echo>
<target name="init">
    <mkdir dir="bin"/>
    <mkdir dir="dist"/>
    <mkdir dir="docs"/>

</target>
<target name="clean">
    <delete dir="${build.dir}"/>
    <delete dir="${docs.dir}"/>
    <delete dir="${dist.dir}"/>
</target>
<target name="compile" depends="clean,init">
    <javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" includeantruntime="false">
    </javac>
</target>
<target name="main" depends="compile">
    <java classname="core.Trigger" classpath="${build.dir}" classpathref="build.classpath"></java>
</target>

aswathy
  • 139
  • 2
  • 16

2 Answers2

0
  1. Can you update gson library i.e. gson jar to latest version
  2. Also I have never seen direct wait method provided by appium. Try using implicit wait in start.

    driver.manage().timeouts().implicitlywait(10 timeunit.seconds)

  3. Also mention the class type of android driver

driver = new AndroidDriver[MobileElement](new URL("http://127.0.0.1:4723/wd/hub"), caps);

or

driver = new AndroidDriver[WebElement](new URL("http://127.0.0.1:4723/wd/hub"), caps);

  1. Also make sure your appium server is running on correct port.

Note - instead of greater and less then brackets used [] as they are not rendering on page.

Amit Jain
  • 4,389
  • 2
  • 18
  • 21
  • 1)I have used gson 2.8.5 2) I tried using implicit wait 3) I mentioned the class type as well. i return the parent class Webdriver which was why, i was able to get wait methods – aswathy Aug 02 '18 at 04:32
0

For me, the issue was due to using the parent class Webdriver instead of Android driver. I was looking to make it work both for app and desktop. I have seen such a usage before, but for me it didnt work.

aswathy
  • 139
  • 2
  • 16