码迷,mamicode.com
首页 > 编程语言 > 详细

Python--WebDriverWait+expected_conditions的一个应用

时间:2018-11-06 11:57:20      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:chrome   应用   attribute   文件   nbsp   字母   att   load   row   

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"))

 

Python--WebDriverWait+expected_conditions的一个应用

标签:chrome   应用   attribute   文件   nbsp   字母   att   load   row   

原文地址:https://www.cnblogs.com/chendezhen/p/9914296.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!