12306查询车票输出二等车车次

在这里插入代码from selenium import webdriver
import time
from selenium.webdriver.support.select import Select
driver=webdriver.Chrome()
driver.get('https://kyfw.12306.cn/otn/leftTicket/init?linktypeid=dc')
fromStation=driver.find_element_by_id('fromStationText')
fromStation.click()
fromStation.send_keys('芜湖\n')
toStation=driver.find_element_by_id('toStationText')
toStation.click()
toStation.send_keys('杭州\n')
driver.find_element_by_xpath('//*[@id="date_range"]/ul/li[5]/span[1]').click()
starttime=Select(driver.find_element_by_css_selector('#cc_start_time'))
starttime.select_by_visible_text('06:00--12:00')
driver.find_element_by_css_selector('#query_ticket').click()
train_eles=driver.find_elements_by_xpath('//*[@id="queryLeftTable"]//td[4][@class]/../td[1]//a')
for t in train_eles:print(t.text)

本文链接:https://my.lmcjl.com/post/16351.html

展开阅读全文

4 评论

留下您的评论.