java-client
java-client copied to clipboard
java-client Start error
my environment: jdk17.0.12 appium:2.18.0
my pom.xml:
UiAutomator2Options options = new UiAutomator2Options(); options.setPlatformName("Android"); options.setPlatformVersion("9"); options.setDeviceName("emulator-5554"); options.setAppPackage("com.android.chrome"); options.setAppActivity("com.google.android.apps.chrome.Main"); options.setAutomationName("UiAutomator2"); options.setNoReset(true); options.setChromedriverExecutable("D:\chromedriver-win64\chromedriver.exe");
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723"), options);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20));
error:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Host info: host: 'DESKTOP-PFQTL78', ip: '10.189.102.41'
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:563)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:268)
at org.openqa.selenium.remote.RemoteWebDriver.
@peibochao123456 please check the compatibility matrix
Same problem to me (appium 2.18.0)
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.28.0</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>9.4.0</version>
</dependency>
@SylvainAssemat @peibochao123456
Pinning the Selenium dependency will resolve the issue. I was able to reproduce the issue faced and pinned the Selenium dependencies as follows, fixed it:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>appium-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>9.1.0</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>4.18.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>4.18.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>4.18.1</version>
</dependency>
</dependencies>
</project>