zoukankan      html  css  js  c++  java
  • Python--WebDriverWait+expected_conditions的一个应用

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait as Wait
    from selenium.webdriver.support import expected_conditions as Expect
    '''
    注意 expected_conditions 并不是一个类,而是一个文件,它下面有很多类,都是小写字母
    '''
    browser = webdriver.Chrome()
    browser.get('http://www.tuniu.com/flight/intel/sha-sel')
    
    Wait(browser,60).until(Expect.text_to_be_present_in_element((By.ID, "loadingStatus"),u"共搜索"))
    
    flight_items =browser.find_elements_by_class_name("flight-item")
    print(len(flight_items))
    for flight_item in flight_items:
           flight_price_row =flight_item.find_element_by_class_name("flight-price-row")
           print(flight_price_row.get_attribute("data-no"))
  • 相关阅读:
    falsk 自定义中间件
    练习题
    4.12 作业题
    测试笔试题2
    测试笔试题
    简答题
    单选题
    普华和诚测试笔试试题
    缺陷报告
    测试用例点
  • 原文地址:https://www.cnblogs.com/chendezhen/p/9914296.html
Copyright © 2011-2022 走看看