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.1.tar.gz (8.5 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.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qa_automation_phone-0.1.1.tar.gz
  • Upload date:
  • Size: 8.5 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.1.tar.gz
Algorithm Hash digest
SHA256 d258796fcdb9b80eb975a0efed3657948874dfc25702b55a1c2e79d3df5317ef
MD5 92ae350562d3307d2eecc4b579d959c5
BLAKE2b-256 12a761e5ce73dcb3e7b0f1ce327d0b2373da4b46c64b34a09fba750b24f0d621

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qa_automation_phone-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 77a156d95f4182fb0fbd7f9fb37d48e796629072e8449857401d6df25f3d1e3f
MD5 ff4c0d06f0f3f327537829126ffd9b8b
BLAKE2b-256 a6657393808298639dafaab2ff14e1be52d6332d20464a026e2f700f5ebf2a16

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