# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.support.select import Select
import login
import time
import unittest
class Pem:
driver = webdriver.Firefox()
driver.maximize_window()
driver.get("http://XXXXXXXXXX/pem/svn/doctorHtml/login.html?id=111")
def login(self):
driver=self.driver
driver.find_element_by_id("accountName").send_keys("222")
driver.find_element_by_id("password").send_keys("222")
driver.find_element_by_xpath("//*[@id='btnSubmit']").click()
time.sleep(3)
def action(self,di):
driver=self.driver
#print(driver.get_cookies())
driver.find_element_by_link_text("个人登记").click()
time.sleep(2)
#选择体检卡
cardType=driver.find_element_by_id("checkCardType")
time.sleep(3)
Select(cardType).select_by_index(2)
time.sleep(2)
driver.find_element_by_id("name").send_keys(di["name"])
time.sleep(2)
#选择医生
doctor=driver.find_element_by_id("doctors")
Select(doctor).select_by_index(1)
time.sleep(2)
#选择性别
gender=driver.find_element_by_xpath("//*[@id='gender']")
Select(gender).select_by_index(1)
#手机号
driver.find_element_by_id("mobile").send_keys(di["mobile"])
time.sleep(2)
driver.find_element_by_id("birthday").send_keys(di["birthday"])
#选择职业
time.sleep(2)
career=driver.find_element_by_xpath("//*[@id='career']")
Select(career).select_by_index(1)
#选择学历
time.sleep(2)
degree=driver.find_element_by_id("degree")
Select(degree).select_by_index(1)
#选择婚姻状况
time.sleep(2)
isMale=driver.find_element_by_id("maritalStatus")
Select(isMale).select_by_index(1)
#选择套餐
time.sleep(2)
driver.find_element_by_xpath("/html/body/div[4]/div/div/div[2]/div[1]/div[1]/div[8]/div/select").click()
driver.find_element_by_xpath("/html/body/div[5]/div/div/div[2]/div/div[1]/i").click()
driver.find_element_by_xpath("//*[@id='btnModelTaocanSubmit']").click()
driver.find_element_by_xpath("//*[@id='btnSubmit']").click()
p=Pem()
dict={"name":"test_008","mobile":"13835177735","birthday":"2000-10-12"}
p.login()
p.action(dict)