def pjDoc_projDate_choice(self): current_time('选择立项日期') self.by_xpath('//input[@name="projDate"]/../span/a').click() self.by_xpath("//a[text()='今天']").click() projDate = time.strftime('%Y-%m-%d', time.localtime(time.time())) current_time('立项日期:%s' % projDate) return projDate
def pjInfo_projOpenType_choice(self, openType): # 项目公开类型 # 依法公开/网站公开/不公开 current_time('选择项目公开类型') self.by_xpath( '//*[@id="projFm"]/fieldset[3]/table/tbody/tr[8]/td[2]/span/span/a' ).click() self.by_xpath('//div[text()="%s"]' % openType).click() return openType
def pjInfo_projRegion_choice(self): current_time('选择项目所在行政区') self.by_xpath('//*[@id="_easyui_tree_1"]/span[1]').click() # 省 self.by_xpath('//*[@id="_easyui_tree_2"]/span[2]').click() # 市 self.by_xpath('//*[@id="_easyui_tree_3"]/span[5]').click() # 区 self.by_id('_easyui_tree_1').click() current_time('项目所在行政区:北京市市辖区东城区') return '北京市市辖区东城区'
def bdrInfo_docGetDeadline_choice(self): current_time('选择招标文件发售截止时间') self.by_xpath( '//input[@name="docGetDeadline"]/../span/a').click() # 点击日历控件按钮 y = (datetime.date.today() + relativedelta(days=+1)).year m = (datetime.date.today() + relativedelta(days=+1)).month d = (datetime.date.today() + relativedelta(days=+1)).day ymd = '%s,%s,%s' % (y, m, d) self.by_xpath('//td[@abbr="%s"]' % ymd).click() self.by_xpath( '/html/body/div[13]/div/div[3]/table/tbody/tr/td[2]/a').click()
def choice_role(self, role): # rd = {'招标代理': 'type-agent', '投标人': 'type-bidder', '审核人': 'type-audit', '招标人': 'type-tenderer', # '系统管理员': 'type-superAdmin', '运营单位': 'type-operationUnit'} self.switch_driver() self.role_btn(role).click() try: if self.change_key_window.text == '您的登录密码已经长时间未作修改,建议您每三个月修改一次!': current_time('切换[%s]角色成功' % role) self.switch_driver() return 'success' except: current_time('切换[%s]角色失败' % role) return 'fail'
def enter_page(self, page): dc = { '项目报建': (self.pm_btn_xpath, self.pm_projBuild_btn_xpath), '招标项目备案': (self.pm_btn_xpath, self.pm_tenderProjRecord_btn_xpath), '招标文件备案': (self.tdBack_btn_xpath, self.tdBack_bidDocRecord_btn_xpath), '招标公告': (self.tdBack_btn_xpath, self.tdBack_bidDocNotice_btn_xpath) } try: self.by_xpath('/html/body/div[33]/div[3]/a', ds=2) # 预留3秒寻找是否有修改密码弹窗 except: return 'No Popup' else: self.by_xpath('/html/body/div[33]/div[3]/a', ds=3).click() current_time('关闭修改密码提示弹窗') self.by_xpath(dc[page][0]).click() self.by_xpath(dc[page][1]).click() current_time('点击%s' % page) self.switch_frame(self.frame_xpath)
def login(self, username, password): # self.driver = webdriver.Chrome() # self.driver.get() self.username_text_field.clear() self.username_text_field.send_keys(username) time.sleep(0.5) self.password_text_field.clear() self.password_text_field.send_keys(password) time.sleep(0.5) self.enter_pin() self.login_btn.click() try: info = self.by_xpath('/html/body/div/div/div[1]/ul/li[1]', 2).text if info == '请选择主体类型登录[退出登录]': current_time("登录成功") result = "login_success" return result else: result = 'login_fail' return result except: print('except') info = self.by_xpath('//*[@id="loginForm"]/div/div/div[2]/span', 1).text if info == "验证码错误": time.sleep(0.5) current_time("验证码错误") self.login(username, password) elif info == "用户名或密码错误": current_time("用户名或密码错误") self.login(username, password) else: result = 'login_error' return result
def pjInfo_projClass_chocie(self): current_time('选择项目行业分类') current_time('选择[建筑业]') self.by_xpath( '//*[@id="projFm"]/fieldset[3]/table/tbody/tr[7]/td[2]/span[1]/span/a' ).click() self.by_id('_easyui_combobox_i3_0').click() current_time('选择[建筑业-房屋建筑业]') self.by_xpath( '//*[@id="projFm"]/fieldset[3]/table/tbody/tr[7]/td[2]/span[2]/span/a' ).click() self.by_id('_easyui_combobox_i9_0').click() current_time('选择[建筑业-房屋建筑业-房屋建筑业]') self.by_xpath( '//*[@id="projFm"]/fieldset[3]/table/tbody/tr[7]/td[2]/span[3]/span/a' ).click() self.by_id('_easyui_combobox_i11_0').click() current_time('选择[建筑业-房屋建筑业-房屋建筑业-房屋建筑业]') self.by_xpath( '//*[@id="projFm"]/fieldset[3]/table/tbody/tr[7]/td[2]/span[4]/span/a' ).click() self.by_id('_easyui_combobox_i12_0').click() return "建筑业-房屋建筑业-房屋建筑业-房屋建筑业"
def bdrInfo_docGetStarttime_choice(self): current_time('选择招标文件发售时间') self.by_xpath('//input[@name="docGetStarttime"]/../span/a').click() self.by_xpath("//a[text()='今天']").click()
def pjInfo_tdForm_choice(self, tdForm): # 招标组织形式 # 委托招标/自行招标 current_time('选择招标组织形式') tf = {'委托招标': 'deputeBid', '自行招标': 'selfBid'} self.by_xpath('//input[@id="%s"]' % tf[tdForm])
def add_addOrg_orgList_radio(self, orgName): # 机构名称test201905161001 current_time('招标单位:%s' % orgName) return self.by_xpath('//div[text()="%s"]' % orgName)