コード例 #1
0
    def type_addFriend(self):
        try:
            self.type_openFriendList()
            count1 = self.get_listCount(self.eleText_loc)
            self.find_element(*self.addFriend_loc).click()
            print("\033[1;35;0m 添加好友...\033[0m")
            data = getYaml("account.yaml")
            self.randoma = data['account']
            print("randma is :%s" % self.randoma)
            self.find_element(*self.fname_loc).send_keys(self.randoma)
            # 为好友选择分组
            tuples = (
            )  #用元组接收get_ranExcelText()返回的元组,第一个值是行数,第二个值是行数对应的文本值(分组)
            tuples = self.get_ranExcelText("friendType.xlsx")
            row = tuples[0]
            text = tuples[1]
            tels = self.find_elements(*self.cidOp_loc)
            lists = []
            for i in tels:
                lists.append(i.text)
            print("list is :%r" % lists)
            if text in lists:
                print("text in lists")
                self.find_element(*self.cid_loc).click()
                select_ele = Select(self.find_element(*self.cid_loc))
                select_ele.select_by_index(row + 1)  #选中从excel随机得到的分组

            self.find_element(*self.fsay_loc).send_keys(self.randoma)
            self.find_element(*self.submit_loc).click()
            self.append_excel("friend.xlsx", str(self.randoma))
            return count1
        except BaseException as msg:
            print(msg)
コード例 #2
0
 def test_04editProfile(self):
     self.po.type_acc_editProfile()
     sreenshot.sreenshot.insert_img(self.driver,
                                    "userMgt_04editProfile.png")
     data = getYaml('userInfo.yaml')
     text = data['reUserT']['oicq']
     self.assertEqual(text, self.po.randoma, msg="判断是否修改成功")
コード例 #3
0
 def type_perRegisterT(self):
     try:
         print("\033[1;35;0m 普通会员注册...\033[0m")
         self.u_para = ""
         self.open()
         self.find_element(*self.register_loc).click()
         sleep(1)
         handles = self.driver.window_handles
         self.driver.switch_to.window(handles[-1])
         self.find_element(*self.nextBtn_loc).click()
         #数据填充
         self.type_getAccount()
         self.type_username(self.randoma)
         #每次注册都会覆盖account.yaml中的account对应的文本值,同时确保用于添加好友时,账号是最新的
         data = getYaml('account.yaml')
         with open(
                 'F:\\Python\\phomeNetFront\\test_data\\yaml\\account.yaml',
                 'w',
                 encoding="utf-8") as file:
             data['account'] = self.randoma
             yaml.dump(data, file, Dumper=yaml.RoundTripDumper)
         self.type_setPerVip('0')
         self.type_submit()
     except BaseException as msg:
         print(msg)
コード例 #4
0
 def type_setComVip(self, type):
     try:
         print("\033[1;35;0m update企业会员信息...\033[0m")
         data = getYaml('userInfo.yaml')
         if type != 'nopsd':
             self.type_password(data['reComT']['password'])
             self.find_element(*self.repassword_loc).send_keys(
                 data['reComT']['repassword'])
         self.find_element(*self.email_loc).send_keys(
             str(self.randoma) + data['reComT']['email'])
         self.find_element(*self.company_loc).send_keys(
             data['reComT']['company'])
         self.find_element(*self.truename_loc).send_keys(
             data['reComT']['truename'])
         self.find_element(*self.mycall_loc).send_keys(
             data['reComT']['mycall'])
         self.find_element(*self.oicq_loc).send_keys(data['reComT']['oicq'])
         self.find_element(*self.msn_loc).send_keys(data['reComT']['msn'])
         self.find_element(*self.fax_loc).send_keys(data['reComT']['fax'])
         self.find_element(*self.phone_loc).send_keys(
             data['reComT']['phone'])
         self.find_element(*self.homepage_loc).send_keys(
             data['reComT']['homepage'])
         self.find_element(*self.userpicfile_loc).send_keys(
             self.userpicfile_path)
         self.find_element(*self.address_loc).send_keys(
             data['reComT']['address'])
         self.find_element(*self.zip_loc).send_keys(data['reComT']['zip'])
         self.find_element(*self.saytext_loc).send_keys(
             data['reComT']['saytext'])
     except BaseException as msg:
         print(msg)
コード例 #5
0
 def type_checkMsgList(self,username):
     try:
         print("\033[1;35;0m 正在检查发送的消息是否出现在接收方消息列表上...\033[0m")
         po1=onSiteMsgPage(self.driver)
         po1.type_sysExit()
         sleep(3)
         po1.login_action(username,"123456")
         po1.type_openVip()
         po1.type_openOnSite()
         po1.type_openMsgList()
         lists=[]
         tels=self.find_elements(*self.titleText_loc)
         print("tels is :%r"%tels)
         print("randma is :%d"%self.randoma)
         for i in tels:
             print("i.text is:%r"%i.text)
             lists.append(i.text)
         if str(self.randoma) in lists:
             print("发送成功")
             self.assertTip="发送成功"
         self.get_sreenshot().insert_img(self.driver, "memSpace_18messReply01.png")
         self.type_closeHandle()
         self.driver.refresh()
         self.type_sysExit()
         data = getYaml('userInfo.yaml')
         psd = data['loUser']['password']
         po = memSpacePage(self.driver)
         po.login_action("ghj", psd)
         self.type_openVip()
         self.type_openMemSpace()
         self.type_openMgbookMgt()
         return self.assertTip
     except BaseException as msg:
         print(msg)
コード例 #6
0
 def test_05setPsd(self):
     print("\033[1;35;0m 会员中心修改密码...\033[0m")
     self.po.randoma = self.po.type_getAccount()
     self.po.type_setPsd()
     sreenshot.sreenshot.insert_img(self.driver, "userMgt_05setPsd00.png")
     data = getYaml('userInfo.yaml')
     text = data['loUser']['password']
     self.assertEqual(text, self.po.randoma, msg="判断是否修改成功")
     sreenshot.sreenshot.insert_img(self.driver, "userMgt_05setPsd01.png")
コード例 #7
0
 def test_02login(self):
     #调用函数获取xml账号密码
     self.driver.delete_all_cookies()
     data = getYaml('userInfo.yaml')
     psd = data['loUser']['password']
     self.po.login_action("ghj", psd)
     sleep(3)
     self.assertEqual(self.po.type_getText(self.po.loginPassAss_loc),
                      "我的空间", "判断是否登录成功")
     sreenshot.sreenshot.insert_img(
         self.driver, "userMgt_02login.png")  # 调用function里面的方法
コード例 #8
0
 def test_00login(self):
     self.driver.delete_all_cookies()
     data = getYaml('userInfo.yaml')
     psd = data['loUser']['password']
     po1 = userMgtPage(self.driver)
     po1.login_action("ghj", psd)
     sleep(3)
     self.assertEqual(po1.type_getText(po1.loginPassAss_loc), "我的空间",
                      "判断是否登录成功")
     sreenshot.sreenshot.insert_img(
         self.driver, "myIndex_00login.png")  # 调用function里面的方法
コード例 #9
0
 def test_00login(self):
     self.driver.delete_all_cookies()
     data = getYaml('userInfo.yaml')
     psd = data['loUser']['password']
     po1 = userMgtPage(self.driver)
     po1.login_action("ghj", psd)
     sleep(3)
     self.assertEqual(po1.type_getText(po1.loginPassAss_loc), "我的空间",
                      "判断是否登录成功")
     sreenshot.sreenshot.insert_img(
         self.driver, "onSiteMsg_00login.png")  # 调用function里面的方法
     po1.type_openVip()
     print(self.po.get_excelList("friend.xlsx"))
     print(self.po.get_excelList("friendType.xlsx"))
     print(self.po.get_excelList("bookmarksType.xlsx"))
コード例 #10
0
 def type_setPerVip(self, type):
     try:
         print("\033[1;35;0m update普通会员信息...\033[0m")
         data = getYaml('userInfo.yaml')
         print(data)
         if type != 'nopsd':
             self.type_password(data['reUserT']['password'])
             self.find_element(*self.repassword_loc).send_keys(
                 data['reUserT']['repassword'])
             self.find_element(*self.email_loc).send_keys(
                 str(self.randoma) + data['reUserT']['email'])
         self.find_element(*self.truename_loc).clear()
         self.find_element(*self.truename_loc).send_keys(
             data['reUserT']['truename'])
         self.find_element(*self.oicq_loc).clear()
         self.randoma = self.type_getAccount()
         self.find_element(*self.oicq_loc).send_keys(self.randoma)
         self.find_element(*self.msn_loc).clear()
         self.find_element(*self.msn_loc).send_keys(data['reUserT']['msn'])
         self.find_element(*self.mycall_loc).clear()
         self.find_element(*self.mycall_loc).send_keys(
             data['reUserT']['mycall'])
         self.find_element(*self.phone_loc).clear()
         self.find_element(*self.phone_loc).send_keys(
             data['reUserT']['phone'])
         self.find_element(*self.homepage_loc).clear()
         self.find_element(*self.homepage_loc).send_keys(
             data['reUserT']['homepage'])
         self.find_element(*self.userpicfile_loc).clear()
         self.find_element(*self.userpicfile_loc).send_keys(
             self.userpicfile_path)
         self.find_element(*self.address_loc).clear()
         self.find_element(*self.address_loc).send_keys(
             data['reUserT']['address'])
         self.find_element(*self.zip_loc).clear()
         self.find_element(*self.zip_loc).send_keys(data['reUserT']['zip'])
         self.find_element(*self.saytext_loc).clear()
         self.find_element(*self.saytext_loc).send_keys(
             data['reUserT']['saytext'])
         with open(
                 'F:\\Python\\phomeNetFront\\test_data\\yaml\\userInfo.yaml',
                 'w',
                 encoding="utf-8") as file:
             data['reUserT']['oicq'] = self.randoma
             yaml.dump(data, file, Dumper=yaml.RoundTripDumper)
     except BaseException as msg:
         print(msg)
コード例 #11
0
 def type_setPsd(self):
     try:
         print("\033[1;35;0m 修改密码...\033[0m")
         self.find_element(*self.editPsd_loc).click()
         print("randNo is :%d" % self.randoma)
         data = getYaml('userInfo.yaml')
         self.find_element(*self.oldpsd_loc).send_keys(
             data['loUser']['password'])
         sleep(1)
         self.find_element(*self.password_loc).send_keys(self.randoma)
         self.find_element(*self.repassword_loc).send_keys(self.randoma)
         sleep(1)
         self.find_element(*self.submit_loc).click()
         with open(
                 'F:\\Python\\phomeNetFront\\test_data\\yaml\\userInfo.yaml',
                 'w',
                 encoding="utf-8") as file:
             data['loUser']['password'] = self.randoma
             data['loUser']['repassword'] = self.randoma
             yaml.dump(data, file, Dumper=yaml.RoundTripDumper)
     except BaseException as msg:
         print(msg)