Example #1
0
    def test_Login(self):
        datas = ExcelReader(self.excel).data
        for d in datas:
            with self.subTest(data=d):
                # # Step1: 打开登录页
                # BasePage()
                # Step2: 初始化登录Page

                login_page = LoginPage()

                # Step3: 输入用户名
                login_page.set_username("88812345678")
                # Step4: 输入密码
                login_page.set_password("a12345")
                # Step5: 单击登录按钮
                login_page.click_login()
                time.sleep(1)
                # login_page.driver.close()
                login_page.click_jkbgl()
                login_page.click_ckzjkb()
                time.sleep(1)
                login_page.click_new()
                time.sleep(1)
                login_page.click_bidProduct()
                # 选择产品
                login_page.click_nnyay()  #年年盈按月
                # login_page.click_yyydq()  # 年年盈到期
                login_page.click_loanuse()
                login_page.click_loanuseli()
                login_page.set_title(d['title'])
                login_page.set_bidcode(d['title'])
                login_page.set_totalAmount("10000")
                login_page.set_termValue("12")
                login_page.set_interestRate("10")
                login_page.set_raiseRate("0")
                login_page.set_shouxufei("0")
                login_page.click_choose()
                time.sleep(2)
                login_page.set_loanuser("18888888888")
                login_page.click_search()
                login_page.click_searchok()
                time.sleep(1)
                login_page.click_type()
                # 正常标、爆款标、推荐标
                login_page.click_zcbiao()
                login_page.click_save()
                time.sleep(1)
                login_page.click_ok()
                time.sleep(1)
                # login_page.click_ckzjkb ()
                # time.sleep (1)
                # login_page.set_mingcheng(d['title'])
                # login_page.click_sousuo()
                # time.sleep(1)
                # login_page.click_shangjia()
                # time.sleep(1)
                # login_page.click_shangjiaok()
                login_page.driver.close()
    def test_Login(self):
        datas = ExcelReader (self.excel).data
        for d in datas:
            with self.subTest (data=d):
                login_page=LoginPage()

                # Step3: 输入用户名
                login_page.set_username ("88812345678")
                # Step4: 输入密码
                login_page.set_password ("a12345")
                # Step5: 单击登录按钮
                login_page.click_login ()
                time.sleep(1)
                # login_page.driver.close()
                login_page.click_jkbgl()
                login_page.click_ckzjkb()
                time.sleep (1)
                login_page.click_new()
                time.sleep (1)
                login_page.click_bidProduct()
                # 选择产品
                login_page.click_sanbiao()
                login_page.click_loanuse()
                login_page.click_loanuseli()
                login_page.set_title(d['title'])
                login_page.set_bidcode(d['title'])
                login_page.set_totalAmount("10000")
                login_page.set_termValue("12")
                login_page.set_interestRate("10")
                login_page.set_raiseRate("0")
                login_page.set_shouxufei("0")
                login_page.click_tqhb()#提前还本
                # login_page.click_ayjx()#按月计息
                login_page.set_returnCapDays("0")
                login_page.click_choose()
                time.sleep(2)
                login_page.set_loanuser("13661202883")
                login_page.click_search()
                login_page.click_searchok()
                time.sleep(1)
                login_page.click_type()
                # 正常标、爆款标、推荐标
                login_page.click_zcbiao()
                login_page.click_pipei()
                login_page.click_save()
                time.sleep(1)
                login_page.click_ok()
                time.sleep (1)
                # login_page.click_ckzjkb ()  #返回上架
                # time.sleep (1)
                # login_page.set_mingcheng(d['title'])
                # login_page.click_sousuo()
                # time.sleep(1)
                # login_page.click_shangjia()
                # time.sleep(1)
                # login_page.click_shangjiaok()
                login_page.driver.close()
    def test_Login(self):
        datas = ExcelReader (self.excel).data
        for d in datas:
            with self.subTest (data=d):
                login_page=LoginPage()
                driver=login_page.driver

                # Step3: 输入用户名
                login_page.set_username ("88812345678")
                # Step4: 输入密码
                login_page.set_password ("a12345")
                # Step5: 单击登录按钮
                login_page.click_login ()
                time.sleep(1)
                # login_page.driver.close()
                login_page.click_jkbgl()
                login_page.click_ckzjkb()
                time.sleep (1)
                login_page.click_new()
                time.sleep (1)
                login_page.click_bidProduct()
                # 选择产品
                # login_page.click_yyyay()  #月月赢按月
                #login_page.click_yyydq()  #月月赢到期
                driver.find_element_by_xpath(".//*[@id='bidForm']/div/div/div[1]/select/option[15]").click()#最低招标
                login_page.click_loanuse()
                login_page.click_loanuseli()
                login_page.set_title(d['title'])
                login_page.set_bidcode(d['title'])
                login_page.set_totalAmount("10000")
                login_page.set_termValue("12")
                login_page.set_interestRate("10")
                login_page.set_raiseRate("0")
                login_page.set_shouxufei("0")
                login_page.click_choose()
                time.sleep(2)
                login_page.set_loanuser("13661202883")
                login_page.click_search()
                login_page.click_searchok()
                time.sleep(1)
                login_page.click_type()
                # 正常标、爆款标、推荐标
                login_page.click_zcbiao()
                login_page.click_save()
                time.sleep(1)
                login_page.click_ok()
                time.sleep (1)
                login_page.click_ckzjkb ()
                time.sleep (1)
                login_page.set_mingcheng(d['title'])
                login_page.click_sousuo()
                time.sleep(1)
                login_page.click_shangjia()
                time.sleep(1)
                login_page.click_shangjiaok()
                login_page.driver.close()
Example #4
0
    def test_Login(self):
        # # Step1: 打开登录页
        # BasePage()
        # Step2: 初始化登录Page

        login_page = LoginPage()

        # Step3: 输入用户名
        login_page.set_username("18812345678")
        # Step4: 输入密码
        login_page.set_password("a12345")
        # Step5: 单击登录按钮
        login_page.click_login()
        time.sleep(1)
        # login_page.driver.close()
        login_page.click_jkbgl()
        login_page.click_ckzjkb()
        time.sleep(1)
        login_page.click_new()
        time.sleep(1)
        login_page.click_bidProduct()
        # 选择产品
        login_page.click_Product()
        login_page.click_loanuse()
        login_page.click_loanuseli()
        login_page.set_title("m月月72402")
        login_page.set_bidcode("m月月72402")
        login_page.set_totalAmount("1000000")
        login_page.set_termValue("12")
        login_page.set_interestRate("10")
        login_page.set_raiseRate("0")
        login_page.set_shouxufei("0")
        login_page.click_choose()
        time.sleep(2)
        login_page.set_loanuser("18301306330")
        login_page.click_search()
        login_page.click_searchok()
        time.sleep(1)
        login_page.click_type()
        # 正常标、爆款标、推荐标
        login_page.click_choosetype()
        login_page.click_save()
        time.sleep(1)
        login_page.click_ok()
        time.sleep(1)
        login_page.click_ckzjkb()
        time.sleep(1)
        login_page.set_mingcheng("m月月72402")
        login_page.click_sousuo()
        time.sleep(1)
        login_page.click_shangjia()
        time.sleep(1)
        login_page.click_shangjiaok()
        time.sleep(1)
        login_page.driver.close()
Example #5
0
    def test_Login(self):
        datas = ExcelReader(self.excel).data
        for d in datas:
            with self.subTest(data=d):
                login_page = LoginPage()

                # Step3: 输入用户名
                login_page.set_username("88812345678")
                # Step4: 输入密码
                login_page.set_password("a12345")
                # Step5: 单击登录按钮
                login_page.click_login()
                time.sleep(1)
                # login_page.driver.close()
                login_page.click_jkbgl()
                login_page.click_ckzjkb()
                time.sleep(1)
                login_page.click_new()
                time.sleep(1)
                login_page.click_bidProduct()
                # 选择产品
                login_page.click_haiwaiproduct()  #海外产品
                login_page.click_loanuse()
                login_page.click_loanuseli()
                login_page.set_title(d['title'])
                login_page.set_bidcode(d['title'])
                login_page.set_totalAmount("3000")  #标的金额
                login_page.set_termValue("3")  #投资几个月
                login_page.set_interestRate("10")  #年化收益率
                login_page.set_raiseRate("0")
                login_page.set_shouxufei("0")
                login_page.click_choose()
                time.sleep(2)
                login_page.set_loanuser("13010000016")
                login_page.click_search()
                login_page.click_searchok()
                time.sleep(1)
                login_page.click_type()
                # 正常标、爆款标、推荐标
                login_page.click_zcbiao()
                login_page.click_save()
                time.sleep(1)
                login_page.click_ok()
                time.sleep(1)
                #返回上架
                login_page.click_ckzjkb()
                time.sleep(1)
                login_page.set_mingcheng(d['title'])
                login_page.click_sousuo()
                time.sleep(1)
                login_page.click_shangjia()
                time.sleep(1)
                login_page.click_shangjiaok()
                login_page.driver.close()
    def test_Login(self):
        datas = ExcelReader (self.excel).data
        for d in datas:
            with self.subTest (data=d):
                login_page=LoginPage()
                # Step3: 输入用户名
                login_page.set_username ("88812345678")
                # Step4: 输入密码
                login_page.set_password ("a12345")
                # Step5: 单击登录按钮
                login_page.click_login ()
                time.sleep(1)
                # login_page.driver.close()
                login_page.click_jkbgl()
                login_page.click_ckzjkb()
                time.sleep (1)
                login_page.click_new()
                time.sleep (1)
                login_page.click_bidProduct()
                # 选择产品
                # login_page.click_yyyay()  #月月赢按月

                # login_page.click_yyydq()  #月月赢到期
                # login_page.click_xinshoubiao ()  # 新手标
                login_page.click_huoqiproduct()  #活期产品
                login_page.click_loanuse()
                login_page.click_loanuseli()
                login_page.set_title(d['title'])
                login_page.set_bidcode(d['title'])
                login_page.set_totalAmount("10000") #标的金额
                login_page.set_termValue("6") #投资几个月
                login_page.set_interestRate("10")#年化收益率
                login_page.set_raiseRate("0")
                login_page.set_shouxufei("0")
                login_page.click_choose()
                time.sleep(2)
                login_page.set_loanuser("13010000017")
                login_page.click_search()
                login_page.click_searchok()
                time.sleep(1)
                login_page.click_type()
                # 正常标、爆款标、推荐标
                login_page.click_zcbiao() #正常
                # login_page.click_bkbiao()  #爆款
                # login_page.click_tuijianbiao() #推荐
                login_page.click_save()
                time.sleep(1)
                login_page.click_ok()
                time.sleep (1)
                login_page.driver.quit()
Example #7
0
    def test_Login(self):
        datas = ExcelReader(self.excel).data
        for d in datas:
            with self.subTest(data=d):
                login_page = LoginPage()

                # Step3: 输入用户名
                login_page.set_username("88812345678")
                # Step4: 输入密码
                login_page.set_password("a12345")
                # Step5: 单击登录按钮
                login_page.click_login()
                time.sleep(1)
                # login_page.driver.close()
                login_page.click_jkbgl()
                login_page.click_ckzjkb()
                time.sleep(1)
                login_page.click_new()
                time.sleep(1)
                login_page.click_bidProduct()
                # 选择产品
                login_page.click_yyyay()  #月月赢按月
                # login_page.click_yyydq()  #月月赢到期
                login_page.click_loanuse()
                login_page.click_loanuseli()
                login_page.set_title(d['title'])
                login_page.set_bidcode(d['title'])
                login_page.set_totalAmount("10000")
                login_page.set_termValue("12")
                login_page.set_interestRate("10")
                login_page.set_raiseRate("0")
                login_page.set_shouxufei("0")
                login_page.click_choose()
                time.sleep(2)
                login_page.set_loanuser("18888888888")
                login_page.click_search()
                login_page.click_searchok()
                time.sleep(1)
                login_page.click_type()
                # 正常标、爆款标、推荐标
                login_page.click_zcbiao()
                login_page.click_save()
                time.sleep(1)
                login_page.click_ok()
                time.sleep(1)
                login_page.click_ckzjkb()
                time.sleep(1)
                login_page.set_mingcheng(d['title'])
                login_page.click_sousuo()
                time.sleep(1)
                login_page.click_shangjia()
                time.sleep(1)
                login_page.click_shangjiaok()
                login_page.driver.close()
                con = db.Db()
                connection = con.connection
                fname = DATA_PATH + '/yueyueying.xlsx'
                bk = xlrd.open_workbook(fname)
                try:
                    sh = bk.sheet_by_name("Sheet1")
                except:
                    print
                    "no sheet in %s named Sheet1" % fname

                # 获取第一行第一列数据
                cell_value = sh.cell_value(1, 0)
                print("表格", cell_value)
                # 通过cursor创建游标
                cursor = con.cursor
                cursor.execute("SELECT * from bid_info where name=%s",
                               (d['title'], ))
                # 提交SQL
                connection.commit()
                t = cursor.fetchall()
                print(t)
                bidname = t[0]['name']
                print(bidname)
                cursor = con.cursor
                cursor.execute("SELECT id from bid_info where  name=%s",
                               (bidname, ))
                # 提交SQL
                connection.commit()
                t = cursor.fetchall()
                # a=t['tel']
                a = t[0]['id']
                content = {
                    'login':
                    '******',
                    'passwd':
                    'QW8EQ4lM09bcIHZM86COM0462PoQ+1QibJUzLsD0b7JuCUdAPrqTTvGmHSHYj3/4ME6OSTIBrjdBFmtDomdy0OcURcTEljx9LetZpEHz7uHaDje9iguklu/KfguL8QZrWQ8LgIyWe2Hxr+GfNyP0mIihASYFQGGSGtKi/Drcqn4='
                }
                headers = {
                    'User-Agent':
                    'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0',
                    'Accept': 'application/json, text/javascript, */*; q=0.01',
                    'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
                    'Accept-Encoding': 'gzip, deflate',
                    'Content-Type':
                    'application/x-www-form-urlencoded; charset=UTF-8',
                    'X-Requested-With': 'XMLHttpRequest',
                    'Referer':
                    'http://192.168.1.249:8584/hk-financial-services/index.html',
                    'Content-Length': '215',
                    'Cookie':
                    'container_flag=container_flag; JSESSIONID=4C9658B8B1E2B04BBD1A5121BDA80EB3;',
                    'submitToken':
                    '"SUBMIT_TOKEN:1f5832f3-3e02-4e8a-b264-fa5ce0eaf011";',
                    'ticket_admin':
                    'lNNabgYFTOyvXgCvOP1X9YB0B7bnzslM; submitToken_admin="SUBMIT_TOKEN:1f810b88-eb9f-4a88-ade9-50f0a5d64827"; ticket=2617gSHVCRVpSoyGybrt7DZQNEoszqPY',
                    'Connection': 'keep-alive'
                }
                r = requests.post(
                    'http://192.168.1.249:8584/hk-financial-services/indexController/fasterLogin.do',
                    data=content,
                    headers=headers)  # 发送请求

                print(r.text)  # 获取响应报文
                print(r.status_code)
                print("登录")
                c = r.cookies

                # def test_invest(self):   --投标 141  170
                content1 = {
                    'bidId': a,
                    'money': '10000',
                    'investRedPacketId': '',
                    'investRaiseInterestId': ''
                }

                r1 = requests.post(
                    'http://192.168.1.249:8584/hk-financial-services/bidInfoController/invest.do',
                    data=content1,
                    cookies=c)  # 发送请求

                # return r.json
                print(r1.text)  # 获取响应报文
                print(r1.status_code)
                print("投资")