title: Exception in thread "main" java.lang.ClassCastException: java.util.HashMap cannot be cast to org.openqa.selenium.WebElement
body: <p>I am using this code and generate this error</p>
  
  <pre><code>import java.net.MalformedURLException;
  import java.net.URL;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.remote.DesiredCapabilities;
  
  import io.appium.java_client.MobileDriver;
  import io.appium.java_client.TouchAction;
  import io.appium.java_client.android.AndroidDriver;
  import io.appium.java_client.remote.MobileCapabilityType;
  
  public class HandlingScrollVertical {
  
      public static void main(String[] args) throws MalformedURLException, InterruptedException {
          // TODO Auto-generated method stub
  
  
          DesiredCapabilities dc= new DesiredCapabilities();
  
          dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
  
          //dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
  
          dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1.1");
  
          dc.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
  
          dc.setCapability(MobileCapabilityType.APP, "/home/connexis/appium/AppiumMobile/src/main/java/Apps/ApiDemos.apk");
  
          URL url =new URL("http://127.0.0.1:4723/wd/hub");
  
          AndroidDriver&lt;WebElement&gt; driver= new AndroidDriver&lt;WebElement&gt;(url,dc);
  
          driver.findElementsByAccessibilityId("Animation").get(1).click();     
          /*WebElement info=driver.findElementsById("android:id/text1").get(1);
  
  
          int x1=info.getLocation().getX();
          int y1=info.getLocation().getY();
  
  
  
          int x2=x1 /2;
          int y2=y1 /2;
  
  
          TouchAction a = new TouchAction((MobileDriver) driver);
          a.press(info).moveTo(x1,y1).perform().release();*/
          Thread.sleep(8000);
          driver.quit();
      }
  
  }
  </code></pre>
  
  <p><strong>Envorinment variable set :</strong> </p>
  
  <p>Selenium Server standalone 2.53</p>
  
  <blockquote>
  <pre><code>    Java-Client 5.0.4
      Emulator
  </code></pre>
  </blockquote>
  
  <p><strong>Error log:</strong></p>
  
  <pre><code>Exception in thread "main" java.lang.ClassCastException: java.util.HashMap cannot be cast to org.openqa.selenium.WebElement
      at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:397)
      at io.appium.java_client.DefaultGenericMobileDriver.findElements(DefaultGenericMobileDriver.java:54)
      at io.appium.java_client.AppiumDriver.findElements(AppiumDriver.java:167)
      at io.appium.java_client.FindsByAccessibilityId.findElementsByAccessibilityId(FindsByAccessibilityId.java:38)
      at io.appium.java_client.AppiumDriver.findElementsByAccessibilityId(AppiumDriver.java:203)
      at HandlingScrollVertical.main(HandlingScrollVertical.java:33)
  </code></pre>