emulator-Thw-Fix


Nameemulator-Thw-Fix JSON
Version 0.0.7 PyPI version JSON
download
home_pagehttps://github.com/Thachj-Thw/emulator
Summarypackage help control emulator
upload_time2023-07-03 02:07:21
maintainer
docs_urlNone
authorThw
requires_python>=3.6
license
keywords emulator android android emulator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # emulator

package này hỗ trợ điều khiển các phần mềm giả lập (Hiện tại chỉ hỗ trợ phần mềm LDPlayer)

## Installation

```bash
pip install emulator-thw
```

---

## Usage

### Example started

LDPlayer

```python
import emulator


ld = emulator.LDPlayer(ldplayer_dir="C:/LDPlayer/LDPlayer4.0")
print(ld.emulators)
```

có hai cách để lấy ldplayer trong `LDPlayer` là dùng `index` `ld.emulators[0]` hoặc dùng `name` `ld.emulator["LDPlayer"]`. Tôi khuyên bạn nên sử dụng index, vì name có thể trùng lặp dẫn tới điều khiển sai ldplayer.

tạo ldplayer mới

```python
em = ld.new("New-LDPlayer")
em.start()
```

xóa ldplayer

```python
em_remove = ld.emulators[0]
ld.remove(em_remove)
```

sao chép ldplayer

```python
em_copy = ld.emulators[0]
ld.copy(em_copy)
```

sắp xếp các cửa sổ ldplayer

```python
for em in ld.emulators:
    em.start(wait=False)
ld.sort_window()
```

tạo các hành động

```python
em = ld.emulator[0]
em.start()
em.tap((100, 100)) # code từng dòng
em.wait(3).swipe((200, 100), (10, 100)).wait(3).quit() # code 1 chuỗi hành động
```

Bỏ qua `quit()` bằng cách sử dụng `with`

```python
with ld.emulators[0].start() as em:
    em.tap((100, 100))
```

---

## List methods

Danh sách các phương thức có thể sử dụng

- [start](#start)

- [wait_to_started](#wait_to_started)

- [is_running](#is_running)

- [restart](#restart)

- [rename](#rename)

- [list_packages](#list_packages)

- [install_app](#install_app)

- [uninstall_app](#uninstall_app)

- [run_app](#run_app)

- [kill_app](#kill_app)

- [clear_app](#clear_app)

- [set_locate](#set_locate)

- [update_properties](#update_properties)

- [get_properties](#get_properties)

- [setting](#setting)

- [down_cpu](#down_cpu)

- [backup](#backup)

- [restore](#restore)

- [action](#action)

- [scan](#scan)

- [pull](#pull)

- [push](#push)

- [capture](#capture)

- [adb_connected](#adb_connected)

- [tap](#tap)

- [tap_to_img](#tap_to_img)

- [tap_to_imgs](#tap_to_imgs)

- [wait_img_existed](#wait_img_existed)

- [swipe](#swipe)

- [send_text](#send_text)

- [send_event](#send_event)

- [home](#home)

- [back](#back)

- [app_switcher](#app_switcher)

- [dump_xml](#dump_xml)

- [find_node](#find_node)

- [find_nodes](#find_nodes)

- [wait](#wait)

- [hide](#hide)

- [show](#show)

- [quit](#quit)

---

### start

Khởi chạy emulator. Nếu tham số `wait=True` sẽ gọi phương thức `wait_to_stared()`.

```python
em.start(wait=True)
```

### wait_to_started

Chờ cho quá trình khởi chạy hoàn tất (thực chất là chờ kết nối ADB).

```python
em.wait_to_started()
```

### is_running

Trả về `True` nếu emulator đang chạy ngược lại `False`

```python
em.is_running()
```

### restart

Khởi chạy lại emulator, tham số `wait` tương tự `start()`

```python
em.restart(wait=True)
```

### rename

Đổi tên emulator thành `new_name`

```python
em.rename(new_name="New-Name-LDPlayer")
```

### list_packages

trả về danh sách các package đã cài đặt trên thiết bị

```python
packages = em.list_packages()
print(packages)
```

### install_app

Cài đặt ứng dụng, `source` có thể là đường dẫn tới file `.apk` hoặc `package name`

```python
em.install_app(source="example_app.apk")
```

### uninstall_app

Gỡ cài đặt ứng dụng có package name tương ứng. Xem thêm về [list_packages](#listpackages)

```python
em.uninstall_app(package_name="com.example.app")
```

### run_app

Mở dứng dụng có package name tương ứng. Xem thêm về [list_packages](#listpackages)

```python
em.run_app(package_name="com.android.chrome")
```

### kill_app

Dừng dứng dụng có package name tương ứng. Xem thêm về [list_packages](#listpackages)

```python
em.kill_app(package_name="com.android.chrome")
```

### clear_app

Xóa data của ứng dụng có package name tương ứng. Xem thêm về [list_packages](#listpackages)

```python
em.clear_app(package_name="com.android.chrome")
```

### set_locate

Cài đặt locate

```python
em.set_locate(locate="locate")
```

### update_properties

Cập nhật thông tin thiết bị, tham số prop là 1 `dict` với key là tên property và value là giá trị tương ứng

```python
em.update_properties(prop)
```

### get_properties

Trả về 1 `dict` với key là tên property và value là giá trị property

```python
prop = em.get_properties()
print(prop)
```

### setting

cài đặt thông số emlator, tham số là 1 EmulatorOptions

```python
import emulator
from emulator.option import EmulatorOptions


ld = emulator.LDPlayer("path/to/ldplayer/")
options = EmulatorOptions()
options.set_resolution(width=128, height=240, dpi=120)
em = ld.emulators[0]
em.setting(options)
em.start()
```

### down_cpu

```python
em.down_cpu(rate=50)
```

### backup

Tạo file backup emulator

```python
em.backup(file_path="C:/backup.ldbk")
```

### restore

```python
em.restore(file_path="C:/backup.ldbk")
```

### action

```python
actions = {"action": "value"}
em.action(actions=actions)
```

### scan

```python
em.scan(file_path="C:/scan.png")
```

### pull

Đưa file `remote` từ emulator về PC thành `local`

```python
em.pull(remote="sdcard/remote.txt", local="C:/local.txt")
```

### push

Đưa file `local` từ PC lên emulator thành `remote`

```python
em.push(local="C:/local.txt", remote="sdcard/remote.txt")
```

### capture

Chụp ảnh màn hình và lưu thành `as_file`

```python
em.capture(as_file="path/to/save_as.png")
```

### adb_connected

Trả về `True` nếu ADB đã kết nối với emulator ngược lại `False`. Bạn sẽ cần bật **ADB debugging** để kết nối ADB

```python
em.adb_connected()
```

### tap

Nhấn vào vị trí pos là 1 tuple hoặc dict có dạng `(x, y)`. Có thể truyền vào nhiều pos để tap nhiều lần vào nhiều vị trí khác nhau.

```python
em.tap((200, 200))
em.tap((150, 200), (250, 250))
```

### tap_to_img

Nhấp vào hình ảnh khớp với hình ảnh được cho. `timeout` là thời gian chờ hình xuất hiện nếu nhỏ hơn 0 sẽ chờ vô hạn mặc định `timeout=0`, `threshold` là độ chính xác khi tìm kiếm, nằm trong khoảng từ 0 tới 1 mặc định `threshold=0.8`.

```python
em.tap_to_img(img_path="path/to/img", timeout=0, threshold=0.8)
```

### tap_to_imgs

Nhấn vào tất cả hình ảnh khớp với hình ảnh được cho. `timeout` là thời gian chờ hình xuất hiện nếu nhỏ hơn 0 sẽ chờ vô hạn mặc định `timeout=0`, `threshold` là độ chính xác khi tìm kiếm, nằm trong khoảng từ 0 tới 1 mặc định `threshold=0.8`.

```python
em.tap_to_imgs(img_path="path/to/img", timeout=0, threshold=0.8)
```

### wait_img_existed

Chờ cho tới khi hình ảnh xuất hiện trên màn hình, chờ tối đa `timeout` giây, nếu `timeout=0` sẽ chờ vô hạn cho tới khi có hình ảnh. `threshold` là độ chính xác khi tìm kiếm nằm trong khoảng 0 tới 1 mặc định `threshold=0.8`.

```python
em.wait_img_existed(img_path="path/to/img", timeout=0, threshold=0.8)
```

### swipe

Vuốt từ vị trí `_from` tới vị trí `to` trong khoảng thời gian `duration` millisecond.

```python
em.swipe(_from=(100, 200), to=(500, 200), duration=100)
```

### send_text

Gửi đoạn văn bản `text`.

```python
em.send_text(text)
```

### send_event

Gửi event tới emulator

```python
import emulator
from emulator import keys


ld = emulator.LDPlayer("path/to/ldplayer dir")
em = ld.emulators[0].start()
em.wait(5).send_event(keys.KEYCODE_CALL)
```

### home

Nhấn vào nút home

```python
em.home()
```

### back

Nhấn vào nút back

```python
em.back()
```

### app_switcher

Nhấn vào nút app switcher

```python
em.app_switcher()
```

### dump_xml

Lưu window_dump thành file

```python
em.dump_xml(as_file="path/local.xml")
```

### find_node

Trả về `Node` đầu tiên trong window_dump có giá trị khớp với giá trị đã cho, nếu tìm được trả về `None`

```python
import emulator
from emulator.node import By


ld = emulator.LDPlayer("path/to/ldplayer")
em = ld.emulator[0].start().wait(10)
em.find_node(By.TEXT, "node text")
```

### find_nodes

Trả về một `list` là tất cả các node trong window_dump có giá trị khới với gía trị đã cho

```python
import emulator
from emulator.node import By


ld = emulator.LDPlayer("path/to/ldplayer")
em = ld.emulators[0].start().wait(10)
nodes = em.find_nodes(By.TEXT, "text node")
```

### wait

Dừng chương trình trong second giây

```python
em.wait(second)
```

### hide

Ẩn emulator

```python
em.hide()
```

### show

Hiển thị emulator

```python
em.show()
```

### quit

Tắt emulator

```python
em.quit()
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Thachj-Thw/emulator",
    "name": "emulator-Thw-Fix",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "emulator,android,android emulator",
    "author": "Thw",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/67/7e/c2a3795bf89c474bd8ee14afc09500b3b9b064598859df3de55e958e54c3/emulator-Thw-Fix-0.0.7.tar.gz",
    "platform": null,
    "description": "# emulator\r\n\r\npackage n\u00e0y h\u1ed7 tr\u1ee3 \u0111i\u1ec1u khi\u1ec3n c\u00e1c ph\u1ea7n m\u1ec1m gi\u1ea3 l\u1eadp (Hi\u1ec7n t\u1ea1i ch\u1ec9 h\u1ed7 tr\u1ee3 ph\u1ea7n m\u1ec1m LDPlayer)\r\n\r\n## Installation\r\n\r\n```bash\r\npip install emulator-thw\r\n```\r\n\r\n---\r\n\r\n## Usage\r\n\r\n### Example started\r\n\r\nLDPlayer\r\n\r\n```python\r\nimport emulator\r\n\r\n\r\nld = emulator.LDPlayer(ldplayer_dir=\"C:/LDPlayer/LDPlayer4.0\")\r\nprint(ld.emulators)\r\n```\r\n\r\nc\u00f3 hai c\u00e1ch \u0111\u1ec3 l\u1ea5y ldplayer trong `LDPlayer` l\u00e0 d\u00f9ng `index` `ld.emulators[0]` ho\u1eb7c d\u00f9ng `name` `ld.emulator[\"LDPlayer\"]`. T\u00f4i khuy\u00ean b\u1ea1n n\u00ean s\u1eed d\u1ee5ng index, v\u00ec name c\u00f3 th\u1ec3 tr\u00f9ng l\u1eb7p d\u1eabn t\u1edbi \u0111i\u1ec1u khi\u1ec3n sai ldplayer.\r\n\r\nt\u1ea1o ldplayer m\u1edbi\r\n\r\n```python\r\nem = ld.new(\"New-LDPlayer\")\r\nem.start()\r\n```\r\n\r\nx\u00f3a ldplayer\r\n\r\n```python\r\nem_remove = ld.emulators[0]\r\nld.remove(em_remove)\r\n```\r\n\r\nsao ch\u00e9p ldplayer\r\n\r\n```python\r\nem_copy = ld.emulators[0]\r\nld.copy(em_copy)\r\n```\r\n\r\ns\u1eafp x\u1ebfp c\u00e1c c\u1eeda s\u1ed5 ldplayer\r\n\r\n```python\r\nfor em in ld.emulators:\r\n    em.start(wait=False)\r\nld.sort_window()\r\n```\r\n\r\nt\u1ea1o c\u00e1c h\u00e0nh \u0111\u1ed9ng\r\n\r\n```python\r\nem = ld.emulator[0]\r\nem.start()\r\nem.tap((100, 100)) # code t\u1eebng d\u00f2ng\r\nem.wait(3).swipe((200, 100), (10, 100)).wait(3).quit() # code 1 chu\u1ed7i h\u00e0nh \u0111\u1ed9ng\r\n```\r\n\r\nB\u1ecf qua `quit()` b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng `with`\r\n\r\n```python\r\nwith ld.emulators[0].start() as em:\r\n    em.tap((100, 100))\r\n```\r\n\r\n---\r\n\r\n## List methods\r\n\r\nDanh s\u00e1ch c\u00e1c ph\u01b0\u01a1ng th\u1ee9c c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng\r\n\r\n- [start](#start)\r\n\r\n- [wait_to_started](#wait_to_started)\r\n\r\n- [is_running](#is_running)\r\n\r\n- [restart](#restart)\r\n\r\n- [rename](#rename)\r\n\r\n- [list_packages](#list_packages)\r\n\r\n- [install_app](#install_app)\r\n\r\n- [uninstall_app](#uninstall_app)\r\n\r\n- [run_app](#run_app)\r\n\r\n- [kill_app](#kill_app)\r\n\r\n- [clear_app](#clear_app)\r\n\r\n- [set_locate](#set_locate)\r\n\r\n- [update_properties](#update_properties)\r\n\r\n- [get_properties](#get_properties)\r\n\r\n- [setting](#setting)\r\n\r\n- [down_cpu](#down_cpu)\r\n\r\n- [backup](#backup)\r\n\r\n- [restore](#restore)\r\n\r\n- [action](#action)\r\n\r\n- [scan](#scan)\r\n\r\n- [pull](#pull)\r\n\r\n- [push](#push)\r\n\r\n- [capture](#capture)\r\n\r\n- [adb_connected](#adb_connected)\r\n\r\n- [tap](#tap)\r\n\r\n- [tap_to_img](#tap_to_img)\r\n\r\n- [tap_to_imgs](#tap_to_imgs)\r\n\r\n- [wait_img_existed](#wait_img_existed)\r\n\r\n- [swipe](#swipe)\r\n\r\n- [send_text](#send_text)\r\n\r\n- [send_event](#send_event)\r\n\r\n- [home](#home)\r\n\r\n- [back](#back)\r\n\r\n- [app_switcher](#app_switcher)\r\n\r\n- [dump_xml](#dump_xml)\r\n\r\n- [find_node](#find_node)\r\n\r\n- [find_nodes](#find_nodes)\r\n\r\n- [wait](#wait)\r\n\r\n- [hide](#hide)\r\n\r\n- [show](#show)\r\n\r\n- [quit](#quit)\r\n\r\n---\r\n\r\n### start\r\n\r\nKh\u1edfi ch\u1ea1y emulator. N\u1ebfu tham s\u1ed1 `wait=True` s\u1ebd g\u1ecdi ph\u01b0\u01a1ng th\u1ee9c `wait_to_stared()`.\r\n\r\n```python\r\nem.start(wait=True)\r\n```\r\n\r\n### wait_to_started\r\n\r\nCh\u1edd cho qu\u00e1 tr\u00ecnh kh\u1edfi ch\u1ea1y ho\u00e0n t\u1ea5t (th\u1ef1c ch\u1ea5t l\u00e0 ch\u1edd k\u1ebft n\u1ed1i ADB).\r\n\r\n```python\r\nem.wait_to_started()\r\n```\r\n\r\n### is_running\r\n\r\nTr\u1ea3 v\u1ec1 `True` n\u1ebfu emulator \u0111ang ch\u1ea1y ng\u01b0\u1ee3c l\u1ea1i `False`\r\n\r\n```python\r\nem.is_running()\r\n```\r\n\r\n### restart\r\n\r\nKh\u1edfi ch\u1ea1y l\u1ea1i emulator, tham s\u1ed1 `wait` t\u01b0\u01a1ng t\u1ef1 `start()`\r\n\r\n```python\r\nem.restart(wait=True)\r\n```\r\n\r\n### rename\r\n\r\n\u0110\u1ed5i t\u00ean emulator th\u00e0nh `new_name`\r\n\r\n```python\r\nem.rename(new_name=\"New-Name-LDPlayer\")\r\n```\r\n\r\n### list_packages\r\n\r\ntr\u1ea3 v\u1ec1 danh s\u00e1ch c\u00e1c package \u0111\u00e3 c\u00e0i \u0111\u1eb7t tr\u00ean thi\u1ebft b\u1ecb\r\n\r\n```python\r\npackages = em.list_packages()\r\nprint(packages)\r\n```\r\n\r\n### install_app\r\n\r\nC\u00e0i \u0111\u1eb7t \u1ee9ng d\u1ee5ng, `source` c\u00f3 th\u1ec3 l\u00e0 \u0111\u01b0\u1eddng d\u1eabn t\u1edbi file `.apk` ho\u1eb7c `package name`\r\n\r\n```python\r\nem.install_app(source=\"example_app.apk\")\r\n```\r\n\r\n### uninstall_app\r\n\r\nG\u1ee1 c\u00e0i \u0111\u1eb7t \u1ee9ng d\u1ee5ng c\u00f3 package name t\u01b0\u01a1ng \u1ee9ng. Xem th\u00eam v\u1ec1 [list_packages](#listpackages)\r\n\r\n```python\r\nem.uninstall_app(package_name=\"com.example.app\")\r\n```\r\n\r\n### run_app\r\n\r\nM\u1edf d\u1ee9ng d\u1ee5ng c\u00f3 package name t\u01b0\u01a1ng \u1ee9ng. Xem th\u00eam v\u1ec1 [list_packages](#listpackages)\r\n\r\n```python\r\nem.run_app(package_name=\"com.android.chrome\")\r\n```\r\n\r\n### kill_app\r\n\r\nD\u1eebng d\u1ee9ng d\u1ee5ng c\u00f3 package name t\u01b0\u01a1ng \u1ee9ng. Xem th\u00eam v\u1ec1 [list_packages](#listpackages)\r\n\r\n```python\r\nem.kill_app(package_name=\"com.android.chrome\")\r\n```\r\n\r\n### clear_app\r\n\r\nX\u00f3a data c\u1ee7a \u1ee9ng d\u1ee5ng c\u00f3 package name t\u01b0\u01a1ng \u1ee9ng. Xem th\u00eam v\u1ec1 [list_packages](#listpackages)\r\n\r\n```python\r\nem.clear_app(package_name=\"com.android.chrome\")\r\n```\r\n\r\n### set_locate\r\n\r\nC\u00e0i \u0111\u1eb7t locate\r\n\r\n```python\r\nem.set_locate(locate=\"locate\")\r\n```\r\n\r\n### update_properties\r\n\r\nC\u1eadp nh\u1eadt th\u00f4ng tin thi\u1ebft b\u1ecb, tham s\u1ed1 prop l\u00e0 1 `dict` v\u1edbi key l\u00e0 t\u00ean property v\u00e0 value l\u00e0 gi\u00e1 tr\u1ecb t\u01b0\u01a1ng \u1ee9ng\r\n\r\n```python\r\nem.update_properties(prop)\r\n```\r\n\r\n### get_properties\r\n\r\nTr\u1ea3 v\u1ec1 1 `dict` v\u1edbi key l\u00e0 t\u00ean property v\u00e0 value l\u00e0 gi\u00e1 tr\u1ecb property\r\n\r\n```python\r\nprop = em.get_properties()\r\nprint(prop)\r\n```\r\n\r\n### setting\r\n\r\nc\u00e0i \u0111\u1eb7t th\u00f4ng s\u1ed1 emlator, tham s\u1ed1 l\u00e0 1 EmulatorOptions\r\n\r\n```python\r\nimport emulator\r\nfrom emulator.option import EmulatorOptions\r\n\r\n\r\nld = emulator.LDPlayer(\"path/to/ldplayer/\")\r\noptions = EmulatorOptions()\r\noptions.set_resolution(width=128, height=240, dpi=120)\r\nem = ld.emulators[0]\r\nem.setting(options)\r\nem.start()\r\n```\r\n\r\n### down_cpu\r\n\r\n```python\r\nem.down_cpu(rate=50)\r\n```\r\n\r\n### backup\r\n\r\nT\u1ea1o file backup emulator\r\n\r\n```python\r\nem.backup(file_path=\"C:/backup.ldbk\")\r\n```\r\n\r\n### restore\r\n\r\n```python\r\nem.restore(file_path=\"C:/backup.ldbk\")\r\n```\r\n\r\n### action\r\n\r\n```python\r\nactions = {\"action\": \"value\"}\r\nem.action(actions=actions)\r\n```\r\n\r\n### scan\r\n\r\n```python\r\nem.scan(file_path=\"C:/scan.png\")\r\n```\r\n\r\n### pull\r\n\r\n\u0110\u01b0a file `remote` t\u1eeb emulator v\u1ec1 PC th\u00e0nh `local`\r\n\r\n```python\r\nem.pull(remote=\"sdcard/remote.txt\", local=\"C:/local.txt\")\r\n```\r\n\r\n### push\r\n\r\n\u0110\u01b0a file `local` t\u1eeb PC l\u00ean emulator th\u00e0nh `remote`\r\n\r\n```python\r\nem.push(local=\"C:/local.txt\", remote=\"sdcard/remote.txt\")\r\n```\r\n\r\n### capture\r\n\r\nCh\u1ee5p \u1ea3nh m\u00e0n h\u00ecnh v\u00e0 l\u01b0u th\u00e0nh `as_file`\r\n\r\n```python\r\nem.capture(as_file=\"path/to/save_as.png\")\r\n```\r\n\r\n### adb_connected\r\n\r\nTr\u1ea3 v\u1ec1 `True` n\u1ebfu ADB \u0111\u00e3 k\u1ebft n\u1ed1i v\u1edbi emulator ng\u01b0\u1ee3c l\u1ea1i `False`. B\u1ea1n s\u1ebd c\u1ea7n b\u1eadt **ADB debugging** \u0111\u1ec3 k\u1ebft n\u1ed1i ADB\r\n\r\n```python\r\nem.adb_connected()\r\n```\r\n\r\n### tap\r\n\r\nNh\u1ea5n v\u00e0o v\u1ecb tr\u00ed pos l\u00e0 1 tuple ho\u1eb7c dict c\u00f3 d\u1ea1ng `(x, y)`. C\u00f3 th\u1ec3 truy\u1ec1n v\u00e0o nhi\u1ec1u pos \u0111\u1ec3 tap nhi\u1ec1u l\u1ea7n v\u00e0o nhi\u1ec1u v\u1ecb tr\u00ed kh\u00e1c nhau.\r\n\r\n```python\r\nem.tap((200, 200))\r\nem.tap((150, 200), (250, 250))\r\n```\r\n\r\n### tap_to_img\r\n\r\nNh\u1ea5p v\u00e0o h\u00ecnh \u1ea3nh kh\u1edbp v\u1edbi h\u00ecnh \u1ea3nh \u0111\u01b0\u1ee3c cho. `timeout` l\u00e0 th\u1eddi gian ch\u1edd h\u00ecnh xu\u1ea5t hi\u1ec7n n\u1ebfu nh\u1ecf h\u01a1n 0 s\u1ebd ch\u1edd v\u00f4 h\u1ea1n m\u1eb7c \u0111\u1ecbnh `timeout=0`, `threshold` l\u00e0 \u0111\u1ed9 ch\u00ednh x\u00e1c khi t\u00ecm ki\u1ebfm, n\u1eb1m trong kho\u1ea3ng t\u1eeb 0 t\u1edbi 1 m\u1eb7c \u0111\u1ecbnh `threshold=0.8`.\r\n\r\n```python\r\nem.tap_to_img(img_path=\"path/to/img\", timeout=0, threshold=0.8)\r\n```\r\n\r\n### tap_to_imgs\r\n\r\nNh\u1ea5n v\u00e0o t\u1ea5t c\u1ea3 h\u00ecnh \u1ea3nh kh\u1edbp v\u1edbi h\u00ecnh \u1ea3nh \u0111\u01b0\u1ee3c cho. `timeout` l\u00e0 th\u1eddi gian ch\u1edd h\u00ecnh xu\u1ea5t hi\u1ec7n n\u1ebfu nh\u1ecf h\u01a1n 0 s\u1ebd ch\u1edd v\u00f4 h\u1ea1n m\u1eb7c \u0111\u1ecbnh `timeout=0`, `threshold` l\u00e0 \u0111\u1ed9 ch\u00ednh x\u00e1c khi t\u00ecm ki\u1ebfm, n\u1eb1m trong kho\u1ea3ng t\u1eeb 0 t\u1edbi 1 m\u1eb7c \u0111\u1ecbnh `threshold=0.8`.\r\n\r\n```python\r\nem.tap_to_imgs(img_path=\"path/to/img\", timeout=0, threshold=0.8)\r\n```\r\n\r\n### wait_img_existed\r\n\r\nCh\u1edd cho t\u1edbi khi h\u00ecnh \u1ea3nh xu\u1ea5t hi\u1ec7n tr\u00ean m\u00e0n h\u00ecnh, ch\u1edd t\u1ed1i \u0111a `timeout` gi\u00e2y, n\u1ebfu `timeout=0` s\u1ebd ch\u1edd v\u00f4 h\u1ea1n cho t\u1edbi khi c\u00f3 h\u00ecnh \u1ea3nh. `threshold` l\u00e0 \u0111\u1ed9 ch\u00ednh x\u00e1c khi t\u00ecm ki\u1ebfm n\u1eb1m trong kho\u1ea3ng 0 t\u1edbi 1 m\u1eb7c \u0111\u1ecbnh `threshold=0.8`.\r\n\r\n```python\r\nem.wait_img_existed(img_path=\"path/to/img\", timeout=0, threshold=0.8)\r\n```\r\n\r\n### swipe\r\n\r\nVu\u1ed1t t\u1eeb v\u1ecb tr\u00ed `_from` t\u1edbi v\u1ecb tr\u00ed `to` trong kho\u1ea3ng th\u1eddi gian `duration` millisecond.\r\n\r\n```python\r\nem.swipe(_from=(100, 200), to=(500, 200), duration=100)\r\n```\r\n\r\n### send_text\r\n\r\nG\u1eedi \u0111o\u1ea1n v\u0103n b\u1ea3n `text`.\r\n\r\n```python\r\nem.send_text(text)\r\n```\r\n\r\n### send_event\r\n\r\nG\u1eedi event t\u1edbi emulator\r\n\r\n```python\r\nimport emulator\r\nfrom emulator import keys\r\n\r\n\r\nld = emulator.LDPlayer(\"path/to/ldplayer dir\")\r\nem = ld.emulators[0].start()\r\nem.wait(5).send_event(keys.KEYCODE_CALL)\r\n```\r\n\r\n### home\r\n\r\nNh\u1ea5n v\u00e0o n\u00fat home\r\n\r\n```python\r\nem.home()\r\n```\r\n\r\n### back\r\n\r\nNh\u1ea5n v\u00e0o n\u00fat back\r\n\r\n```python\r\nem.back()\r\n```\r\n\r\n### app_switcher\r\n\r\nNh\u1ea5n v\u00e0o n\u00fat app switcher\r\n\r\n```python\r\nem.app_switcher()\r\n```\r\n\r\n### dump_xml\r\n\r\nL\u01b0u window_dump th\u00e0nh file\r\n\r\n```python\r\nem.dump_xml(as_file=\"path/local.xml\")\r\n```\r\n\r\n### find_node\r\n\r\nTr\u1ea3 v\u1ec1 `Node` \u0111\u1ea7u ti\u00ean trong window_dump c\u00f3 gi\u00e1 tr\u1ecb kh\u1edbp v\u1edbi gi\u00e1 tr\u1ecb \u0111\u00e3 cho, n\u1ebfu t\u00ecm \u0111\u01b0\u1ee3c tr\u1ea3 v\u1ec1 `None`\r\n\r\n```python\r\nimport emulator\r\nfrom emulator.node import By\r\n\r\n\r\nld = emulator.LDPlayer(\"path/to/ldplayer\")\r\nem = ld.emulator[0].start().wait(10)\r\nem.find_node(By.TEXT, \"node text\")\r\n```\r\n\r\n### find_nodes\r\n\r\nTr\u1ea3 v\u1ec1 m\u1ed9t `list` l\u00e0 t\u1ea5t c\u1ea3 c\u00e1c node trong window_dump c\u00f3 gi\u00e1 tr\u1ecb kh\u1edbi v\u1edbi g\u00eda tr\u1ecb \u0111\u00e3 cho\r\n\r\n```python\r\nimport emulator\r\nfrom emulator.node import By\r\n\r\n\r\nld = emulator.LDPlayer(\"path/to/ldplayer\")\r\nem = ld.emulators[0].start().wait(10)\r\nnodes = em.find_nodes(By.TEXT, \"text node\")\r\n```\r\n\r\n### wait\r\n\r\nD\u1eebng ch\u01b0\u01a1ng tr\u00ecnh trong second gi\u00e2y\r\n\r\n```python\r\nem.wait(second)\r\n```\r\n\r\n### hide\r\n\r\n\u1ea8n emulator\r\n\r\n```python\r\nem.hide()\r\n```\r\n\r\n### show\r\n\r\nHi\u1ec3n th\u1ecb emulator\r\n\r\n```python\r\nem.show()\r\n```\r\n\r\n### quit\r\n\r\nT\u1eaft emulator\r\n\r\n```python\r\nem.quit()\r\n```\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "package help control emulator",
    "version": "0.0.7",
    "project_urls": {
        "Homepage": "https://github.com/Thachj-Thw/emulator",
        "Source": "https://github.com/Thachj-Thw/emulator"
    },
    "split_keywords": [
        "emulator",
        "android",
        "android emulator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "677ec2a3795bf89c474bd8ee14afc09500b3b9b064598859df3de55e958e54c3",
                "md5": "484db6713018342cd690fe1483b2b357",
                "sha256": "e2e6a82b59575d0f166a95de55b8cfd47501c84229b03ad4bdead8bd3a0086f9"
            },
            "downloads": -1,
            "filename": "emulator-Thw-Fix-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "484db6713018342cd690fe1483b2b357",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3961001,
            "upload_time": "2023-07-03T02:07:21",
            "upload_time_iso_8601": "2023-07-03T02:07:21.656678Z",
            "url": "https://files.pythonhosted.org/packages/67/7e/c2a3795bf89c474bd8ee14afc09500b3b9b064598859df3de55e958e54c3/emulator-Thw-Fix-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-03 02:07:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Thachj-Thw",
    "github_project": "emulator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "emulator-thw-fix"
}
        
Thw
Elapsed time: 0.08344s