Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the Click Operation of uiautomator2 by python

Shulou Source: shulou.com Published: 2022-06-03 17:38:22 11月13日 Update

Editor to share with you how python to achieve the click operation of uiautomator2, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. Click, click on the element.

D (text=' Alipay'). Click () # Click on the element d (text=' Alipay) .Click (timeout=5) # 5 seconds (timeout) to wait for the element to appear and report an error when it exceeds.

2. Click_exists Click to return to the Boolean value depending on whether the element exists.

Click after waiting for the element to appear within the timeout. If you find the element, click to return the Boolean value true, otherwise return false.

ShowObj = d (text=' Alipay'). Click_exists (timeout=10.0) # Click after waiting for the element to appear within the timeout. If you find the element, click to return the Boolean value true, otherwise return falseprint (showObj)

3. Click_gone clicks in turn until the element appears within the specified time. Click and poll the object until it disappears.

(click every interval until a Boolean is returned after the maximum number of clicks maxretry), where maxretry is the maximum number of clicks. By default, 10 is the polling interval, and the default is 1.

# Click and poll the object until it disappears (click once every interval until a Boolean value is returned after the maximum number of clicks maxretry), where maxretry is the most clicks, the default is 10 python interval is the polling interval, and the default is 1a1 = d (text= "Alipay"). Click_gone (maxretry=10, interval=1.0) print (A1) above is all the contents of the article "how to click on uiautomator2 by python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Elements time Boolean times payments articles maximum content objects not much most more knowledge industry information information channels channels references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Huawei MySQL Redmi Microsoft