参考这个帖子http://testerhome.com/topics/2354 回帖中的 waitForElement,我自己写了一个 appium selendroid 模式下的 python 函数查找 toast
message:消息内容
timeout:超时时间
poll_frequency:查询步长
driver:就是 driver
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
def find_toast(message,timeout,poll_frequency,driver):
element = WebDriverWait(driver,timeout,poll_frequency).until(expected_conditions.presence_of_element_located((By.PARTIAL_LINK_TEXT,message)))