#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import os,sys
from urllib import request
from splinter.browser import Browser
import time
import logging
#from log_class import Logger
url="https://kyfw.12306.cn/otn/resources/login.html"
baidu_url="https://www.baidu.com"
def LoginFunc(url):
resp = request.urlopen(url).read()
html = str(resp,encoding='utf-8')
return html
def BaiduSearch(url,text):
browser = Browser(driver_name="chrome")
browser.visit(url)
browser.fill("wd",text)
button = browser.find_by_id(u"su")
button.click()
time.sleep(100)
class WebView(object):
company="xx"
addr="xx"
def __init__(self,your_company,your_addr):
self.company=your_company
self.addr=your_addr
def JenkinsSearch(self,url,user,password):
browser=Browser(driver_name="chrome")
browser.visit(url)
browser.fill("j_username",user)
browser.fill("j_password",password)
browser.find_by_id(u"yui-gen1-button").click()
time.sleep(10)
def TicketLogin(self,url,user,password):
browser=Browser(driver_name="chrome")
browser.visit(url)
#browser.find_by_name(u'login').fill("ds")
browser.find_by_id(u'login_field').fill("1111")
browser.find_by_id(u'password').fill("0000")
#browser.find_by_id(u'fromStationText').click()
#browser.find_by_id(u'fromStationText').fill(123)
#browser.find_by_name(u'email').fill(123)
#browser.fill("userDTO.password",password)
#browser.find_by_id(u"J-login").click()
time.sleep(12)
MyWeb=WebView("xp","gz")
#MyWeb.JenkinsSearch("http://ci.xiaopeng.local:8080","zhahuangbo","Aa123456")
#sMyWeb.TicketLogin("https://www.12306.cn/index/index.html","000000","888888")
#MyWeb.TicketLogin("http://ci.xiaopeng.local:8080/signup","zhahuangbo","Aa123456")
MyWeb.TicketLogin("https://github.com/login","","")