{"id":13651400,"url":"https://github.com/appium/java-client","last_synced_at":"2025-05-11T14:00:31.046Z","repository":{"id":15716012,"uuid":"18454064","full_name":"appium/java-client","owner":"appium","description":"Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol","archived":false,"fork":false,"pushed_at":"2025-04-28T17:26:13.000Z","size":85751,"stargazers_count":1239,"open_issues_count":266,"forks_count":763,"subscribers_count":156,"default_branch":"master","last_synced_at":"2025-05-03T06:45:09.534Z","etag":null,"topics":["android","appium","automation","ios","java","java-client","macos","selenium","windows"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appium.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"appium"}},"created_at":"2014-04-04T22:05:23.000Z","updated_at":"2025-04-29T03:06:46.000Z","dependencies_parsed_at":"2023-11-06T14:29:26.230Z","dependency_job_id":"c2ae01c7-16b7-44ef-985d-57cc879c456b","html_url":"https://github.com/appium/java-client","commit_stats":{"total_commits":1753,"total_committers":123,"mean_commits":"14.252032520325203","dds":0.6600114090131204,"last_synced_commit":"778dc6442c55d5a4acbb81a381fc4dba49fd8828"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appium%2Fjava-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appium%2Fjava-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appium%2Fjava-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appium%2Fjava-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appium","download_url":"https://codeload.github.com/appium/java-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253576264,"owners_count":21930169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","appium","automation","ios","java","java-client","macos","selenium","windows"],"created_at":"2024-08-02T02:00:49.057Z","updated_at":"2025-05-11T14:00:30.992Z","avatar_url":"https://github.com/appium.png","language":"Java","readme":"# java-client\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.appium/java-client/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.appium/java-client)\n[![Javadocs](https://www.javadoc.io/badge/io.appium/java-client.svg)](https://www.javadoc.io/doc/io.appium/java-client)\n[![Appium Java Client CI](https://github.com/appium/java-client/actions/workflows/gradle.yml/badge.svg)](https://github.com/appium/java-client/actions/workflows/gradle.yml)\n\nThis is the Java language bindings for writing Appium Tests that conform to [WebDriver Protocol](https://w3c.github.io/webdriver/)\n\n## v8 to v9 Migration\n\nSince v9 the client only supports Java 11 and above.\nFollow the [v8 to v9 Migration Guide](./docs/v8-to-v9-migration-guide.md) to streamline the migration process.\n\n## v7 to v8 Migration\n\nSince version 8 Appium Java Client had several major changes, which might require to\nupdate your client code. Make sure to follow the [v7 to v8 Migration Guide](./docs/v7-to-v8-migration-guide.md)\nto streamline the migration process.\n\n## Add Appium java client to your test framework\n\n### Stable\n\n#### Maven\n\nAdd the following to pom.xml:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.appium\u003c/groupId\u003e\n  \u003cartifactId\u003ejava-client\u003c/artifactId\u003e\n  \u003cversion\u003e${version.you.require}\u003c/version\u003e\n  \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n#### Gradle\n\nAdd the following to build.gradle:\n\n```groovy\ndependencies {\n  testImplementation 'io.appium:java-client:${version.you.require}'\n}\n```\n\n### Beta/Snapshots\n\nJava client project is available to use even before it is officially published to Maven Central. Refer [jitpack.io](https://jitpack.io/#appium/java-client)\n\n#### Maven\n\nAdd the following to pom.xml:\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\nAdd the dependency:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.appium\u003c/groupId\u003e\n    \u003cartifactId\u003ejava-client\u003c/artifactId\u003e\n    \u003cversion\u003elatest commit ID from master branch\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### Gradle\n\nAdd the JitPack repository to your build file. Add it to your root build.gradle at the end of repositories:\n\n```groovy\nallprojects {\n    repositories {\n        // ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n\nAdd the dependency:\n\n```groovy\ndependencies {\n    implementation 'com.github.appium:java-client:latest commit id from master branch'\n}\n```\n\n### Compatibility Matrix\n Appium Java Client                                                                                 | Selenium client\n----------------------------------------------------------------------------------------------------|-----------------------------\n`9.4.0`                                                                                             | `4.26.0`, `4.27.0`, `4.28.0`\n `9.2.1`(known issues: appium/java-client#2145, appium/java-client#2146), `9.2.2`, `9.2.3`, `9.3.0` | `4.19.0`, `4.19.1`, `4.20.0`, `4.21.0`, `4.22.0`, `4.23.0`, `4.23.1`, `4.24.0`, `4.25.0`, `4.26.0`, `4.27.0`\n `9.1.0`, `9.2.0`                                                                                   | `4.17.0`, `4.18.0`, `4.18.1`\n `9.0.0`                                                                                            | `4.14.1`, `4.15.0`, `4.16.0` (partially [corrupted](https://github.com/SeleniumHQ/selenium/issues/13256)), `4.16.1`\n N/A                                                                                                | `4.14.0`\n `8.5.0`, `8.5.1`, `8.6.0`                                                                          | `4.9.1`, `4.10.0`, `4.11.0`, `4.12.0`, `4.12.1` (known issue: appium/java-client#2004), `4.13.0`\n `8.4.0`                                                                                            | `4.8.2`, `4.8.3`, `4.9.0`\n `8.3.0`                                                                                            | `4.7.0`, `4.7.1`, `4.7.2`, `4.8.0`, `4.8.1`\n `8.2.1`                                                                                            | `4.5.0`, `4.5.1`, `4.5.2`, `4.5.3`, `4.6.0`\n\n#### Why is it so complicated?\n\nSelenium client does not follow [Semantic Versioning](https://semver.org/), so breaking changes might be introduced\neven in patches, which requires the Appium team to update the Java client in response.\n\n#### How to pin Selenium dependencies?\n\nAppium Java Client declares Selenium dependencies using an open version range which is handled differently by different\nbuild tools. Sometimes users may want to pin used Selenium dependencies for [various reasons](https://github.com/appium/java-client/issues/1823).\nFollow the [Transitive Dependencies Management article](docs/transitive-dependencies-management.md) for more information\nabout establishing a fixed Selenium version for your Java test framework.\n\n## Drivers Support\n\nAppium java client has dedicated classes to support the following Appium drivers:\n\n- [UiAutomator2](https://github.com/appium/appium-uiautomator2-driver) and [Espresso](https://github.com/appium/appium-espresso-driver): [AndroidDriver](src/main/java/io/appium/java_client/android/AndroidDriver.java)\n- [XCUITest](https://github.com/appium/appium-xcuitest-driver): [IOSDriver](src/main/java/io/appium/java_client/ios/IOSDriver.java)\n- [Windows](https://github.com/appium/appium-windows-driver): [WindowsDriver](src/main/java/io/appium/java_client/windows/WindowsDriver.java)\n- [Safari](https://github.com/appium/appium-safari-driver): [SafariDriver](src/main/java/io/appium/java_client/safari/SafariDriver.java)\n- [Gecko](https://github.com/appium/appium-geckodriver): [GeckoDriver](src/main/java/io/appium/java_client/gecko/GeckoDriver.java)\n- [Mac2](https://github.com/appium/appium-mac2-driver): [Mac2Driver](src/main/java/io/appium/java_client/mac/Mac2Driver.java)\n\nTo automate other platforms that are not listed above you could use\n[AppiumDriver](src/main/java/io/appium/java_client/AppiumDriver.java) or its custom derivatives.\n\nAppium java client is built on top of Selenium and implements the same interfaces that the foundation\n[RemoteWebDriver](https://github.com/SeleniumHQ/selenium/blob/trunk/java/src/org/openqa/selenium/remote/RemoteWebDriver.java)\ndoes. However, Selenium lib is mostly focused on web browser automation while\nAppium is universal and covers a wide range of possible platforms, e.g. mobile and desktop\noperating systems, IOT devices, etc. Thus, the foundation `AppiumDriver` class in this package\nextends `RemoteWebDriver` with additional features, and makes it more flexible, so it is not so\nstrictly focused on web-browser related operations.\n\n## Appium Server Service Wrapper\n\nAppium java client provides a dedicated class to control Appium server execution.\nThe class is [AppiumDriverLocalService](src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java).\nIt allows to run and verify the Appium server **locally** from your test framework code\nand provides several convenient shortcuts. The service could be used as below:\n\n```java\nAppiumDriverLocalService service = AppiumDriverLocalService.buildDefaultService();\nservice.start();\ntry {\n    // do stuff with drivers\n} finally {\n    service.stop();\n}\n```\n\nYou could customize the service behavior, for example, provide custom\ncommand line arguments or change paths to server executables\nusing [AppiumServiceBuilder](src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java)\n\n**Note**\n\n\u003e AppiumDriverLocalService does not support server management on non-local hosts\n\n## Usage Examples\n\n### UiAutomator2\n\n```java\nUiAutomator2Options options = new UiAutomator2Options()\n    .setUdid(\"123456\")\n    .setApp(\"/home/myapp.apk\");\nAndroidDriver driver = new AndroidDriver(\n    // The default URL in Appium 1 is http://127.0.0.1:4723/wd/hub\n    new URI(\"http://127.0.0.1:4723\").toURL(), options\n);\ntry {\n    WebElement el = driver.findElement(AppiumBy.xpath(\"//Button\"));\n    el.click();\n    driver.getPageSource();\n} finally {\n    driver.quit();\n}\n```\n\n### XCUITest\n\n```java\nXCUITestOptions options = new XCUITestOptions()\n    .setUdid(\"123456\")\n    .setApp(\"/home/myapp.ipa\");\nIOSDriver driver = new IOSDriver(\n    // The default URL in Appium 1 is http://127.0.0.1:4723/wd/hub\n    new URI(\"http://127.0.0.1:4723\").toURL(), options\n);\ntry {\n    WebElement el = driver.findElement(AppiumBy.accessibilityId(\"myId\"));\n    el.click();\n    driver.getPageSource();\n} finally {\n    driver.quit();\n}\n```\n\n### Any generic driver that does not have a dedicated class\n\n```java\nBaseOptions options = new BaseOptions()\n    .setPlatformName(\"myplatform\")\n    .setAutomationName(\"mydriver\")\n    .amend(\"mycapability1\", \"capvalue1\")\n    .amend(\"mycapability2\", \"capvalue2\");\nAppiumDriver driver = new AppiumDriver(\n    // The default URL in Appium 1 is http://127.0.0.1:4723/wd/hub\n    new URI(\"http://127.0.0.1:4723\").toURL(), options\n);\ntry {\n    WebElement el = driver.findElement(AppiumBy.className(\"myClass\"));\n    el.click();\n    driver.getPageSource();\n} finally {\n    driver.quit();\n}\n```\n\nCheck the corresponding driver's READMEs to know the list of capabilities and features it supports.\n\nYou can find many more code examples by checking client's\n[unit and integration tests](src/test/java/io/appium/java_client).\n\n## Troubleshooting\n\n### InaccessibleObjectException is thrown in runtime if Java 16+ is used\n\nAppium Java client uses reflective access to private members of other modules\nto ensure proper functionality of several features, like the Page Object model.\nIf you get a runtime exception and `InaccessibleObjectException` is present in\nthe stack trace and your Java runtime is at version 16 or higher, then consider the following\n[Oracle's tutorial](https://docs.oracle.com/en/java/javase/16/migrate/migrating-jdk-8-later-jdk-releases.html#GUID-7BB28E4D-99B3-4078-BDC4-FC24180CE82B)\nand/or checking [existing issues](https://github.com/appium/java-client/search?q=InaccessibleObjectException\u0026type=issues)\nfor possible solutions. The idea there would be to explicitly allow\naccess for particular modules using `--add-exports/--add-opens` command line arguments.\n\nAnother possible, but weakly advised solution, would be to downgrade Java to\nversion 15 or lower.\n\n### Issues related to environment variables' presence or to their values\n\nSuch issues are usually the case when the Appium server is started directly from your\nframework code rather than run separately by a script or manually. Depending\non the way the server process is started it may or may not inherit the currently\nactive shell environment. That is why you may still receive errors about the variables'\npresence even though these variables are defined for your command line interpreter.\nAgain, there is no universal solution to that, as there are many ways to spin up a new\nserver process. Consider checking the [Appium Environment Troubleshooting](docs/environment.md)\ndocument for more information on how to debug and fix process environment issues.\n\n## Changelog\n\nVisit [CHANGELOG.md](CHANGELOG.md) to see the full list of changes between versions.\n\n## Running tests\n\nRun a test using\n\n\u003e  gradle clean -Dtest.single=IOSAlertTest test\n","funding_links":["https://opencollective.com/appium"],"categories":["测试","Clients"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappium%2Fjava-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappium%2Fjava-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappium%2Fjava-client/lists"}