def test_search(self): u"oms用户搜索" driver=self.driver login_oms.login(self) time.sleep(2) #定位用户管理菜单栏 yonghuguanli="div.nav-collapse ul#menu.nav li.menu:nth-child(3) a.menu" yonghuguanli_ele=WebDriverWait(driver,10).until(lambda x:x.find_element_by_css_selector(yonghuguanli)) yonghuguanli_ele.click() time.sleep(2) #'swith to mainframe' driver.switch_to_frame("mainFrame") #查询方式选择框 xuanzekuang=driver.find_element_by_css_selector("form#searchForm.breadcrumb label select#searchFlag.input-medium") xuanzekuang.find_element_by_css_selector("option[value='4']").click() driver.find_element_by_id("searchValue").clear() driver.find_element_by_id("searchValue").send_keys('15900000000') driver.find_element_by_id("btnSubmit").click() #查询结果的第一个的用户名/手机号 user_moblile1="div table#contentTable.table tbody tr:nth-child(1) td:nth-child(1) a" #user_moblile1_val=WebDriverWait(driver,10).until(lambda x:x.find_element_by_css_selector(user_moblile1)) try: user_moblile1_val=driver.find_element_by_css_selector(user_moblile1).text except StaleElementReferenceException: time.sleep(2) user_moblile1_val=driver.find_element_by_css_selector(user_moblile1).text self.assertIn('15900000000',user_moblile1_val,u"查询失败")
def test_search(self): u"oms用户搜索" driver = self.driver login_oms.login(self) time.sleep(2) #定位用户管理菜单栏 yonghuguanli = "div.nav-collapse ul#menu.nav li.menu:nth-child(3) a.menu" yonghuguanli_ele = WebDriverWait( driver, 10).until(lambda x: x.find_element_by_css_selector(yonghuguanli)) yonghuguanli_ele.click() time.sleep(2) #'swith to mainframe' driver.switch_to_frame("mainFrame") #查询方式选择框 xuanzekuang = driver.find_element_by_css_selector( "form#searchForm.breadcrumb label select#searchFlag.input-medium") xuanzekuang.find_element_by_css_selector("option[value='4']").click() driver.find_element_by_id("searchValue").clear() driver.find_element_by_id("searchValue").send_keys('15900000000') driver.find_element_by_id("btnSubmit").click() #查询结果的第一个的用户名/手机号 user_moblile1 = "div table#contentTable.table tbody tr:nth-child(1) td:nth-child(1) a" #user_moblile1_val=WebDriverWait(driver,10).until(lambda x:x.find_element_by_css_selector(user_moblile1)) try: user_moblile1_val = driver.find_element_by_css_selector( user_moblile1).text except StaleElementReferenceException: time.sleep(2) user_moblile1_val = driver.find_element_by_css_selector( user_moblile1).text self.assertIn('15900000000', user_moblile1_val, u"查询失败")
def test_login(self): u"""验证登录oms""" driver=self.driver #driver.get(self.base_url) login_oms.login(self) #左上角用户登录名称信息 page_username="******" admin=u"管理员" page_admin=driver.find_element_by_css_selector(page_username).text self.assertIn(admin,page_admin,u"用户名错误")
def test_login(self): u"""验证登录oms""" driver = self.driver #driver.get(self.base_url) login_oms.login(self) #左上角用户登录名称信息 page_username = "******" admin = u"管理员" page_admin = driver.find_element_by_css_selector(page_username).text self.assertIn(admin, page_admin, u"用户名错误")
def test_geren_yicixing(self): u"""个人进件一次性""" print 'yicixing' refundway = 1 driver=self.driver #driver.get(self.base_url) login_oms.login(self) #交易管理 time.sleep(2) jiaoyiguanli_ele="ul#menu.nav li.menu:nth-child(2) a.menu" driver.find_element_by_css_selector(jiaoyiguanli_ele).click() #默认为进件录入,直接切换iframe #driver.switch_to_frame("mainFrame") #定位进件渠道 time.sleep(2) elements=jiaoyiguanli.jinjianluru(self) time.sleep(2) jinjianqudao="div.controls select#borrowSource.input-medium" driver.find_element_by_css_selector(jinjianqudao).find_element_by_css_selector("select#borrowSource.input-medium option[value='%s']"%domain).click() #点击公司or个人 driver.find_element_by_css_selector("div.control-group div.controls input[value='person']").click() elements[0][1].send_keys(u"自动化测试") elements[0][2].send_keys('320701197905145687') elements[0][3].send_keys("15300000000") elements[0][4].send_keys(u"测试") #点击实名认证按钮 driver.find_element_by_css_selector("div.controls input#btnCheckIdCard.btn").click() time.sleep(3) driver.switch_to_alert().accept() #借款信息 biaoti_display=driver.find_element_by_css_selector("div#borrowTitleInputDiv div#borrowTitlePreDiv").is_displayed() if not biaoti_display: driver.find_element_by_css_selector(" div.control-group div.controls div#borrowTitleEditDiv a").click() driver.find_element_by_css_selector("input#borrowTitlePre.input-medium").clear() driver.find_element_by_css_selector("input#borrowTitlePre.input-medium").send_keys(u"一次性还本息") driver.find_element_by_css_selector("div#borrowTitleBtnDiv input#borrowTitleOkBtn.btn").click() driver.find_element_by_css_selector('input#borrowTitleSeq.input-medium').clear() driver.find_element_by_css_selector('input#borrowTitleSeq.input-medium').send_keys(1) else: driver.find_element_by_css_selector("input#borrowTitlePre.input-medium").send_keys(u"一次性还本息") driver.find_element_by_css_selector("div#borrowTitleBtnDiv input#borrowTitleOkBtn.btn").click() driver.find_element_by_css_selector('input#borrowTitleSeq.input-medium').send_keys(1) #借款金额 elements[1].send_keys(return_bidconf('borrowamount')) #起息方式 driver.find_element_by_css_selector('div.controls select#valueWay.input-mini').find_element_by_css_selector("option[value='2']").click() #借款期限 driver.find_element_by_css_selector(' div.controls select#borrowPeriodUnit.input-mini').find_element_by_css_selector("option[value='%s']"%return_bidconf('borrowunit')).click() elements[2].send_keys(return_bidconf('borrowlimit_yici')) #筹标期限 elements[3].send_keys(7) #还款方式 huankuanfangshi=driver.find_element_by_css_selector("div.control-group div.controls select#refundWay.input-mini") #还款方式 一次性还本息 huankuanfangshi.find_element_by_css_selector("option[value='%s']"%refundway).click() #借款总成本 driver.find_element_by_css_selector("div.controls input#borrowDegression.input-medium").send_keys(str(return_bidconf('borrowdegression'))) #筹款利率 driver.find_element_by_css_selector("div.controls input#borrowRate.input-medium").send_keys(str(return_bidconf('borrowRate'))) time.sleep(1) driver.find_element_by_css_selector("input#btnNextStep.btn").click() time.sleep(10) #终定选择页面 #table#contentTable.table tbody tr td a.status[bid='309'] con=Bankunion_proc() biao_id=con.back_biaoid(bankname=domain,bidstatus=10) if biao_id is None: time.sleep(5) con=Bankunion_proc() biao_id=con.back_biaoid(bankname=domain,bidstatus=10) while 1: try: zhongding=driver.find_element_by_css_selector("table#contentTable.table tbody tr td a.status[bid='%s']"%biao_id) break except NoSuchElementException: time.sleep(3) zhongding.click() time.sleep(1) refundwayname=driver.find_element_by_xpath("/html/body/form/table[2]/thead/tr[4]/th[2]").text self.assertEqual(u"一次性还本息", refundwayname, u"还款方式错误") #点击批核按钮 driver.find_element_by_css_selector("form#inputForm.form-horizontal div input[type='radio'][value='1']").click() #点击保存按钮 driver.find_element_by_css_selector("div.form-actions input#btnSubmit.btn").click() #driver.switch_to_frame("") driver.switch_to_default_content() time.sleep(2) ntime=0 while 1: try: driver.find_element_by_css_selector("div#jbox-state-state0.jbox-state div.jbox-button-panel button.jbox-button[value='ok']").click() break except NoSuchElementException: time.sleep(2) ntime+=2 if ntime>10: break time.sleep(2)
def test_tjsbid(self): u"""天交所票据进件及终定""" #起息日 productBreathDay = (datetime.datetime.now() + datetime.timedelta(days=3)).strftime('%Y%m%d') #兑付日 productsToHonour = (datetime.datetime.now() + datetime.timedelta(days=32)).strftime('%Y%m%d') #到期日 productDueDate = (datetime.datetime.now() + datetime.timedelta(days=31)).strftime('%Y%m%d') #下架日期 underDate = '%s-240000' % ( datetime.datetime.now() + datetime.timedelta(days=1)).strftime('%Y%m%d') #上架日期 registerDate = '%s-010000' % datetime.datetime.now().strftime('%Y%m%d') str_json = '''{"productDescription":"【产品说明】本产品为天津金融资产交易所挂牌的收益权转让产品,您在购买时需要先注册成为天津金融资产交易所的会员或注册投资者。本产品起购金额为5000元,购买前请认真阅读《产品合约》、《产品说明书》等相关文件,当您“确认付款”则表示您已确认并同意《产品合约》、《产品说明书》等相关文件中的内容。","no":"3", "monetaryUnit":"156","productRiskI":"【风险提示】 本产品为约定收益产品,投资有风险,详情请您参考《产品说明书》。","productType":"SCP_ZQSYQ", "sumAmount":"2251165","productContractID":"SFH(JZ)(HHJZ)201500201001_contract.html","issuerCType":"1","issuerBankA":"77230154740007480","riskAssessmentTables":"", "underDate":"%(underDate)s","productBreathDay":"%(productBreathDay)s","productEIn":"【收益说明】本产品约定年化收益率为6.5。本产品根据投资人持有产品的实 际天数计算收益, 产品到期日不计息。本产品认购期间内认购资金不享受收益。 ", "productBNRiskRating":"1","productQAgeUpperL":"","lowestRiskAScore":"24","issuer":"天津智通慧达资产管理有限公司", "fileName":"/home/testspace/bank_ticket/tjs/splitTxt/CPGP-XXXX-20150801-2.txt","productRiskLevel":"M","minRaiseSuccessAmount":"75000", "productRDocuments5":"","productQAgeLowerL":"","linesAFRate":"","registerDate":"%(registerDate)s","issuerCity":"天津市","guaranteedAIRate":"%(guaranteedAIRate)s", "issuerInstitution":"TJFAE_888888","unitPriceAmount":"%(unitPriceAmount)s","issuerASign":"1","reserved4":"","productDueDate":"%(productDueDate)s", "reserved2":"","reserved3":"","reserved1":"","productDeadline":"64","productCode":"SFH(JZ)(HHJZ)201500201","earningsCountType":"1", "expectedAYield":"%(expectedAYield)s","issuerCe":"30057952-8","salesAmount":"%(salesAmount)s","productCodeSon":"001","raiseAmount":"%(raiseAmount)s","productRDocuments3":"", "productName":"天津金融资产交易所“京诚宝”2015年第2期第1款002号集合债权支持类收益分享合约产品","productsToHonour":"%(productsToHonour)s", "productRDocuments4":"","issuerAOBank":"上海浦东发展银行天津科技支行","allowsSecMarketTrading":"1","productRDocuments1":"","earningsType":"1", "issuerProvince":"天津","productTermUnit":"D","productRDocuments2":""}''' % { 'underDate': underDate, 'registerDate': registerDate, 'productDueDate': productDueDate, 'productsToHonour': productsToHonour, 'productBreathDay': productBreathDay, 'unitPriceAmount': '2000', 'salesAmount': '5000', 'raiseAmount': '81234', 'guaranteedAIRate': '0.067000', 'expectedAYield': '0.067000' } url = 'http://%s:6005/hdb/autoSuperScript/save' % DBHOST headers = {'content-type': 'application/json'} r = requests.post(url, data=str_json, headers=headers) print r.text self.assertEqual(r.text, '00000000', "tjs_bid_post_success") #进入oms终定审核tjs标 driver = self.driver login_oms.login(self) # time.sleep(2) # driver.switch_to_default_content() time.sleep(3) jiaoyiguanli_ele = "ul#men u.nav li.menu:nth-child(2) a.menu" driver.find_element_by_css_selector(jiaoyiguanli_ele).click() driver.switch_to_frame("menuFrame") time.sleep(3) #点击借款管理 driver.find_element_by_xpath("/html/body/div[3]/div[2]/div/a").click() time.sleep(1) driver.find_element_by_css_selector( "div#collapse169.accordion-body div.accordion-inner ul.nav li:nth-child(2) a.lh001" ).click() time.sleep(2) con = Bankunion_proc() biao_id = con.back_biaoid(bankname='lccb', bidstatus=10) if biao_id is None: time.sleep(5) con = Bankunion_proc() biao_id = con.back_biaoid(bankname='lccb', bidstatus=10) driver.switch_to_default_content() driver.switch_to_frame("mainFrame") while 1: try: zhongding = driver.find_element_by_css_selector( "table#contentTable.table tbody tr td a.status[bid='%s']" % biao_id) break except NoSuchElementException: time.sleep(3) break zhongding.click() time.sleep(1) refundwayname = driver.find_element_by_xpath( "/html/body/form/table[2]/thead/tr[4]/th[2]").text self.assertEqual(u"到期一次性还本付息", refundwayname, u"还款方式错误") #点击批核按钮 driver.find_element_by_css_selector( "form#inputForm.form-horizontal div input[type='radio'][value='1']" ).click() #点击保存按钮 driver.find_element_by_css_selector( "div.form-actions input#btnSubmit.btn").click() #driver.switch_to_frame("") driver.switch_to_default_content() time.sleep(2) ntime = 0 while 1: try: driver.find_element_by_css_selector( "div#jbox-state-state0.jbox-state div.jbox-button-panel button.jbox-button[value='ok']" ).click() break except NoSuchElementException: time.sleep(2) ntime += 2 if ntime > 10: break time.sleep(3)
def test_geren_yicixing(self): u"""个人进件一次性""" print 'yicixing' refundway = 1 driver = self.driver #driver.get(self.base_url) login_oms.login(self) #交易管理 time.sleep(2) jiaoyiguanli_ele = "ul#menu.nav li.menu:nth-child(2) a.menu" driver.find_element_by_css_selector(jiaoyiguanli_ele).click() #默认为进件录入,直接切换iframe #driver.switch_to_frame("mainFrame") #定位进件渠道 time.sleep(2) elements = jiaoyiguanli.jinjianluru(self) time.sleep(2) jinjianqudao = "div.controls select#borrowSource.input-medium" driver.find_element_by_css_selector( jinjianqudao).find_element_by_css_selector( "select#borrowSource.input-medium option[value='%s']" % domain).click() #点击公司or个人 driver.find_element_by_css_selector( "div.control-group div.controls input[value='person']").click() elements[0][1].send_keys(u"自动化测试") elements[0][2].send_keys('320701197905145687') elements[0][3].send_keys("15300000000") elements[0][4].send_keys(u"测试") #点击实名认证按钮 driver.find_element_by_css_selector( "div.controls input#btnCheckIdCard.btn").click() time.sleep(3) driver.switch_to_alert().accept() #借款信息 biaoti_display = driver.find_element_by_css_selector( "div#borrowTitleInputDiv div#borrowTitlePreDiv").is_displayed() if not biaoti_display: driver.find_element_by_css_selector( " div.control-group div.controls div#borrowTitleEditDiv a" ).click() driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").clear() driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").send_keys(u"一次性还本息") driver.find_element_by_css_selector( "div#borrowTitleBtnDiv input#borrowTitleOkBtn.btn").click() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').clear() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').send_keys(1) else: driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").send_keys(u"一次性还本息") driver.find_element_by_css_selector( "div#borrowTitleBtnDiv input#borrowTitleOkBtn.btn").click() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').send_keys(1) #借款金额 elements[1].send_keys(return_bidconf('borrowamount')) #起息方式 driver.find_element_by_css_selector( 'div.controls select#valueWay.input-mini' ).find_element_by_css_selector("option[value='2']").click() #借款期限 driver.find_element_by_css_selector( ' div.controls select#borrowPeriodUnit.input-mini' ).find_element_by_css_selector("option[value='%s']" % return_bidconf('borrowunit')).click() elements[2].send_keys(return_bidconf('borrowlimit_yici')) #筹标期限 elements[3].send_keys(7) #还款方式 huankuanfangshi = driver.find_element_by_css_selector( "div.control-group div.controls select#refundWay.input-mini") #还款方式 一次性还本息 huankuanfangshi.find_element_by_css_selector("option[value='%s']" % refundway).click() #借款总成本 driver.find_element_by_css_selector( "div.controls input#borrowDegression.input-medium").send_keys( str(return_bidconf('borrowdegression'))) #筹款利率 driver.find_element_by_css_selector( "div.controls input#borrowRate.input-medium").send_keys( str(return_bidconf('borrowRate'))) time.sleep(1) driver.find_element_by_css_selector("input#btnNextStep.btn").click() time.sleep(10) #终定选择页面 #table#contentTable.table tbody tr td a.status[bid='309'] con = Bankunion_proc() biao_id = con.back_biaoid(bankname=domain, bidstatus=10) if biao_id is None: time.sleep(5) con = Bankunion_proc() biao_id = con.back_biaoid(bankname=domain, bidstatus=10) while 1: try: zhongding = driver.find_element_by_css_selector( "table#contentTable.table tbody tr td a.status[bid='%s']" % biao_id) break except NoSuchElementException: time.sleep(3) zhongding.click() time.sleep(1) refundwayname = driver.find_element_by_xpath( "/html/body/form/table[2]/thead/tr[4]/th[2]").text self.assertEqual(u"一次性还本息", refundwayname, u"还款方式错误") #点击批核按钮 driver.find_element_by_css_selector( "form#inputForm.form-horizontal div input[type='radio'][value='1']" ).click() #点击保存按钮 driver.find_element_by_css_selector( "div.form-actions input#btnSubmit.btn").click() #driver.switch_to_frame("") driver.switch_to_default_content() time.sleep(2) ntime = 0 while 1: try: driver.find_element_by_css_selector( "div#jbox-state-state0.jbox-state div.jbox-button-panel button.jbox-button[value='ok']" ).click() break except NoSuchElementException: time.sleep(2) ntime += 2 if ntime > 10: break time.sleep(2)
def test_new_bid(self): u"""个人进件晋中新手标进件投标""" refundway = 1 driver = self.driver #driver.get(self.base_url) login_oms.login(self) #交易管理 time.sleep(1) jiaoyiguanli_ele = "ul#menu.nav li.menu:nth-child(2) a.menu" driver.find_element_by_css_selector(jiaoyiguanli_ele).click() #默认为进件录入,直接切换iframe #driver.switch_to_frame("mainFrame") #定位进件渠道 time.sleep(2) elements = jiaoyiguanli.jinjianluru(self) time.sleep(2) jinjianqudao = "div.controls select#borrowSource.input-medium" driver.find_element_by_css_selector( jinjianqudao).find_element_by_css_selector( "select#borrowSource.input-medium option[value='%s']" % 'jzbank').click() #点击公司or个人 driver.find_element_by_css_selector( "div.control-group div.controls input[value='person']").click() elements[0][1].send_keys(u"自动化测试") elements[0][2].send_keys('320701197905145687') elements[0][3].send_keys("15300000000") elements[0][4].send_keys(u"测试") #点击实名认证按钮 driver.find_element_by_css_selector( "div.controls input#btnCheckIdCard.btn").click() time.sleep(3) driver.switch_to_alert().accept() #借款信息 biaoti_display = driver.find_element_by_css_selector( "div#borrowTitleInputDiv div#borrowTitlePreDiv").is_displayed() if not biaoti_display: driver.find_element_by_css_selector( " div.control-group div.controls div#borrowTitleEditDiv a" ).click() driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").clear() driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").send_keys(u"晋中新手标") driver.find_element_by_css_selector( "div#borrowTitleBtnDiv input#borrowTitleOkBtn.btn").click() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').clear() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').send_keys(1) else: driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").send_keys(u"晋中新手标") driver.find_element_by_css_selector( "div#borrowTitleBtnDiv input#borrowTitleOkBtn.btn").click() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').send_keys(1) time.sleep(3) #借款金额 elements[1].send_keys(return_bidconf('borrowamount')) #借款产品类型 driver.find_element_by_css_selector( " div.control-group div.controls select#productType.input-mini" ).find_element_by_css_selector("option[value='2']").click() #借款期限 driver.find_element_by_css_selector( ' div.controls select#borrowPeriodUnit.input-mini' ).find_element_by_css_selector("option[value='1']").click() elements[2].send_keys(return_bidconf('borrowlimit_yici')) #筹标期限 elements[3].send_keys(7) #还款方式 huankuanfangshi = driver.find_element_by_css_selector( "div.control-group div.controls select#refundWay.input-mini") #还款方式 一次性还本息 huankuanfangshi.find_element_by_css_selector("option[value='%s']" % refundway).click() #借款总成本 driver.find_element_by_css_selector( "div.controls input#borrowDegression.input-medium").send_keys( str(return_bidconf('borrowdegression'))) #筹款利率 driver.find_element_by_css_selector( "div.controls input#borrowRate.input-medium").send_keys( str(return_bidconf('borrowRate'))) time.sleep(1) driver.find_element_by_css_selector("input#btnNextStep.btn").click() time.sleep(9) #终定选择页面 #table#contentTable.table tbody tr td a.status[bid='309'] con = Bankunion_proc() biao_id = con.back_biaoid(bankname='jzbank', bidstatus=10) ntime = 0 while 1: try: zhongding = driver.find_element_by_css_selector( "table#contentTable.table tbody tr td a.status[bid='%s']" % biao_id) break except NoSuchElementException: time.sleep(2) ntime += 2 if ntime > 9: break zhongding.click() time.sleep(1) driver.switch_to_default_content() time.sleep(1) driver.switch_to_frame("mainFrame") refundwayname = driver.find_element_by_xpath( "/html/body/form/table[2]/thead/tr[4]/th[2]").text self.assertEqual(u"一次性还本息", refundwayname, u"还款方式错误") #点击批核按钮 driver.find_element_by_css_selector( "form#inputForm.form-horizontal div input[type='radio'][value='1']" ).click() #js清除readonly属性 #js='document.getElementById("publishDate").removeAttribute("readonly");' #driver.execute_script(js) #time.sleep(2) #上线时间 #onlinetime=datetime.datetime.now()+ datetime.timedelta(hours = 1) #onlinetime=onlinetime.strftime('%Y-%m-%d %H:%M:%S') #driver.find_element_by_css_selector("div.controls input#publishDate.input-medium").send_keys("%s"%onlinetime) #点击保存按钮 driver.find_element_by_css_selector( "div.form-actions input#btnSubmit.btn").click() time.sleep(1) driver.switch_to_default_content() time.sleep(1) ntime = 0 while 1: try: driver.find_element_by_css_selector( "div#jbox-state-state0.jbox-state div.jbox-button-panel button.jbox-button[value='ok']" ).click() break except NoSuchElementException: time.sleep(2) ntime += 2 if ntime > 10: break time.sleep(2) #website login_bank.login_bank(self, new_username, new_password, 'jzbank') driver.get(bank_url + '/bid/content/' + str(biao_id)) driver.find_element_by_css_selector( ' div.leftArea input#toubiaojine.num-amount').send_keys('100') driver.find_element_by_css_selector( 'div.rightCon div.btnWrap input#toubiao.btnFortb').click() time.sleep(2) tishi = driver.find_element_by_css_selector( ' table.aui_dialog tbody tr td.aui_main div.aui_content').text self.assertEqual(tishi, u'恭喜您,投标成功!', u'投资新手标失败') #点击确定 driver.find_element_by_css_selector( 'tr td.aui_footer div.aui_buttons button.aui_state_highlight' ).click() time.sleep(2) driver.find_element_by_css_selector( ' div.leftArea input#toubiaojine.num-amount').send_keys('100') driver.find_element_by_css_selector( 'div.rightCon div.btnWrap input#toubiao.btnFortb').click() tishi = driver.find_element_by_css_selector( ' table.aui_dialog tbody tr td.aui_main div.aui_content').text self.assertEqual(tishi, u'非首次投标用户,不可以投新手标;请查看其它产品。', u'投资新手标失败') time.sleep(2)
def test_jzxintuo(self): u"""个人晋中信托进件""" refundway = 1 driver = self.driver login_oms.login(self) #交易管理 time.sleep(1) jiaoyiguanli_ele = "ul#menu.nav li.menu:nth-child(2) a.menu" driver.find_element_by_css_selector(jiaoyiguanli_ele).click() #默认为进件录入,login_omse #driver.switch_to_frame("mainFrame") #定位进件渠道 time.sleep(2) elements = jiaoyiguanli.jinjianluru(self) time.sleep(2) jinjianqudao = "div.controls select#borrowSource.input-medium" driver.find_element_by_css_selector( jinjianqudao).find_element_by_css_selector( "select#borrowSource.input-medium option[value='%s']" % 'jzbank').click() #点击公司or个人 driver.find_element_by_css_selector( "div.control-group div.controls input[value='person']").click() elements[0][1].send_keys(u"自动化测试") elements[0][2].send_keys('320701197905145687') elements[0][3].send_keys("15300000000") elements[0][4].send_keys(u"测试") #点击实名认证按钮 driver.find_element_by_css_selector( "div.controls input#btnCheckIdCard.btn").click() time.sleep(3) driver.switch_to_alert().accept() #借款信息 biaoti_display = driver.find_element_by_css_selector( "div#borrowTitleInputDiv div#borrowTitlePreDiv").is_displayed() if not biaoti_display: driver.find_element_by_css_selector( " div.control-group div.controls div#borrowTitleEditDiv a" ).click() driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").clear() driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").send_keys(u"晋中信贷") driver.find_element_by_css_selector( "div#borrowTitleBtnDiv input#borrowTitleOkBtn.btn").click() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').clear() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').send_keys(1) else: driver.find_element_by_css_selector( "input#borrowTitlePre.input-medium").send_keys(u"晋中信贷") driver.find_element_by_css_selector( "div#borrowTitleBtnDiv input#borrowTitleOkBtn.btn").click() driver.find_element_by_css_selector( 'input#borrowTitleSeq.input-medium').send_keys(1) time.sleep(3) #借款金额 elements[1].send_keys(return_bidconf('borrowamount')) #借款产品类型 driver.find_element_by_css_selector( " div.control-group div.controls select#productType.input-mini" ).find_element_by_css_selector("option[value='4']").click() js1 = 'document.getElementById("valueDate").removeAttribute("readonly")' js2 = 'document.getElementById("toDate").removeAttribute("readonly")' driver.execute_script(js1) time.sleep(1) driver.execute_script(js2) time.sleep(5) #起息日期为当前日期加两天 driver.find_element_by_css_selector( 'div div.controls input#valueDate.input-small').send_keys( '%s' % valueDate) #到期日期 driver.find_element_by_css_selector( 'div div.controls input#toDate.input-small').send_keys('%s' % toDate) #借款期限 driver.find_element_by_css_selector( 'div.controls input#borrowLimitTjs.input-medium').click() #筹标期限 elements[3].send_keys(7) #还款方式 huankuanfangshi = driver.find_element_by_css_selector( "div.control-group div.controls select#refundWay.input-mini") #还款方式 一次性还本息 huankuanfangshi.find_element_by_css_selector("option[value='%s']" % refundway).click() #借款总成本 driver.find_element_by_css_selector( "div.controls input#borrowDegression.input-medium").send_keys( str(return_bidconf('borrowdegression'))) time.sleep(2) #筹款利率 driver.find_element_by_css_selector( "div.controls input#borrowRate.input-medium").send_keys( str(return_bidconf('borrowRate'))) time.sleep(1) driver.find_element_by_css_selector("input#btnNextStep.btn").click() time.sleep(10) #终定选择页面 #table#contentTable.table tbody tr td a.status[bid='309'] con = Bankunion_proc() biao_id = con.back_biaoid(bankname='jzbank', bidstatus=10) ntime = 0 while 1: try: zhongding = driver.find_element_by_css_selector( "table#contentTable.table tbody tr td a.status[bid='%s']" % biao_id) except NoSuchElementException: time.sleep(2) ntime += 2 if ntime > 9: break zhongding.click() time.sleep(1) #refundwayname=driver.find_element_by_xpath("/html/body/form/table[2]/thead/tr[4]/th[2]").text #self.assertEqual(u"按月付息到期还本", refundwayname, u"还款方式错误") refundwayname = driver.find_element_by_xpath( "/html/body/form/table[2]/thead/tr[4]/th[2]").text self.assertEqual(u"一次性还本息", refundwayname, u"还款方式错误") #点击批核按钮 driver.find_element_by_css_selector( "form#inputForm.form-horizontal div input[type='radio'][value='1']" ).click() #点击保存按钮 driver.find_element_by_css_selector( "div.form-actions input#btnSubmit.btn").click() time.sleep(1) driver.switch_to_default_content() time.sleep(1) ntime = 0 while 1: try: driver.find_element_by_css_selector( "div#jbox-state-state0.jbox-state div.jbox-button-panel button.jbox-button[value='ok']" ).click() break except NoSuchElementException: time.sleep(2) ntime += 2 if ntime > 10: break time.sleep(2)
def test_tjsbid(self): u"""天交所票据进件及终定""" #起息日 productBreathDay = (datetime.datetime.now() + datetime.timedelta(days = 3)).strftime('%Y%m%d') #兑付日 productsToHonour = (datetime.datetime.now() + datetime.timedelta(days = 32)).strftime('%Y%m%d') #到期日 productDueDate = (datetime.datetime.now() + datetime.timedelta(days = 31)).strftime('%Y%m%d') #下架日期 underDate = '%s-240000'%(datetime.datetime.now() + datetime.timedelta(days = 1)).strftime('%Y%m%d') #上架日期 registerDate = '%s-010000'%datetime.datetime.now().strftime('%Y%m%d') str_json='''{"productDescription":"【产品说明】本产品为天津金融资产交易所挂牌的收益权转让产品,您在购买时需要先注册成为天津金融资产交易所的会员或注册投资者。本产品起购金额为5000元,购买前请认真阅读《产品合约》、《产品说明书》等相关文件,当您“确认付款”则表示您已确认并同意《产品合约》、《产品说明书》等相关文件中的内容。","no":"3", "monetaryUnit":"156","productRiskI":"【风险提示】 本产品为约定收益产品,投资有风险,详情请您参考《产品说明书》。","productType":"SCP_ZQSYQ", "sumAmount":"2251165","productContractID":"SFH(JZ)(HHJZ)201500201001_contract.html","issuerCType":"1","issuerBankA":"77230154740007480","riskAssessmentTables":"", "underDate":"%(underDate)s","productBreathDay":"%(productBreathDay)s","productEIn":"【收益说明】本产品约定年化收益率为6.5。本产品根据投资人持有产品的实 际天数计算收益, 产品到期日不计息。本产品认购期间内认购资金不享受收益。 ", "productBNRiskRating":"1","productQAgeUpperL":"","lowestRiskAScore":"24","issuer":"天津智通慧达资产管理有限公司", "fileName":"/home/testspace/bank_ticket/tjs/splitTxt/CPGP-XXXX-20150801-2.txt","productRiskLevel":"M","minRaiseSuccessAmount":"75000", "productRDocuments5":"","productQAgeLowerL":"","linesAFRate":"","registerDate":"%(registerDate)s","issuerCity":"天津市","guaranteedAIRate":"%(guaranteedAIRate)s", "issuerInstitution":"TJFAE_888888","unitPriceAmount":"%(unitPriceAmount)s","issuerASign":"1","reserved4":"","productDueDate":"%(productDueDate)s", "reserved2":"","reserved3":"","reserved1":"","productDeadline":"64","productCode":"SFH(JZ)(HHJZ)201500201","earningsCountType":"1", "expectedAYield":"%(expectedAYield)s","issuerCe":"30057952-8","salesAmount":"%(salesAmount)s","productCodeSon":"001","raiseAmount":"%(raiseAmount)s","productRDocuments3":"", "productName":"天津金融资产交易所“京诚宝”2015年第2期第1款002号集合债权支持类收益分享合约产品","productsToHonour":"%(productsToHonour)s", "productRDocuments4":"","issuerAOBank":"上海浦东发展银行天津科技支行","allowsSecMarketTrading":"1","productRDocuments1":"","earningsType":"1", "issuerProvince":"天津","productTermUnit":"D","productRDocuments2":""}''' % {'underDate':underDate,'registerDate':registerDate, 'productDueDate':productDueDate,'productsToHonour':productsToHonour,'productBreathDay':productBreathDay,'unitPriceAmount':'2000','salesAmount':'5000', 'raiseAmount':'81234','guaranteedAIRate':'0.067000','expectedAYield':'0.067000'} url = 'http://%s:6005/hdb/autoSuperScript/save'%DBHOST headers = {'content-type': 'application/json'} r = requests.post(url, data=str_json, headers=headers) print r.text self.assertEqual(r.text, '00000000', "tjs_bid_post_success") #进入oms终定审核tjs标 driver=self.driver login_oms.login(self) # time.sleep(2) # driver.switch_to_default_content() time.sleep(3) jiaoyiguanli_ele="ul#men u.nav li.menu:nth-child(2) a.menu" driver.find_element_by_css_selector(jiaoyiguanli_ele).click() driver.switch_to_frame("menuFrame") time.sleep(3) #点击借款管理 driver.find_element_by_xpath("/html/body/div[3]/div[2]/div/a").click() time.sleep(1) driver.find_element_by_css_selector("div#collapse169.accordion-body div.accordion-inner ul.nav li:nth-child(2) a.lh001").click() time.sleep(2) con=Bankunion_proc() biao_id=con.back_biaoid(bankname='lccb',bidstatus=10) if biao_id is None: time.sleep(5) con=Bankunion_proc() biao_id=con.back_biaoid(bankname='lccb',bidstatus=10) driver.switch_to_default_content() driver.switch_to_frame("mainFrame") while 1: try: zhongding=driver.find_element_by_css_selector("table#contentTable.table tbody tr td a.status[bid='%s']"%biao_id) break except NoSuchElementException: time.sleep(3) break zhongding.click() time.sleep(1) refundwayname=driver.find_element_by_xpath("/html/body/form/table[2]/thead/tr[4]/th[2]").text self.assertEqual(u"到期一次性还本付息", refundwayname, u"还款方式错误") #点击批核按钮 driver.find_element_by_css_selector("form#inputForm.form-horizontal div input[type='radio'][value='1']").click() #点击保存按钮 driver.find_element_by_css_selector("div.form-actions input#btnSubmit.btn").click() #driver.switch_to_frame("") driver.switch_to_default_content() time.sleep(2) ntime=0 while 1: try: driver.find_element_by_css_selector("div#jbox-state-state0.jbox-state div.jbox-button-panel button.jbox-button[value='ok']").click() break except NoSuchElementException: time.sleep(2) ntime+=2 if ntime>10: break time.sleep(3)