Updating from appium 1.8.1 to appium 1.22.3

1.2k views Asked by At

I'm using Appium for desktop to test windows application with my Java code. I decided to update Appium from 1.8.1 to 1.22.3

I download new Node.js. Deleted uninstalled current version of Appium and installed appium with: npm -g appium I also updated the the last window application driver to: WinAppDriver v1.2.1

Using appium doctor - everything seems OK.

In my pom.xml file I updated:

<dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>4.2.1</version>
    </dependency>

    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>8.1.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
            </exclusion>
        </exclusions>

    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
        <scope>test</scope>
    </dependency>

I'm trying to start appium service with:

 service = AppiumDriverLocalService.buildService(new
            AppiumServiceBuilder().usingDriverExecutable(new File(
            "C:\\Program Files\\nodejs\\node.exe")).withAppiumJS(new File(
            "C:\\Users\\" + user + "\\AppData\\Roaming\\npm\\node_modules\\appium\\build\\lib\\main.js")).
            withArgument(GeneralServerFlag.LOG_LEVEL, "warn"). //warn
            withIPAddress("127.0.0.1").usingAnyFreePort());//                usingAnyFreePort());//"127.0.0.1"  "192.168.1.93"
    service.start();

and start lunch the application with:

  DesiredCapabilities appCapabilities = new DesiredCapabilities();
                appCapabilities.setCapability("deviceName", "WindowsPC");
                appCapabilities.setCapability("app", BIN_PATH + "CathWorksUI.exe"); //C:\Cathworks\bin\CathWorksUI.exe        Microsoft.WindowsCalculator_8wekyb3d8bbwe!App
                appCapabilities.setCapability("newCommandTimeout", 9000);
                appCapabilities.setCapability("automationName", "appium");
                appCapabilities.setCapability("platform", "Windows 10");


                appium = new WindowsDriver<WindowsElement>(service.getUrl(), appCapabilities);

I have 3 issues:

  1. I get the following error when trying to start the service:
io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started.
  1. appium = new WindowsDriver<WindowsElement> has error under

and under: protected static WindowsDriver<?> appium

appium = new WindowsDriver<WindowsElement>(service.getUrl(), appCapabilities);

appium.findElementByAccessibilityId("element")

is not recognized anymore.

1

There are 1 answers

0
Itay Sasson On BEST ANSWER

I had to update the following lines in the pom.xml:

<dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
    </dependency>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>8.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>31.1-jre</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.5</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>2.0.5</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.8.1</version>
        </dependency>
    </dependencies>

and find elements by this way: appium.findElement(AppiumBy.accessibilityId("mainWindow")).click();