• selenium—显示等待中期望的场景语句


    ① alert_is_present()

        判断页面是否出现alert框

    wait = WebDriverWait(driver,10)
    alert = wait.until(EC.alert_is_present())
    print alert.text

    ②wait.until(EC.element_located_selection_state_to_be(locator,state)

      判断元素选中状态是否符合预期,True为选中,False为未选中

    wait = WebDriverWait(driver,10)
    wait.until(EC.element_located_selection_state_to_be((By.ID, "peach"), True))

    ③ element_located_to_be_selected()

     期望元素处于选中状态

    wait = WebDriverWait(driver,10)
    wait.until(EC.element_located_to_be_selected((By.ID, "xxx")))
    wait.until(EC.element_located_to_be_selected(driver.find_element_by_id("xxx")))

    ④ element_to_be_clickable()

      判断元素是否可见并能被单击

    wait = WebDriverWait(driver,10)
    wait.until(EC.element_to_be_clickable(By.ID, "xxx"))

     ⑤ text

    text_to_be_present_in_element(locator,text)  判断内容text是否出现在元素中

       text_to_be_present_in_element(By.xxx,"xxx")

    text_to_be_present_in_element_value(locator,text)  判断text是否出现在元素的value属性中

      text_to_be_present_in_element_value((By.xxx,"xxx"), "valuexxx")

  • 相关阅读:
    对jquery的 attr()和prop()理解
    你真的了解javascript吗
    js代码的一些小技巧
    导出导入数据库
    Mysql授权root用户远程登录
    Centos 忘记root密码怎么办?
    linux挂载概念简述:
    centos7防火墙设置
    centos 防火墙
    centos共享目录
  • 原文地址:https://www.cnblogs.com/erchun/p/11892011.html
Copyright © 2020-2023  润新知