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会清除之前输入的内容重新输入,不知道为啥~~~
  • 相关阅读:
    k8s中pod的定义
    k8s上pod一次pending解决过程
    docker创建一个容器
    什么是进程
    在线程中显示一个窗口(多个UI线程)
    ComboBox过滤
    TreeView虚拟化跳转
    使用MVVM的常见误区(1)在ViewModel中和用户交互
    <转载>玩转git, rebase
    MySQL8.0 connector JAR包的下载位置及JDBC配置
  • 原文地址:https://www.cnblogs.com/keqing1108/p/12063339.html
Copyright © 2011-2022 走看看