คลิกที่ Point, tuple (x, y), Match หรือ MatchList ทุกพารามิเตอร์รองรับรูปแบบตามตำแหน่งหรือระบุชื่อตามลำดับในเอกสาร ใช้ Point(x, y) สำหรับ metadata ของพิกัด เช่น scale/anchor; ใช้ (x, y) สำหรับพิกัดพิกเซลคงที่ ใช้ parallel=True เพื่อเข้าคิวการแตะนี้และรับ id แบบตัวเลข; เรียก Touch.cancel(id) หรือ Touch.cancel() เพื่อยกเลิก touch ที่อยู่ในคิวหรือกำลังทำงาน
รูปแบบคำสั่ง
click(target, hold_ms=0, offset=(0, 0), random=0, delay_before=0, delay_after=0, parallel=False)พารามิเตอร์
| ชื่อ | คำอธิบาย |
|---|---|
targetPoint | tuple[Number, Number] | Match | MatchList | Target Point, coordinate tuple, found Match, or MatchList. Match/MatchList values with multiple points click each found point. จำเป็น · ระบุตามตำแหน่งหรือชื่อ ไม่มีค่าเริ่มต้น |
hold_msInt | Hold duration in milliseconds ไม่บังคับ · ระบุตามตำแหน่งหรือชื่อ ค่าเริ่มต้น: 0 |
offsettuple[Number, Number] | Add a pixel offset after resolving the target point. ไม่บังคับ · ระบุตามตำแหน่งหรือชื่อ ค่าเริ่มต้น: (0, 0) |
randomNumber | tuple[Number, Number] | Add random pixel offset after resolving the target point. ไม่บังคับ · ระบุตามตำแหน่งหรือชื่อ ค่าเริ่มต้น: 0 |
delay_beforeNumber | Delay before the click in milliseconds. ไม่บังคับ · ระบุตามตำแหน่งหรือชื่อ ค่าเริ่มต้น: 0 |
delay_afterNumber | Delay after the click in milliseconds. ไม่บังคับ · ระบุตามตำแหน่งหรือชื่อ ค่าเริ่มต้น: 0 |
parallelBoolean | When True, returns a numeric touch id. In collect mode the touch waits for Touch.send(); collected overlapping touches may start at different delay_before offsets without cancelling each other. ไม่บังคับ · ระบุตามตำแหน่งหรือชื่อ ค่าเริ่มต้น: False |
ค่าที่ส่งกลับ
Number | list[Number] | None — ส่งคืนรหัสตัวเลขหนึ่งรายการสำหรับการคลิกคู่ขนานที่อยู่ในคิวหนึ่งครั้ง รายการ [หมายเลข] เมื่อการจับคู่แบบหลายจุดหรือ MatchList จัดคิวการคลิกคู่ขนานหลายครั้ง มิฉะนั้น ไม่มีพฤติกรรม / ผลข้างเคียง
คลิกที่ Point, tuple (x, y), Match หรือ MatchList ทุกพารามิเตอร์รองรับรูปแบบตามตำแหน่งหรือระบุชื่อตามลำดับในเอกสาร ใช้ Point(x, y) สำหรับ metadata ของพิกัด เช่น scale/anchor; ใช้ (x, y) สำหรับพิกัดพิกเซลคงที่ ใช้ parallel=True เพื่อเข้าคิวการแตะนี้และรับ id แบบตัวเลข; เรียก Touch.cancel(id) หรือ Touch.cancel() เพื่อยกเลิก touch ที่อยู่ในคิวหรือกำลังทำงาน
การทำงาน
- รอให้เสร็จ: ขึ้นอยู่กับเงื่อนไข
- ความปลอดภัยเมื่อทำงานพร้อมกัน: มีข้อจำกัด
- การทำงานแบบขนาน: ขึ้นอยู่กับเงื่อนไข
ท่าทาง Android ใช้อุปกรณ์ร่วมกัน parallel=True จัดคิว id การสัมผัส แต่ delay_before และ delay_after ยังทำให้รอนอกโหมด collect ในโหมด collect จะรวบรวมการสัมผัสเพื่อ Touch.send(); Touch.wait() รอจนเสร็จ
ตัวอย่าง
# แตะพิกัดหน้าจอด้วย Point หรือ tuple
click(Point(500, 900))
click((500, 900))
click((500, 900), hold_ms=200)
click(Point(500, 900), 0, (0, 0), 10, 0, 500)
match = Region(100, 200, 300, 400).find("start", 3000)
if match.found:
click(match, offset=(0, 6))
hits = Region(100, 200, 300, 400).find_any(["a", "b"], 3000)
if hits:
click(hits, random=0)
# รวมการแตะพร้อมกันสองรายการ ส่งพร้อมกัน แล้วรอคิว
Touch.collect()
a = click(Point(300, 900), parallel=True)
b = click(Point(780, 900), parallel=True)
Touch.send()
Touch.wait()
# กด p1 ค้างไว้ แล้วแตะ p2 หลัง 1 วินาทีโดยไม่ปล่อย p1
Touch.collect()
p1 = click(Point(300, 900), hold_ms=5000, parallel=True)
p2 = click(Point(780, 900), hold_ms=1000, delay_before=1000, parallel=True)
Touch.send()
Touch.cancel(p1)
Touch.wait()ข้อผิดพลาด / ข้อจำกัด
ไม่มีข้อจำกัดเพิ่มเติมที่ระบุไว้ ให้ปฏิบัติตามพารามิเตอร์และพฤติกรรมข้างต้น