appium / appium/java-client

FAILED CONFIGURATION: @BeforeMethod setupAppium java.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys

Open
#1,185 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Please Find my below code 💯

package com.finacus.automation.XamarinApps;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.ScreenOrientation;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
//import io.appium.java_client.ios.IOSDriver;
//import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.MobileCapabilityType;

public class AppTest
{
public static URL url;
public static DesiredCapabilities capabilities;
public static AndroidDriver d;

//protected AndroidDriver driver = null;
//DesiredCapabilities dc = new DesiredCapabilities();

@BeforeMethod
public void setupAppium() throws MalformedURLException
{

final String URL_STRING = "http://127.0.0.1:4723/wd/hub";
url = new URL(URL_STRING);

capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Lenovo A6020a46");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.1.1");
capabilities.setCapability(MobileCapabilityType.APP, "[E:\\QA\\com.rde.vannew-Signed.apk]");
capabilities.setCapability(MobileCapabilityType.NO_RESET, true);

//capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
capabilities.setCapability(MobileCapabilityType.UDID,"bf3ad214");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
//capabilities.setCapability("useNewWDA", false);

d= (AndroidDriver<AndroidElement>) new AppiumDriver<AndroidElement>(url,capabilities);
d = new AndroidDriver<AndroidElement>(url, capabilities);
d.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);    

}

@Test
public void myFirstTest() throws InterruptedException
{

 String myname= "sush";

d.rotate(ScreenOrientation.PORTRAIT);
d.findElement(By.xpath("//android.view.View[@content-desc="mobileEntry"]/android.view.View/android.widget.FrameLayout/android.view.View/android.widget.EditText\r\n" +"")).sendKeys("321654987");

d.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View/android.widget.Button\r\n" +
"")).click();

Thread.sleep(5000);
//d.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

  //d.resetApp();

}

@AfterMethod
public void uninstallApp() throws Exception
{
//d.removeApp("com.rde.vannew");
d.quit();
}
}

Precondition - This app is xamarin based native application and try to automate using Appium tool but getting below issue while running the application.

Issue - java.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at AppTest.setupAppium(), where the AndroidDriver is created and the NoClassDefFoundError occurs. Reproduce the failure with the shown configuration and inspect the Java client and Selenium dependencies involved. Done means setupAppium() can create the driver without the missing AcceptedW3CCapabilityKeys class error.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.