#CustomerPage.py
###租客信息
# -*- coding:utf8 -*- from base.Base import Base from base import Page from selenium.webdriver.common.by import By from base.Base import log from base.Base import consoleLog import time class CustomerPage(Base): listMould = { 'customer_name_search' : (By.ID,'customer_code_name_mobile_search'), 'search_button' : (By.ID,'search_btn'), 'add_customer_loc' : (By.ID,'customerAdd'), 'delete_button' : (By.ID,'del_btn'), 'alert_confirm': (By.CSS_SELECTOR, '.dialog-button.messager-button > a:nth-child(1) > span'), 'tr_customer': (By.CSS_SELECTOR, '[datagrid-row-index="0"]'), 'is_tr_customer' : (By.CSS_SELECTOR,'[οnclick="CustomerIndex.del(5)"]') } addCustomerMould = { #租客信息 'customer_name_loc' : (By.CSS_SELECTOR,'#customer_name + span > input:nth-child(1)'), #姓名 'customer_phone_loc' : (By.CSS_SELECTOR,'#phone + span > input:nth-child(1)'), #手机号 'customer_gender_loc' : (By.CSS_SELECTOR,'[name="gender"]'), #性别 0男 1女 2未知 'customer_marriage_loc' : (By.CSS_SELECTOR,'[name = "marriage"]'), #婚姻 0未婚 1已婚 2未知 'customer_email_loc' : (By.CSS_SELECTOR,'#email + span > input:nth-child(1)'), #邮箱 'customer_wechat_loc': (By.CSS_SELECTOR, '#wechat + span > input:nth-child(1)'), # 邮箱 'rent_price_min_loc': (By.CSS_SELECTOR, '#rent_from_price + span > input:nth-child(1)'), #求租最小价 'rent_price_max_loc': (By.CSS_SELECTOR, '#rent_to_price + span > input:nth-child(1)'), # 求租最大价 #求租需求 'rent_people_loc': (By.CSS_SELECTOR, '#rent_people + span > input:nth-child(1)'), # 入住人数 'area_loc': (By.CSS_SELECTOR, '#area + span > input:nth-child(1)'), # 求租面积 'rent_other': (By.ID, 'rent_other'), # 其他需求 'submit_loc' : (By.ID,'form_btn') #提交 } typeMould = { #租客信息 'constellation' : '#constellation', #星座 'education': '#education', # 学历 'customer_from': '#customer_from', # 来源 #求租需求 'rent_class': '#rent_class', # 求租等级 'rent_type': '#rent_type', # 求租类型 'rent_use': '#rent_use', # 求租用途 'rent_fitment': '#rent_fitment', # 装修情况 'rent_area_code': '#rent_area_code', # 求租城区 'rent_business_circle': '#rent_business_circle_ids', # 求租商圈 'rent_date': '#rent_date' # 希望入住日 } @log def addCustomer(self): """新增租前客户""" #租客信息 self.open(Page.customerListPage,self.listMould['add_customer_loc'],havaFrame=False) self.click(self.listMould['add_customer_loc']) self.input_text(self.addCustomerMould['customer_name_loc'],'AutoTest') self.input_text(self.addCustomerMould['customer_phone_loc'], '13666666666') self.click(self.addCustomerMould['customer_gender_loc'],index=1) self.click(self.addCustomerMould['customer_marriage_loc'], index=1) self.input_text(self.addCustomerMould['customer_email_loc'], 'mail@mail.com') self.input_text(self.addCustomerMould['customer_wechat_loc'], 'AutoTest') self.type_select(self.typeMould['constellation'],'VIRGO') self.type_select(self.typeMould['education'], 'BACHELOR') self.type_select(self.typeMould['customer_from'], 'LOCAL58') #求租需求 self.type_select(self.typeMould['rent_class'], 'CLASSA') #求租等级-A级 self.type_select(self.typeMould['rent_type'], 'GATHERHOUSE') #求租类型-不限 self.type_select(self.typeMould['rent_use'], 'RESIDENCE') #求租用途-住宅 self.type_select(self.typeMould['rent_fitment'], 'FITMENT_ROUGH') #装修情况-毛坯 self.type_select(self.typeMould['rent_area_code'], '330108') #求租城区-滨江 self.type_select(self.typeMould['rent_business_circle'], '4') #求租商圈-浦沿 self.input_text(self.addCustomerMould['rent_price_min_loc'],'1111') self.input_text(self.addCustomerMould['rent_price_max_loc'], '2222') self.type_date(self.typeMould['rent_date'],'2017-02-02') self.input_text(self.addCustomerMould['rent_people_loc'],'3') self.input_text(self.addCustomerMould['area_loc'],'88.88') self.input_text(self.addCustomerMould['rent_other'],u'浙江省杭州市') self.click(self.addCustomerMould['submit_loc']) self.check_submit() Base.succeed += 1 consoleLog('新增租客成功') def delCustomer(self): """删除租前客户""" #租客信息 self.open(Page.customerListPage,self.listMould['tr_customer'],havaFrame=False) self.input_text(self.listMould['customer_name_search'],'AutoTest') self.click(self.listMould['search_button']) self.staleness_of(self.listMould['tr_customer']) self.click(self.listMould['delete_button']) self.click(self.listMould['alert_confirm']) self.check_submit() consoleLog('租前客户删除成功')