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.3.tar.gz (11.0 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.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qa_automation_phone-0.1.3.tar.gz
  • Upload date:
  • Size: 11.0 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.3.tar.gz
Algorithm Hash digest
SHA256 c71202c02681b20efbb95fb4ff7ef826186d411549ee88e58499a74d694f83c7
MD5 f69ca9543cc38e1f57819b70919bc3e0
BLAKE2b-256 7b6d59e975414366616f922f6090bf3dab13398ebdf8fc02aa6d92e1191d1622

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qa_automation_phone-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 edfd93475855cf060b3a096bf8927f3dcebab7d72d9203ab59d762f2796873ef
MD5 7b6658df2d28924de7450c5e0fbe068c
BLAKE2b-256 eb7dee0648cf9c517d0a28f8176a747a65bd4e5641568d24f069f3eb33e2db5b

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