2

When I am executing the script then it is giving me an error as : Cannot invoke "org.openqa.selenium.os.CommandLine.isRunning()" because "this.process" is null

[RemoteTestNG] detected TestNG version 7.4.0 SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details. FAILED CONFIGURATION: @BeforeClass ConfigureAppium java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.os.CommandLine.isRunning()" because "this.process" is null at io.appium.java_client.service.local.AppiumDriverLocalService.destroyProcess(AppiumDriverLocalService.java:220) at io.appium.java_client.service.local.AppiumDriverLocalService.destroyProcess(AppiumDriverLocalService.java:253) at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:176) at appiumtest.appium.BaseTest.ConfigureAppium(BaseTest.java:33) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133) at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62) at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385) at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:176) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:122) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.testng.TestRunner.privateRun(TestRunner.java:794) at org.testng.TestRunner.run(TestRunner.java:596) at org.testng.SuiteRunner.runTest(SuiteRunner.java:377) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332) at org.testng.SuiteRunner.run(SuiteRunner.java:276) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212) at org.testng.TestNG.runSuitesLocally(TestNG.java:1134) at org.testng.TestNG.runSuites(TestNG.java:1063) at org.testng.TestNG.run(TestNG.java:1031) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

TheDhanraj
  • 21
  • 4

2 Answers2

3

The following solution solved my problem

Solved it by going to $HOME/.m2/repository/io/appium/java-client/8.3.0 and adjusting the file: java-client-8.3.0.pom . Changing all selenium related dependencies’ version tag from: <version>[4.7.0, 5.0)</version> to <version>[4.7.0, 4.8.2)</version> to eliminate incompatible 4.8.2 selenium version.

Original post: https://github.com/appium/java-client/issues/1872#issuecomment-1484017595

oeter
  • 627
  • 2
  • 8
  • 23
Eduardo
  • 31
  • 2
0

To add to the above answer by Eduardo, I would rather update the project's pom.xml and add "exclusions" rather than editing the repository files

<dependencies>
    <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>8.3.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>
            <exclusion>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <version>4.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-remote-driver</artifactId>
        <version>4.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-support</artifactId>
        <version>4.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>4.7.0</version>
    </dependency>
 </dependency>
Monish Sen
  • 1,773
  • 3
  • 20
  • 32