appium自动化测试报错“ An element could not be located on the page using the given search parameters.”

问题:appium自动化测试报错“ An element could not be located on the page using the given search parameters.”

原因:元素未及时加载出来

解决:加隐式等待。

举例:driver.implicitly_wait(10)  # 设置隐式等待为10秒

隐式等待:隐式等待是全局设置,一旦设置,它会对WebDriver实例生命周期内的所有元素定位起作用。

显式等待:显式等待用于等待某个特定条件成立,它不会对整个页面加载设置时间,而是针对某个特定的元素设置等待时间。

posted @ 2024-03-27 16:24  mafei666  阅读(388)  评论(0)    收藏  举报