zoukankan      html  css  js  c++  java
  • Appium + python 获取toast

    1.导入WebDriverWait、expected_conditions模块
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.support.ui import WebDriverWait

    2.在获取toast的页面,设置隐式等待,语句如下:

    备注:文字一定要正确,要不然找不到

    3.实例:
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.support.ui import WebDriverWait
    def text_publish1(self):
        """
    # 发布的文字少于10个字
    :return:
    """
    public_dict = YAML.yamlFile()[2]['publish']
    logging.info("准备发布纯文字")
    self.driver.find_element_by_xpath(public_dict['textImg_btn']).click()
    time.sleep(2)
    self.driver.find_element_by_xpath(public_dict['text_content']).
    send_keys(public_dict['send_keys5'])
    time.sleep(2)
    self.driver.find_element_by_xpath(public_dict['publish_btn']).click()
    try:
        WebDriverWait(self.driver, 2).
    until(EC.presence_of_element_located((MobileBy.XPATH,
    '//*[contains(@text,"请选择频道")]')))
            logging.info("请选择频道")
    except NoSuchElementException:
    logging.info("没有弹出提示")
    else:
    self.driver.find_element_by_xpath(public_dict['text_content']).
    send_keys(public_dict['send_keys5'+'send_keys5'])
    self.driver.find_element_by_xpath(public_dict['publish_btn']).click()
    logging.info("发布文字完成")
    time.sleep(2)
    self.driver.find_element_by_xpath(public_dict['last_tab']).click()

    备注:找到toast之后,send_keys会清除之前输入的内容重新输入,不知道为啥~~~
  • 相关阅读:
    转载——关于scanf造成死循环
    转载——关于C#延时
    2013.02.13——笔记
    最近计划
    关于毕业设计——2013.4.12
    关于c#中combobox赋值问题
    使用DWE编辑对话框窗体
    Insert New Class (a2BusNew under BusItem)
    将TCE链接加入新工作通知(NewWorkAssignment,Sig)邮件中
    创建Relation并Add到数据库
  • 原文地址:https://www.cnblogs.com/keqing1108/p/12063339.html
Copyright © 2011-2022 走看看