zoukankan      html  css  js  c++  java
  • 显示等待中期望场景

    * 导包: selenium.webdriver.support.expected_conditions as EC

    1> alert_is_present()      //判断页面是否出现alert弹窗

    ey: wait = WebDriverWait(driver,10)

    # 打印alert框的信息

    wait.until(EC.alert_is_present()).text

    2> element_Located_selection_state_to_be(locator,state)      

    // 判断一个元素的状态是否是给定的状态,第一个传入的参数是一个定位器,定位器是一个元祖(by,path),第二个参数表示期望的元素状态,True表示选中状态,False 表示未选中状态;相等返回True,否则返回False.

    ey:

    wait.until(EC.element_located_selection_state_to_be(By.ID,"peach"),True)

    3> element_selection_state_to_be(driverObject,state)

    //判断给定的元素是否被选中,第一个参数是一个webdriver 对象,第二个是期望的元素的状态,相当返回True

    ey:

    wait.until(EC.element_selection_state_to_be(driver.find_element_by_id("peach"),True))

    4> element_located_to_be_selected(locator)

    // 期望某个元素是选中状态,参数是一个定位器

    ey: wait.until(EC.element_locaated_to_be_selected(By.ID,"peach"))

    5> element_to_be_selected(driverObject)

    // 期望某个元素处于选中状态,参数为一个WebDriver实例对象

    ey:wait.until(EC.element_to_be_selected(driver.find_element_by_id("peach")))

    6> element_to_be_clickable(locator)

    // 判断某元素是否可见并且能被单击,条件满足返回该页面元素对象,否则返回False

    ey:wait.until(EC.element_to_be_clickable(By.XPATH,'//input[@Display alert box]'))

  • 相关阅读:
    [LeetCode] 90. 子集 II
    [LeetCode] 91. 解码方法
    [LeetCode] 89. 格雷编码
    [LeetCode] 88. 合并两个有序数组
    转:Google论文之三----MapReduce
    转:Google论文之二----Google文件系统(GFS)翻译学习
    转:Zend Framework 2.0 分析
    转:PHP include()和require()方法的区别
    转:cookie和session(二)——php应用
    转:cookie和session(一)——原理
  • 原文地址:https://www.cnblogs.com/hd-test/p/11737290.html
Copyright © 2011-2022 走看看