Open NewUserMob opened 5 years ago
I have the same issue. Here is my setup:
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
</dependency>
With appium v1.11.0
Pls remove selenium dependency. Java-client comes with selenium deps
I have removed the selenium dependancy. This has resolved the ava.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys issue.
However now I am getting org.openqa.selenium.WebDriverException: Connection refused (Connection refused). I am using xcode 10.1 if that is relevant.
Edit: I uninstall and reinstalled the latest appium, and cut down my capabilities to only the necessities. Seems to be working correctly now. Will test a bit more and update if its any one capability causing the issue.
Okay nevermind. org.openqa.selenium.WebDriverException: Connection refused (Connection refused). is being thrown 90% of the time when I start appium programmatically. When I use appium desktop it can launch the app no problem.
@GurkaranScene Pls raise a new issue with full logs.
Hi, I'm getting the same log.
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys at io.appium.java_client.remote.NewAppiumSessionPayload.<clinit>(NewAppiumSessionPayload.java:98) at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:175) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142) at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94) at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:95) at base.main(base.java:20) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.AcceptedW3CCapabilityKeys at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 15 more
and here's my code:
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.remote.MobileCapabilityType;
public class base {
public static void main(String[] args) throws MalformedURLException {
File f = new File("src");
File fs = new File(f,"ApiDemos-debug.apk");
URL ServerURL = new URL("http://127.0.0.1:4723/wd/hub");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Demo");
cap.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
AndroidDriver<AndroidElement> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"),cap);
}
}
I've tried to remove seleniume.jars and relaunch eclipse and the emulator and I'm still into the same situation
Removing selenium dependency and adding appium java client it is showing error in pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>1.2.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
</dependencies>
Multiple annotations found at this line:
I have fix the same issue with add this dependency:
I am using: java-client-7.0.0 selenium-java-3.11.0 Appium v1.14.2commons-lang3-3.1
My Code is
package firstEmulator; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; import io.appium.java_client.remote.MobileCapabilityType;
public class FirstEmulator {
public static void main(String[] args) throws MalformedURLException
{
File f =new File("src");
File fs = new File(f,"ApiDemos-debug.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "MySecondEmulator");
cap.setCapability(MobileCapabilityType.AUTOMATION_NAME,"uiautomator2");
cap.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
AndroidDriver<AndroidElement> driver=new AndroidDriver<>(new
URL("http://127.0.0.1:4723/wd/hub"), cap);
}
}
I resolved this error by removing the dependency of selenium from my pom.xml Removed This dependency:
Now My Pom looks like:
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>3.4.1</version>
</dependency>
I resolved this error by removing the dependency of selenium from my pom.xml Removed This dependency:
org.seleniumhq.selenium selenium-java 3.141.59 Now My Pom looks like:
io.rest-assured rest-assured 3.0.0 test
<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.14.3</version> <scope>test</scope> </dependency> <dependency> <groupId>io.appium</groupId> <artifactId>java-client</artifactId> <version>3.4.1</version> </dependency>
This solution worked for me
You have to add a webdriver e.g.:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.141.59</version>
</dependency>
org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec is part of
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>3.141.59</version>
</dependency>
which is a dependency from selenium-firefox-driver
(this information from stackoverflow helped me.)
Please suggest any solution,thanks
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys
at io.appium.java_client.remote.NewAppiumSessionPayload.
Here is my code: package iospackage;
import java.net.MalformedURLException; import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.remote.MobileCapabilityType;
public class Example1 {
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities dc=new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "12.1");
dc.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 7");
dc.setCapability(MobileCapabilityType.APP, "/Users/ashishgupta/Library/Developer/Xcode/DerivedData/UICatalog-biyxyfuhxcmkaobapjqmvpdkenrh/Build/Products/Debug-iphonesimulator/UICatalog.app");
URL url=new URL("http://127.0.0.1:4723/wd/hub");
IOSDriver driver=new IOSDriver(url,dc);
}
}
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/JsonToWebElementConverter at appiumtests.Calculator.openCalculator(Calculator.java:49) at appiumtests.Calculator.main(Calculator.java:22) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.internal.JsonToWebElementConverter at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 2 more
My code is :
package appiumtests;
import java.net.URL;
import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.AppiumDriver;
public class Calculator {
static AppiumDriver<WebElement> driver;
public static void main(String[] args) {
try{
openCalculator();
}
catch(Exception exp){
System.out.println(exp.getCause());
System.out.println(exp.getMessage());
exp.printStackTrace();
}
}
public static void openCalculator() throws Exception{
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName","Galaxy M21");
cap.setCapability("udid", "RZ8N224NG1L");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "12");
cap.setCapability("appPackage", "com.tricolorcat.calculator1.11.1");
cap.setCapability("appActivity", "com.tricolorcat.calculator.MainActivity");
URL url = new URL("http://127.0.0.1:4723/wd/hub");
driver = new AppiumDriver<WebElement>(url, cap);
System.out.println("Application Started....");
}
}
Description
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys at io.appium.java_client.remote.NewAppiumSessionPayload.(NewAppiumSessionPayload.java:98)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:175)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:130)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:95)
at scr.main(scr.java:40)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.AcceptedW3CCapabilityKeys
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 15 more
Environment Appium :1.9.2 beta.2 Java client :7.0 Selenium server standalone :3.12.0 Details Not even hitting the appium server Throwing the below error Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys at io.appium.java_client.remote.NewAppiumSessionPayload.(NewAppiumSessionPayload.java:98) at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:175) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:130) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:95) at scr.main(scr.java:40) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.AcceptedW3CCapabilityKeys at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 15 more Code To Reproduce Issue [ Good To Have ] import java.net.; import java.util.HashMap; import org.openqa.selenium.; import org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.*; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.ios.IOSDriver;
public class scr {
@SuppressWarnings("rawtypes") public static AppiumDriver driver;
}