|
from selenium import webdriver
browser = webdriver.Chrome()
for i in range(25):
browser.get('https://staahmax.staah.net/be/indexpackdetail?m_currency=PHP&display=firm&propertyId=NDkxMA%3D%3D&checkIn='+str(i+4)+'-04-2023&checkOut='+str(i+5)+'-04-2023&display=firm&promoCode=&submit=Search¤cy=PHP')
test_class = browser.find_elements_by_css_selector("[class='packagesHeading packagesTop10 roomtypetitle col-md-8 col-sm-9 col-xs-12 padding0']")
# print(test_class.text)
# 遍历会出错, 不遍历只能得到第一个结果. element加上s 返回的是集合. 不加s返回的text
print("查询日期为"+str(i+4))
for t in test_class:
print("日期为"+str(i+4)+t.text)
browser.quit()
[size=13.0667px]查询日期为4日期为4Mithi Superior Room日期为4Mithi Deluxe Villa日期为4Mithi Seaview Villa查询日期为5查询日期为6查询日期为7
请问大家一下, 为什么第二个FOR循环 只执行一次呀 !
|
|