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"))
  • 相关阅读:
    实习笔记day03
    实习笔记day02
    实习笔记day01
    第4章:数组与方法
    栈内存与堆内存的区别
    java数据类型
    保护模式指令
    空描述符
    段描述符
    全局描述符表
  • 原文地址:https://www.cnblogs.com/chendezhen/p/9914296.html
Copyright © 2011-2022 走看看