Skip to main content

Automation test for phone

Project description

UIAutomator2 Dump Screen Project

Mục đích

Dự án này sử dụng uiautomator2 để kết nối từ laptop tới server trên điện thoại Android, thực hiện dump màn hình và trả dữ liệu về laptop.

Sơ đồ kết nối

Sơ đồ kết nối

  • Laptop: Gửi yêu cầu dump màn hình qua uiautomator2.
  • Điện thoại (Server UIAutomator2): Nhận yêu cầu, thực hiện dump màn hình và gửi kết quả về laptop.

Cài đặt

  1. Cài đặt qa_phone_automation trên laptop:
pip install QA-automation-phone
  1. Kết nối điện thoại với qaautomation:
from QA_automation_phone import coreapp, devices
from QA_automation_phone.coreapp import u2
import time
import threading
devicess = devices.get_devices()
def run(device_id):
    print("start")
    connect= u2.connect(device_id)
    start = time.time()
    if coreapp.click_element(device_id,connect, "text", "Settings", 0, 2):
        print("Clicked")
    else: 
        print("Not clicked")
    print(time.time()-start)

threads = []
for device in devicess:
    t = threading.Thread(target=run, args=(device,))
    threads.append(t)
for thread in threads:
    thread.start()

Cách sử dụng

from QA_automation_phone import coreapp, devices
from QA_automation_phone.coreapp import u2
import time
import threading
devicess = devices.get_devices()
def run(device_id):
    print("start")
    connect= u2.connect(device_id)
    start = time.time()
    if coreapp.click_element(device_id,connect, "text", "Settings", 0, 2):
        print("Clicked")
    else: 
        print("Not clicked")
    print(time.time()-start)

threads = []
for device in devicess:
    t = threading.Thread(target=run, args=(device,))
    threads.append(t)
for thread in threads:
    thread.start()

Lưu ý

  • Điện thoại cần bật chế độ nhà phát triển và cấp quyền ADB.
  • Đảm bảo uiautomator2 server đang chạy trên điện thoại.

Nếu thấy hay và giúp ích cho các bạn bạn có thể gửi quà cho mình nhé Thanks!

QR Pay

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qa_automation_phone-0.1.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qa_automation_phone-0.1.2-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file qa_automation_phone-0.1.2.tar.gz.

File metadata

  • Download URL: qa_automation_phone-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for qa_automation_phone-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f8ebed88bfe0fd1ba599e6ab7335a255d5994fd17bbb9b0f8921642b5f9e7978
MD5 a0e72e6ebf1e0716a01c97d36700ec6d
BLAKE2b-256 49871d98e23e0ca1afb0211d1198ab1badbe1d1815bc2bb1b42f7ef6bffa81b1

See more details on using hashes here.

File details

Details for the file qa_automation_phone-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for qa_automation_phone-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 72a61f7c38b2582ffcacb7667e1dae23d16c960d2b17da6b051b8af26673c3c5
MD5 638240a8822c2e5648f6930d14d16166
BLAKE2b-256 beb1195e9c3fb9134874d25a9d14ef1ef55d4e88d5efe4e35d5d1eaf93793f4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page