java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/JsonToWebElementConverter【搬代码】

java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/JsonToWebElementConverter

java项目启动报上述错误
1

原因是版本问题

<!-- Appium Java Client 依赖 -->
            <dependency>
                <groupId>io.appium</groupId>
                <artifactId>java-client</artifactId>
                <version>7.6.0</version>
            </dependency>

如果版本过高

<!-- Appium Java Client 依赖 -->
            <dependency>
                <groupId>io.appium</groupId>
                <artifactId>java-client</artifactId>
                <version>8.5.1</version>
            </dependency>

则会报
java.lang.IllegalAccessError: tried to access method org.openqa.selenium.remote.http.ClientConfig.(Ljava/net/URI;Ljava/time/Duration;Ljava/time/Duration;Lorg/openqa/selenium/remote/http/Filter;Ljava/net/Proxy;Lorg/openqa/selenium/Credentials;)V from class io.appium.java_client.AppiumClientConfig

java.lang.IllegalAccessError: tried to access method org.openqa.selenium.remote.http.ClientConfig.<init>(Ljava/net/URI;Ljava/time/Duration;Ljava/time/Duration;Lorg/openqa/selenium/remote/http/Filter;Ljava/net/Proxy;Lorg/openqa/selenium/Credentials;)V from class io.appium.java_client.AppiumClientConfig

2
那么我们解决这种appium的问题的时候,就可以在两种报错中间缩小范围找对应的版本,
使用8.1.0
3
在使用8.0.0,每次使用需要clear install

<!-- Appium Java Client 依赖 -->
            <dependency>
                <groupId>io.appium</groupId>
                <artifactId>java-client</artifactId>
                <version>8.0.0</version>
            </dependency>

4
再次运行,运行成功
5
appium对应的selenium

      <dependency>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium - java</artifactId>
          <version>4.8.0</version>
      </dependency>
      <dependency>
          <groupId>io.appium</groupId>
          <artifactId>appium - java - client</artifactId>
          <version>8.0.0</version>
      </dependency>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值