#coding=utf-8
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get('http://58.215.9.181/users/sign_in.html')
#采购人登陆
A = driver.find_element_by_id
A('user_login').send_keys('******')
A('user_password').send_keys('*******',Keys.ENTER)#登陆成功
#点击后台管理
time.sleep(2)
driver.find_element_by_class_name('bue').click()
driver.find_element_by_id('tree_9_span').click()
driver.switch_to.frame("80")
driver.find_element_by_link_text("新增发票").click()
time.sleep(1)
driver.find_element_by_id('invoice_type_1').click()
driver.find_element_by_id('invoice_title').send_keys('ceshi')
driver.find_element_by_id('invoice_num').send_keys('8888888888')
driver.find_element_by_id('content_type_1').click()
driver.find_element_by_id('moren_true').click()
driver.find_element_by_class_name('btn-primary').click()
print'新建发票成功'