The first way to wait : Mandatory waiting
Sometimes you don't have to wait so long
time.sleep(5)
The second way to wait : Intelligent waiting
# wait for ,wait The default timeout is 20s, If 20s Wait till , Will not wait .
# You can modify the default waiting time , You can set short , Or set length , Modify according to your own needs .
# The following methods can be used to modify the default waiting time 2 Ways of planting :
# Mode one : d.wait_timeout = 15
# Mode two : d.implicitly_wait(15)
d.wait_timeout = 15
d.app_start(pkg_name, wait=True)
# Set up in front of wait_timeout = 15 Global variable , If a single operation needs to wait longer # Time for , It can be set separately timeout Of .
d(resourceId="android:id/tabhost").click(timeout=50)
d(resourceId="android:id/tabhost").set_text(timeout=50)
- Wait for the page to load :d.wait_activity()
- Wait for the element to appear :d().wait()
- Wait for the element to disappear :d().wait_gone()
- Wait for the element to exist :d().exist()
- Wait for the click , After setting the implicit wait ,
- click,long_click,drag_to,get_text,set_text,clear_text.