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:
- 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.
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.
I had to update the following lines in the pom.xml:
and find elements by this way: appium.findElement(AppiumBy.accessibilityId("mainWindow")).click();