程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python] multiple uses of time waiting

編輯:Python

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.

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved