feat: add test script for Shopee API integration

This commit is contained in:
Victor Phan
2026-07-21 09:33:27 +07:00
parent 196fe1ce0c
commit fdb734e148
+6 -13
View File
@@ -5,9 +5,14 @@ import time
d = u2.connect('10.160.138.2:5555')
link = "https://vn.shp.ee/tZVnqovi"
print("Đang bật sáng màn hình...")
d.screen_on()
# d.unlock() # Bỏ comment dòng này nếu máy bạn có màn hình khóa vuốt (không mật khẩu)
time.sleep(1)
print("🚀 Đang bắn lệnh ép Shopee mở thẳng sản phẩm...")
# Lệnh ADB này ép Android mở link trực tiếp bằng app Shopee
d.shell(f'am start -a android.intent.action.VIEW -d "{link}" com.shopee.vn')
d.shell(f'am start -a android.intent.action.VIEW -d "{link}"')
# Chờ 8 giây để app load xong hình ảnh và thông tin (mạng chậm thì tăng lên)
print("⏳ Đang đợi Shopee tải trang...")
@@ -21,15 +26,3 @@ with open("ui_dump.xml", "w", encoding="utf-8") as f:
f.write(xml_dump)
print("✅ Đã xuất giao diện ra file 'ui_dump.xml'.")
# THỬ TÌM NHANH TỰ ĐỘNG
# (Shopee thường để chữ "Hoa hồng" hoặc "%" ở một nút nào đó)
try:
commission_btn = d(textContains="Hoa hồng")
if commission_btn.exists:
print(f"🎉 TÌM THẤY: {commission_btn.get_text()}")
else:
print("⚠️ Không thấy chữ 'Hoa hồng' hiển thị ngay trên màn hình chính.")
print("👉 Vui lòng mở file 'ui_dump.xml' lên, tìm kiếm (Ctrl+F) dấu '%' để xem Shopee đang đặt tên biến hoa hồng là gì!")
except Exception as e:
print("Lỗi:", e)