如下所示:
from splinter.browser import Browser
b = Browser('chrome')url = 'https://kyfw.12306.cn/otn/leftTicket/init'b.visit(url) #访问网址first_found = b.find_by_id('login_user').click()b.fill('loginUserDTO.user_name', '12306账号')b.fill('userDTO.password', '12306密码') input()sec_found = b.find_by_id('selectYuding').click()b.cookies.add({'_jc_save_fromStation': '%u4E0A%u6D77%2CSHH'})b.cookies.add({'_jc_save_toStation': '%u6D1B%u9633%2CLYF'})b.cookies.add({'_jc_save_fromDate': '2017-02-17'})b.cookies.add({'_jc_save_toDate': '2017-02-19'})b.reload()third_found = b.find_by_text(u'查询').click()b.find_by_text(u'预订')[4].click()
以上这篇Python3.4 splinter(模拟填写表单)使用方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林站长站。
新闻热点
疑难解答