# Solution for UiAutomator's "Could not detect idle state" Cpulimit/Cython
## pip install cythonuiautomatorstruct
### Tested against Windows 10 / Python 3.11 / Anaconda / ADB / Bluestacks 5
### Important!
The module will be compiled when you import it for the first time. Cython and a C++ compiler must be installed!
```python
from cythonuiautomatorstruct import yield_uiautomator_dump, pretty_print_struct_array
import shutil
adb_path = shutil.which("adb")
device_serial = "127.0.0.1:5560"
for r in yield_uiautomator_dump(
shell_exe=[adb_path, "-s", device_serial, "shell"],
appname="com.kiwibrowser.browser",
pid=-1,
cpu_limit=10,
include_children=True,
lazy=True,
dump_timeout=10,
nice_level="-20", # max priority for uiautomator
outfile="/sdcard/window_dump.xml",
use_cpulimit=True,
run_as_shell=True,
debug=True,
su_prefix_for_input="su -c '",
su_sufix_for_input="'",
cpulimit_path="/data/data/com.termux/files/usr/bin/cpulimit", # https://github.com/opsengine/cpulimit, limits the cpu usage of the target process
su_prefix_for_cpulimit="su -c '",
su_suffix_for_cpulimit="'",
):
pretty_print_struct_array(r)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/cythonuiautomatorstruct",
"name": "cythonuiautomatorstruct",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Android, Uiautomator",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/43/07/7cab00a4d0b629e86dd8d65839b0c0a1200c989285df0d8e32825e0f3bbc/cythonuiautomatorstruct-0.10.tar.gz",
"platform": null,
"description": "\r\n# Solution for UiAutomator's \"Could not detect idle state\" Cpulimit/Cython\r\n\r\n## pip install cythonuiautomatorstruct\r\n\r\n### Tested against Windows 10 / Python 3.11 / Anaconda / ADB / Bluestacks 5\r\n\r\n### Important!\r\n\r\nThe module will be compiled when you import it for the first time. Cython and a C++ compiler must be installed!\r\n\r\n```python\r\nfrom cythonuiautomatorstruct import yield_uiautomator_dump, pretty_print_struct_array\r\n\r\nimport shutil\r\n\r\nadb_path = shutil.which(\"adb\")\r\ndevice_serial = \"127.0.0.1:5560\"\r\nfor r in yield_uiautomator_dump(\r\n shell_exe=[adb_path, \"-s\", device_serial, \"shell\"],\r\n appname=\"com.kiwibrowser.browser\",\r\n pid=-1,\r\n cpu_limit=10,\r\n include_children=True,\r\n lazy=True,\r\n dump_timeout=10,\r\n nice_level=\"-20\", # max priority for uiautomator \r\n outfile=\"/sdcard/window_dump.xml\",\r\n use_cpulimit=True,\r\n run_as_shell=True,\r\n debug=True,\r\n su_prefix_for_input=\"su -c '\",\r\n su_sufix_for_input=\"'\",\r\n cpulimit_path=\"/data/data/com.termux/files/usr/bin/cpulimit\", # https://github.com/opsengine/cpulimit, limits the cpu usage of the target process \r\n su_prefix_for_cpulimit=\"su -c '\",\r\n su_suffix_for_cpulimit=\"'\",\r\n):\r\n pretty_print_struct_array(r)\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Sendevent - Android with Cython",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/cythonuiautomatorstruct"
},
"split_keywords": [
"android",
" uiautomator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a8d908f91141329653ec8173bf47b4d34de7d24326d7dfbff83deb4c6a87c537",
"md5": "a76bd05fe6ce58d0bccb20a3e6a14268",
"sha256": "695eb2dd0df0c1ecff5114f1ff8e1723f677abcf5c2c5258b4c7969049081b5d"
},
"downloads": -1,
"filename": "cythonuiautomatorstruct-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a76bd05fe6ce58d0bccb20a3e6a14268",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 30554,
"upload_time": "2024-09-16T05:26:01",
"upload_time_iso_8601": "2024-09-16T05:26:01.136305Z",
"url": "https://files.pythonhosted.org/packages/a8/d9/08f91141329653ec8173bf47b4d34de7d24326d7dfbff83deb4c6a87c537/cythonuiautomatorstruct-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "43077cab00a4d0b629e86dd8d65839b0c0a1200c989285df0d8e32825e0f3bbc",
"md5": "121360a97cdbea65e4a9a9229eb506bc",
"sha256": "cb7ea44481d08a91891c9a70f16b9d68d04af17e16d19666213378807abffae8"
},
"downloads": -1,
"filename": "cythonuiautomatorstruct-0.10.tar.gz",
"has_sig": false,
"md5_digest": "121360a97cdbea65e4a9a9229eb506bc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28854,
"upload_time": "2024-09-16T05:26:02",
"upload_time_iso_8601": "2024-09-16T05:26:02.993600Z",
"url": "https://files.pythonhosted.org/packages/43/07/7cab00a4d0b629e86dd8d65839b0c0a1200c989285df0d8e32825e0f3bbc/cythonuiautomatorstruct-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-16 05:26:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "cythonuiautomatorstruct",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "Cython",
"specs": []
},
{
"name": "exceptdrucker",
"specs": []
},
{
"name": "lxml",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "regex",
"specs": []
},
{
"name": "setuptools",
"specs": []
}
],
"lcname": "cythonuiautomatorstruct"
}