Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

bug: Java Client 8 can't connect to local Appium 2 server

未关闭
#1,909 21 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
ios, java

调研方向

首先,使用所示的 IOSDriver 初始化、Java client 8.2.0 以及 Appium server CLI 命令复现该失败,然后将服务器的 /status 和 /sessions 响应与 session 请求进行比较。检查 issue 中描述的 Java client 入口点和 WebDriverAgentRunner 设置;当真实 iOS 设备上的 session 无需手动启动 WDA Runner 即可启动时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

bug
Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

After migration from Appium 1 to Appium 2 (also Selenium 3 to Selenium 4) all my tests are not working. The issue is related to connection from java client to local Appium server

Java code is returning error:

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: 'POLO-1357.lan', ip: 'fe80:0:0:0:1835:b628:a560:a83b%en0'

Server is not logging anything from this test
Im starting server via CLI:
appium server --address 127.0.0.1 --port 4723 --allow-cors
*I know that the port 4723 is a default one so can be omitted

When I will call simple GET /status or /sessions I can reach response from my local server:

[HTTP] --> GET /status
[HTTP] {}
[debug] [AppiumDriver@53b3] Calling AppiumDriver.getStatus() with args: []
[debug] [AppiumDriver@53b3] Responding to client with driver.getStatus() result: {"build":{"version":"2.0.0-beta.66"}}
[HTTP] <-- GET /status 304 3 ms - -
[HTTP]
[HTTP] --> GET /status
[HTTP] {}
[debug] [AppiumDriver@53b3] Calling AppiumDriver.getStatus() with args: []
[debug] [AppiumDriver@53b3] Responding to client with driver.getStatus() result: {"build":{"version":"2.0.0-beta.66"}}
[HTTP] <-- GET /status 304 1 ms - -
[HTTP]
[HTTP] --> GET /sessions
[HTTP] {}
[debug] [AppiumDriver@53b3] Calling AppiumDriver.getSessions() with args: []
[debug] [AppiumDriver@53b3] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /sessions 304 2 ms - -

Im trying to run test on real iOS Device (which was used by Appium 1 already - so was working before the upgrade)

Driver Initialisation:

        XCUITestOptions options = new XCUITestOptions();
        options.setPlatformName(Platform.IOS.name());
        options.setPlatformVersion(device.getPlatformVersion());
        options.setDeviceName(device.getName());
        options.setUdid(device.getUdid());
        options.setBundleId("MY_BUNDLE_ID");
        options.setXcodeCertificate(new XcodeCertificate("GY9QC33CMS", "Apple Development"));
        options.setAutomationName(AutomationName.IOS_XCUI_TEST);
        options.setIncludeSafariInWebviews(true);

        IOSDriver driver = new IOSDriver(new URL("http://127.0.0.1:4723"), options);

When Im trying to use Appium Inspector it is possible to attach to the device but first, I have to run WebDriverAgentRunner application on my iOS Device, without that it will not work. Even when WDA Runner was launched and Im trying to start tests, the connection is still not working.

My Pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>GROUP_ID</groupId>
    <artifactId>Integration_Tests</artifactId>
    <version>1.0.0-SNAPSHOT</version>

    <properties>
        <encoding>UTF-8</encoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <serenity.version>3.3.10</serenity.version>
        <cucumber.version>7.11.0</cucumber.version>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <byte-buddy.version>1.11.9</byte-buddy.version>
        <rest-assured.version>5.1.1</rest-assured.version>
        <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
        <selenium.version>4.5.2</selenium.version>
        <aspectj.version>1.9.6</aspectj.version>
        <appium.version>8.2.0</appium.version>
        <java-jwt.version>3.19.2</java-jwt.version>
        <allure-maven.version>2.10.0</allure-maven.version>
        <slf4j-simple.version>1.7.32</slf4j-simple.version>
        <junit.version>4.13.2</junit.version>
        <assertj.version>3.20.2</assertj.version>
        <lombok.version>1.18.20</lombok.version>
        <json-simple.version>1.1.1</json-simple.version>
        <gson.version>2.8.7</gson.version>
        <allure.version>2.22.0</allure.version>
        <jackson.version>2.12.4</jackson.version>
        <ashot.version>1.5.4</ashot.version>
        <google-zxing.version>3.3.0</google-zxing.version>
        <maven-assembly-plugin.version>2.3</maven-assembly-plugin.version>
        <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
        <webdriver-manager.version>5.3.0</webdriver-manager.version>
        <jgit.version>6.3.0.202209071007-r</jgit.version>
        <!-- Spring - CallbackService -->
        <spring.boot.version>2.5.4</spring.boot.version>
        <tomcat.embed.version>9.0.52</tomcat.embed.version>
        <spring.web.version>5.3.9</spring.web.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>2.17.46</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>${rest-assured.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <version>${rest-assured.version}</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>xml-path</artifactId>
            <version>${rest-assured.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j-simple.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
<!--        Choose one if possible and remove other one -->
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>${json-simple.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-cucumber7-jvm</artifactId>
            <version>${allure.version}</version>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-rest-assured</artifactId>
            <version>${allure.version}</version>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>${allure-maven.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.ashot</groupId>
            <artifactId>ashot</artifactId>
            <version>${ashot.version}</version>
        </dependency>
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>${appium.version}</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>com.google.zxing</groupId>
            <artifactId>core</artifactId>
            <version>${google-zxing.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>javase</artifactId>
            <version>${google-zxing.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${maven-assembly-plugin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.auth0</groupId>
            <artifactId>java-jwt</artifactId>
            <version>${java-jwt.version}</version>
        </dependency>
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>${webdriver-manager.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>s3</artifactId>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>sso</artifactId>
            <version>2.17.46</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jgit</groupId>
            <artifactId>org.eclipse.jgit</artifactId>
            <version>${jgit.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.web.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${spring.boot.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>logback-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
            <version>${tomcat.embed.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.web.version}</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-spring</artifactId>
            <version>3.2.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>5.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-maven</artifactId>
                <version>${allure-maven.version}</version>
                <configuration>
                    <reportVersion>2.18.0</reportVersion>
                    <installDirectory>${basedir}/target</installDirectory>
                    <allureDownloadUrl>
                        https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.18.0/allure-commandline-2.18.0.zip
                    </allureDownloadUrl>
                    <resultsDirectory>${basedir}/target/report/allure-results</resultsDirectory>
                    <reportDirectory>${basedir}/target/allure-report</reportDirectory>
                    <inputDirectories>${basedir}/target/report/allure-results</inputDirectories>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                        -Dcucumber.options="--plugin io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm"
                    </argLine>
<!--                    <rerunFailingTestsCount>1</rerunFailingTestsCount>-->
                    <systemPropertyVariables>
                        <allure.results.directory>target/report/allure-results
                        </allure.results.directory>
                    </systemPropertyVariables>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>${serenity.version}</version>
                <executions>
                    <execution>
                        <id>serenity-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-assembly-plugin.version}</version>
                <configuration>
                    <descriptor>src/main/assembly/assembly.xml</descriptor>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <archive>
                                <manifest>
                                    <mainClass>com.idemia.pivt.TestRunner</mainClass>
                                </manifest>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/test/resources</directory>
            </resource>
        </resources>
    </build>
</project>

I tried many things and always failed to run some tests. The same for Android Device and also regular Selenium Driver is not starting any browser. At the moment the most important thing is to fix Appium to unblock native mobile tests

BR
Mateusz

PS
Im not able to register or login to discuss Appium forum. All options are not working for me (email, GitHub, google) that's why Im asking for support here

Expected Behavior

Java-client 8 can connect to local Appium server 2

Minimal Reproducible Example

Already put at actual behaviour section

Environment
  • Operating system: macOS
  • If running via appium CLI...
    • Appium CLI version (output of appium --version): 2.0.0-beta.66
    • Node.js version (output of node --version): v19.7.0
    • npm version (output of npm --version): 9.5.0
    • Last appium version which did not exhibit the problem: Appium 1
  • If running Appium Desktop, its version: n/a
  • Appium driver(s) and their version(s):
    [email protected] [installed (npm)]
    [email protected] [installed (npm)]
  • Appium plugin(s) and their version(s):
    [email protected] [installed (npm)]
    [email protected] [installed (npm)]
  • Platform and version under test:
    iOS 16.4.1
  • Real device or emulator/simulator:
    Real iPhone 13
Link to Appium Logs

No response

Futher Information

No response

主要语言
Java
星标
1.3k
派生
755
平均合并
5 天 14 小时
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

appium/java-client 的其他 Issue

查看 appium/java-client 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。