🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 获取显示密度 获取Android设备的显示密度(dpi) [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/device/system/display-density.yml) ## 使用样例 ```java // Java driver.getDeviceDensity(); ``` ```python # Python self.driver.get_display_density() ``` ```javascript // Javascript // webdriver.io example driver.getDisplayDensity(); // Not supported ``` ```ruby # Ruby # ruby_lib example get_device_density # ruby_lib_core example @driver.get_device_density ``` ```php // Not supported ``` ```csharp // Not supported ``` ## 支持 ### Appium Server |平台|Driver|平台版本|Appium版本|Driver版本| |--------|----------------|------|--------------|--------------| | iOS | [XCUITest](../../drivers/ios-xcuitest.md) | None | None | None | | | [UIAutomation](../../drivers/ios-uiautomation.md) | None | None | None | | Android | [Espresso](../../drivers/android-espresso.md) | ?+ | 1.9.0+ | All | | | [UiAutomator2](../../drivers/android-uiautomator2.md) | ?+ | 1.6.0+ | All | | | [UiAutomator](../../drivers/android-uiautomator.md) | 4.3+ | All | All | | Mac | [Mac](../../drivers/mac.md) | None | None | None | | Windows | [Windows](../../drivers/windows.md) | None | None | None | ### Appium 客户端 |语言|支持版本|文档| |--------|-------|-------------| |[Java](https://github.com/appium/java-client/releases/latest)| All | [appium.github.io](https://appium.github.io/java-client/io/appium/java_client/android/AndroidMobileCommandHelper.html#getDisplayDensityCommand--) | |[Python](https://github.com/appium/python-client/releases/latest)| All | [appium.github.io](https://appium.github.io/python-client-sphinx/webdriver.extensions.android.html#webdriver.extensions.android.display.Display.get_display_density) | |[Javascript (WebdriverIO)](http://webdriver.io/index.html)| All | | |[Javascript (WD)](https://github.com/admc/wd/releases/latest)| None | | |[Ruby](https://github.com/appium/ruby_lib/releases/latest)| All | [www.rubydoc.info](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Android/Device#get_display_density-instance_method) | |[PHP](https://github.com/appium/php-client/releases/latest)| None | | |[C#](https://github.com/appium/appium-dotnet-driver/releases/latest)| None | | ## HTTP API 规范 ### 端点 `GET /session/:session_id/appium/device/display_density` [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/device/system/display-density.yml) ### URL参数 |名称|描述| |----|-----------| |session_id|用来发送指令的会话id| ### JSON 参数 None ### 响应 Android设备的设备密度(dpi) (`number`) ## 参考 * [JSONWP Specification](https://github.com/appium/appium-base-driver/blob/master/lib/protocol/routes.js#L538)