def test_b_edit_code(self): open_homepage(self) requst = login(self) driver = self.driver driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[2]/div").click() driver.find_element_by_id("main_navigation_qrcode_static").click() driver.implicitly_wait(30) driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_table']/div/div[2]/table/tbody/tr/td[2]/div/div/button" ).click() driver.find_element_by_id("qrcode_static_btn_texttype").click() driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_textinput']/textarea").clear( ) driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_textinput']/textarea" ).send_keys(u"文本内容就是我") driver.find_element_by_id("qrcode_static_btn_webtype").click() driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_webinput']/input").clear() driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_webinput']/input").send_keys( "www.baiduyun.com") driver.find_element_by_id( "qrcode_static_qrcodelist_saveqrcode").click() msg_text = u"编辑内容成功" chk_msg(self, msg_text)
def test_a_add(self): open_homepage(self) requst = login(self) driver = self.driver status = 0 driver.find_element_by_xpath("//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_line").click() for i in range(10): try: if u"还没有产品线" == driver.find_element_by_xpath("//div[@id='product_line_list_error_view']/h2").text: status=1 break except: pass time.sleep(1) else: print(u"已经有产品线数据") if (status==1): print(u"中间按钮") driver.find_element_by_xpath("//div[@id='product_line_list_error_view']/button").click() else: print(u"点击顶部按钮") driver.find_element_by_id("product_line_add").click() time.sleep(2) driver.find_element_by_xpath("//div[@id='product_line_edit_name']/input").clear() driver.find_element_by_xpath("//div[@id='product_line_edit_name']/input").send_keys(u"哈根达斯流水线") #driver.find_element_by_xpath("//div[@id='product_line_edit_desc']/textarea").clear() #driver.find_element_by_xpath("//div[@id='product_line_edit_desc']/textarea").send_keys(u"哈根达斯流水线产业1仓") driver.find_element_by_id("product_line_edit_submit").click() msg_text=u"更新产品线成功" chk_msg(self,msg_text)
def test_c_upload_certification(self): open_homepage(self) requst = login(self) username = requst[0] phone_num = username driver = self.driver code = random.randint(100000,999999) code = str(code) driver.find_element_by_xpath("//div[@id='app']/div/nav/ul/li/div/i[2]").click() driver.find_element_by_id("main_navigation_system_enterprise").click() driver.implicitly_wait(30) driver.find_element_by_id("system_enterprise_auth_button_showauthform").click() driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_name']/input").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_name']/input").send_keys(u"牛逼的企业"+code) driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_bizlicense']/input").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_bizlicense']/input").send_keys(code) driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_bizscope']/textarea").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_bizscope']/textarea").send_keys(u"啥都可以卖"+code) driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_legalperson']/input").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_legalperson']/input").send_keys(u"张飞"+code) driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_addrinfo']/input").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_addrinfo']/input").send_keys(u"三国杀"+code) driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_licence']/input").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_auth_input_licence']/input").send_keys("F:\\auto_test_qrb\\update\\01.jpg") time.sleep(5) driver.find_element_by_id("system_enterprise_auth_button_submit").click() updata_sql= "UPDATE enterprise SET approved =0 WHERE enterprise.id IN ( SELECT ent_id FROM ent_user WHERE mobile = '"+phone_num+"')" #print(updata_sql) update_p(sql=updata_sql) msg_text=u"认证信息提交成功" chk_msg(self,msg_text)
def test_a_update(self): open_homepage(self) requst = login(self) driver = self.driver code = random.randint(1000,9999) code = str(code) driver.find_element_by_xpath("//div[@id='app']/div/nav/ul/li/div/i[2]").click() driver.find_element_by_id("main_navigation_system_enterprise").click() driver.implicitly_wait(30) driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_name']/input").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_name']/input").send_keys(u"企业名称"+code) # driver.find_element_by_css_selector("span.ivu-select-selected-value").click() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_modelprovince']/div/i[2]").click() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_modelprovince']/div[2]/ul[2]/li[13]").click() time.sleep(2) driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_modelcity']/div/i[2]").click() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_modelcity']/div[2]/ul[2]/li[2]").click() time.sleep(2) driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_enttype']/div/i[2]").click() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_enttype']/div[2]/ul[2]/li[2]").click() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_contactname']/input").clear() time.sleep(2) driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_contactname']/input").send_keys(u"关云长"+code) driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_contactphone']/input").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_contactphone']/input").send_keys("1380013"+code) driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_introduce']/textarea").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_introduce']/textarea").send_keys(u"这个企业很牛逼"+code) driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_valueweb']/input").clear() driver.find_element_by_xpath("//div[@id='system_enterprise_companyinfo_input_valueweb']/input").send_keys("http://www.baidu.com") driver.find_element_by_xpath("//button[@id='system_enterprise_companyinfo_button_createqr']").click() driver.find_element_by_xpath("//button[@id='system_enterprise_companyinfo_button_submit']").click() msg_text=u"企业信息保存成功" chk_msg(self,msg_text)
def test_chang_phone_num(self): open_homepage(self) requst = login(self) username = requst[0] phone_num = username newphone_num = '15881015817' driver = self.driver driver.implicitly_wait driver.find_element_by_css_selector( "div.ivu-menu-submenu-title").click() driver.find_element_by_id("main_navigation_system_profile").click() driver.implicitly_wait(30) driver.find_element_by_id("userprofile_phone_change").click() driver.find_element_by_id("userprofile_phone_change_sms_send").click() time.sleep(5) Random_code = selcet_chg_mobile(phone_num) Random_code = bytes.decode(Random_code) print(Random_code) driver.find_element_by_xpath( "//div[@id='userprofile_phone_change_current_sms_code']/input" ).clear() driver.find_element_by_xpath( "//div[@id='userprofile_phone_change_current_sms_code']/input" ).send_keys(Random_code) driver.find_element_by_id("userprofile_phone_change_next").click() time.sleep(2) driver.find_element_by_xpath( "//div[@id='userprofile_phone_change_new']/input").clear() driver.find_element_by_xpath( "//div[@id='userprofile_phone_change_new']/input").send_keys( newphone_num) driver.find_element_by_id( "userprofile_phone_change_new_sms_send").click() time.sleep(5) print(u"获取新号码的验证码") Random_code = selcet_chg_mobile(newphone_num) Random_code = bytes.decode(Random_code) print(Random_code) driver.find_element_by_xpath( "//div[@id='userprofile_phone_change_new_sms_code']/input").clear( ) driver.find_element_by_xpath( "//div[@id='userprofile_phone_change_new_sms_code']/input" ).send_keys(Random_code) driver.find_element_by_id("userprofile_phone_change_save").click() updat_sql = "UPDATE ent_user SET mobile = '" + phone_num + "' WHERE mobile='" + newphone_num + "'" update_p(sql=updat_sql) user_idsql = "SELECT id FROM ent_user where mobile='" + phone_num + "'" userid = get_id(sql=user_idsql) print(userid) delete_cache(userid) msg_text = u"新手机号绑定成功" chk_msg(self, msg_text)
def test_a_add(self): open_homepage(self) requst = login(self) driver = self.driver status = 0 code = random.randint(100, 9999) code = str(code) driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_management").click() for i in range(30): try: if u"还没有产品" == driver.find_element_by_xpath( "//div[@id='product_product_list_error']/h2").text: status = 1 break except: pass time.sleep(1) else: print(u"已经有产品") if (status == 1): print(u"中间按钮") driver.find_element_by_xpath( "//div[@id='product_product_list_error']/button").click() else: print(u"点击顶部按钮") driver.find_element_by_id("product_product_btn_addproduct").click() driver.find_element_by_xpath( "//div[@id='product_addproduct_input_name']/input").clear() driver.find_element_by_xpath( "//div[@id='product_addproduct_input_name']/input").send_keys( u"可爱多" + code) driver.find_element_by_xpath( "//div[@id='product_addproduct_select_line']/div/span").click() driver.find_element_by_xpath( "//div[@id='product_addproduct_select_line']/div[2]/ul[2]/li" ).click() driver.find_element_by_xpath( "//div[@id='product_addproduct_input_units']/input").clear() driver.find_element_by_xpath( "//div[@id='product_addproduct_input_units']/input").send_keys( u"东莞1厂" + code) driver.find_element_by_xpath( "//div[@id='product_addproduct_input_specification']/input").clear( ) driver.find_element_by_xpath( "//div[@id='product_addproduct_input_specification']/input" ).send_keys(u"袋装" + code) driver.find_element_by_id("product_addproduct_btn_save").click() msg_text = u"添加成功" chk_msg(self, msg_text)
def test_b_chang_pwd(self): open_homepage(self) requst = login(self) #passwordmd5='RNqbeGeD9GVLiSj3/J4b9MDF$dFXY0/jsYom8ehysg006T69Mimpm3crDnfmfB9I1Yls=' passwordmd5 = 'yEmTu+yT0VVEB6xOdZnGp3x/$5QY6GCt7PIxLEpIHqSTPSZNS/RCOQAybLg11wUPHuHw=' #passwordmd5='OkDK/+Myx6lueyGvhFrI5Iac$Y1nPHwhfgl2lmz1fveVZim0lpNfHs5VNwz6xRLfDBC4=' username = requst[0] phone_num = username passwd = requst[1] newpasswd = '123456a' driver = self.driver driver.implicitly_wait driver.find_element_by_css_selector( "div.ivu-menu-submenu-title").click() driver.find_element_by_id("main_navigation_system_profile").click() driver.implicitly_wait(30) driver.find_element_by_id("userprofile_password_change").click() driver.find_element_by_xpath("//input[@type='password']").clear() driver.find_element_by_xpath("//input[@type='password']").send_keys( passwd) driver.find_element_by_xpath( "//div[@id='userprofile_password_change_new']/input").clear() driver.find_element_by_xpath( "//div[@id='userprofile_password_change_new']/input").send_keys( newpasswd) driver.find_element_by_xpath( "//div[@id='userprofile_password_change_new_confirm']/input" ).clear() driver.find_element_by_xpath( "//div[@id='userprofile_password_change_new_confirm']/input" ).send_keys(newpasswd) driver.find_element_by_id( "userprofile_password_change_sms_send").click() time.sleep(5) Random_code = selcet_chg_pwd(phone_num) Random_code = bytes.decode(Random_code) print(Random_code) driver.find_element_by_xpath( "//div[@id='userprofile_password_change_sms_code']/input").clear() driver.find_element_by_xpath( "//div[@id='userprofile_password_change_sms_code']/input" ).send_keys(Random_code) driver.find_element_by_id("userprofile_password_change_save").click() updat_sql = "UPDATE ent_user SET password = '******' WHERE mobile='" + phone_num + "'" update_p(sql=updat_sql) msg_text = u"更新账户密码成功" chk_msg(self, msg_text) user_idsql = "SELECT id FROM ent_user where mobile='" + phone_num + "'" userid = get_id(sql=user_idsql) print(userid) delete_cache(userid)
def test_d_delete(self): open_homepage(self) requst = login(self) driver = self.driver driver.find_element_by_xpath("//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_line").click() driver.implicitly_wait(30) driver.find_element_by_xpath("//div[@id='product_line_container']/div/div[2]/div[3]/div/div/div[2]/table/tbody/tr/td[4]/div/div/button[3]").click() #driver.find_element_by_xpath("(//button[@type='button'])[11]").click() driver.find_element_by_xpath("(//button[@type='button'])[13]").click() msg_text=u"产品线删除成功" chk_msg(self,msg_text) self.test_a_add()
def test_d_delete(self): open_homepage(self) requst = login(self) driver = self.driver code = random.randint(100,9999) code = str(code) driver.find_element_by_xpath("//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_batch").click() time.sleep(20) driver.find_element_by_xpath("(//button[@type='button'])[7]").click() driver.find_element_by_xpath("(//button[@type='button'])[15]").click() msg_text=u"批次删除成功" chk_msg(self,msg_text) self.test_a_add()
def test_d_delete_code(self): open_homepage(self) requst = login(self) driver = self.driver driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[2]/div").click() driver.find_element_by_id("main_navigation_qrcode_static").click() driver.implicitly_wait(30) driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_table']/div/div[2]/table/tbody/tr/td[2]/div/div/button[3]" ).click() driver.find_element_by_xpath("(//button[@type='button'])[14]").click() msg_text = u"删除静态码成功" chk_msg(self, msg_text)
def test_a_add_code(self): open_homepage(self) requst = login(self) status = 3 driver = self.driver driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[2]/div").click() driver.find_element_by_id("main_navigation_qrcode_static").click() for i in range(30): try: if u"还没有静态码" == driver.find_element_by_xpath( "//div[@id='system_employeesetting_list_error']/h2" ).text: status = 1 print(status) break except: pass time.sleep(1) else: print(u"找到内容") if (status == 1): print(u"中间按钮") driver.find_element_by_xpath( "//div[@id='system_employeesetting_list_error']/button").click( ) else: print(u"点击顶部按钮") driver.find_element_by_id( "qrcode_static_qrcodelist_creatQRcode").click() driver.find_element_by_xpath( "//button[@id='qrcode_static_btn_texttype']").click() driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_textinput']/textarea").clear( ) driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_textinput']/textarea" ).send_keys(u"静态码") driver.find_element_by_xpath( "//button[@id='qrcode_static_btn_webtype']").click() driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_webinput']/input").clear() driver.find_element_by_xpath( "//div[@id='qrcode_static_qrcodelist_webinput']/input").send_keys( "www.baidu.com") driver.find_element_by_id( "qrcode_static_qrcodelist_saveqrcode").click() msg_text = u"新增内容成功" chk_msg(self, msg_text)
def test_b_edit(self): open_homepage(self) requst = login(self) driver = self.driver driver.find_element_by_xpath("//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_line").click() time.sleep(20) driver.find_element_by_xpath("(//button[@type='button'])[7]").click() driver.find_element_by_xpath("//div[@id='product_line_edit_name']/input").clear() driver.find_element_by_xpath("//div[@id='product_line_edit_name']/input").send_keys("8735") # driver.find_element_by_xpath("//div[@id='product_line_edit_desc']/textarea").clear() # driver.find_element_by_xpath("//div[@id='product_line_edit_desc']/textarea").send_keys(u"阿嘎松") driver.find_element_by_xpath("//button[@id='product_line_edit_submit']").click() msg_text=u"更新产品线成功" chk_msg(self,msg_text)
def test_d_delete(self): open_homepage(self) requst = login(self) driver = self.driver code = random.randint(100, 9999) code = str(code) driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_management").click() driver.implicitly_wait(30) driver.find_element_by_xpath("(//button[@type='button'])[9]").click() driver.find_element_by_xpath("(//button[@type='button'])[12]").click() msg_text = u"删除产品成功" chk_msg(self, msg_text) self.test_a_add()
def test_a_set(self): open_homepage(self) requst = login(self) driver = self.driver driver.find_element_by_css_selector( "div.ivu-menu-submenu-title").click() driver.find_element_by_id("main_navigation_system_payment").click() driver.implicitly_wait(30) driver.find_element_by_css_selector( "button.ivu-btn.payment-list-edit-btn").click() driver.find_element_by_xpath( "//div[@id='system_payment_setting_ctId']/input").clear() driver.find_element_by_xpath( "//div[@id='system_payment_setting_ctId']/input").send_keys( "1234567890") driver.find_element_by_xpath( "//div[@id='system_payment_setting_ctSecret']/input").clear() driver.find_element_by_xpath( "//div[@id='system_payment_setting_ctSecret']/input").send_keys( "WIXJLGAXMGAOSFDASJDFASDFARGSDG") driver.find_element_by_xpath( "//div[@id='system_payment_setting_AppId']/input").clear() driver.find_element_by_xpath( "//div[@id='system_payment_setting_AppId']/input").send_keys( "99888") driver.find_element_by_xpath( "//div[@id='system_payment_setting_AppSecret']/input").clear() driver.find_element_by_xpath( "//div[@id='system_payment_setting_AppSecret']/input").send_keys( "99998888") driver.find_element_by_xpath( "//div[@id='system_paymentsetting_wechat_cert_upload']/input" ).clear() driver.find_element_by_xpath( "//div[@id='system_paymentsetting_wechat_cert_upload']/input" ).send_keys("F:\\auto_test_qrb\\update\\sq.txt") driver.find_element_by_xpath( "//div[@id='system_paymentsetting_wechat_oauth_upload']/input" ).clear() driver.find_element_by_xpath( "//div[@id='system_paymentsetting_wechat_oauth_upload']/input" ).send_keys("F:\\auto_test_qrb\\update\\sqzs.txt") driver.find_element_by_xpath( "//button[@id='system_payment_setting_submit']").click() msg_text = u"支付网关更新成功" chk_msg(self, msg_text)
def test_b_on_off(self): open_homepage(self) requst = login(self) driver = self.driver driver.find_element_by_css_selector( "div.ivu-menu-submenu-title").click() driver.find_element_by_id("main_navigation_system_payment").click() driver.implicitly_wait(30) driver.find_element_by_xpath( "//div[@id='system_payment_setting_list']/div/div[2]/table/tbody/tr/td/div/div/span" ).click() msg_text = u"支付网关状态已设置为开启" chk_msg(self, msg_text) time.sleep(3) driver.find_element_by_xpath( "//div[@id='system_payment_setting_list']/div/div[2]/table/tbody/tr/td/div/div/span" ).click() msg_text = u"支付网关状态已设置为关闭" chk_msg(self, msg_text)
def test_b_edit(self): open_homepage(self) requst = login(self) driver = self.driver code = random.randint(100,9999) code = str(code) driver.find_element_by_xpath("//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_batch").click() time.sleep(20) driver.find_element_by_xpath("(//button[@type='button'])[6]").click() driver.find_element_by_xpath("//div[@id='product_batch_edit_line_list']/div/i[2]").click() driver.find_element_by_xpath("//div[@id='product_batch_edit_line_list']/div[2]/ul[2]/li").click() time.sleep(2) driver.find_element_by_xpath("//div[@id='product_batch_edit_product_list']/div/i[2]").click() driver.find_element_by_xpath("//div[@id='product_batch_edit_product_list']/div[2]/ul[2]/li").click() driver.find_element_by_xpath("//div[@id='product_batch_edit_no']/input").clear() driver.find_element_by_xpath("//div[@id='product_batch_edit_no']/input").send_keys("201700001"+code) driver.find_element_by_id("product_batch_edit_submit").click() msg_text=u"更新批次成功" chk_msg(self,msg_text)
def test_c_edit(self): open_homepage(self) requst = login(self) driver = self.driver status = 0 code = random.randint(100, 9999) code = str(code) driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[4]/div").click() driver.find_element_by_id("main_navigation_member_levels").click() time.sleep(5) driver.find_element_by_xpath("(//button[@type='button'])[4]").click() driver.find_element_by_xpath("(//button[@type='button'])[11]").click() msg_text = u"会员等级重算成功" chk_msg(self, msg_text) driver.find_element_by_xpath("(//button[@type='button'])[7]").click() time.sleep(2) driver.find_element_by_xpath("(//button[@type='button'])[7]").click() msg_text = u"操作成功" chk_msg(self, msg_text)
def test_a_update_username_sex(self): open_homepage(self) driver = self.driver login(self) driver.find_element_by_css_selector( "div.ivu-menu-submenu-title").click() driver.find_element_by_id("main_navigation_system_profile").click() driver.implicitly_wait(30) driver.find_element_by_xpath( "//div[@id='userprofile_info_name']/input").clear() driver.find_element_by_xpath( "//div[@id='userprofile_info_name']/input").send_keys(u"这就是我的真实姓名") time.sleep(2) driver.find_element_by_xpath( "//div[@id='userprofile_sex']/div/i[2]").click() time.sleep(2) driver.find_element_by_id("userprofile_sex_man").click() time.sleep(1) driver.find_element_by_id("userprofile_info_save").click() msg_text = u"更新个人资料成功" chk_msg(self, msg_text)
def test_b_edit(self): open_homepage(self) requst = login(self) driver = self.driver code = random.randint(100, 9999) code = str(code) driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_management").click() driver.implicitly_wait(30) driver.find_element_by_xpath("(//button[@type='button'])[7]").click() driver.find_element_by_xpath( "//div[@id='product_addproduct_input_name']/input").clear() driver.find_element_by_xpath( "//div[@id='product_addproduct_input_name']/input").send_keys( u"可爱多" + code) driver.find_element_by_xpath( "//div[@id='product_addproduct_select_line']/div/i[2]").click() driver.find_element_by_xpath( "//div[@id='product_addproduct_select_line']/div[2]/ul[2]/li" ).click() driver.find_element_by_xpath( "//div[@id='product_addproduct_input_units']/input").clear() driver.find_element_by_xpath( "//div[@id='product_addproduct_input_units']/input").send_keys( u"东莞1厂" + code) driver.find_element_by_xpath( "//div[@id='product_addproduct_input_specification']/input").clear( ) driver.find_element_by_xpath( "//div[@id='product_addproduct_input_specification']/input" ).send_keys(u"袋装" + code) driver.find_element_by_id("product_addproduct_btn_save").click() msg_text = u"编辑成功" chk_msg(self, msg_text) driver.find_element_by_xpath("//input[@type='file']").clear() driver.find_element_by_xpath("//input[@type='file']").send_keys( "F:\\auto_test_qrb\\update\\00.jpg")
def test_a_add(self): open_homepage(self) requst = login(self) driver = self.driver status = 0 code = random.randint(100,9999) code = str(code) driver.find_element_by_xpath("//div[@id='app']/div/nav/ul/li[3]/div").click() driver.find_element_by_id("main_navigation_product_batch").click() for i in range(10): try: if u"还没有批次" == driver.find_element_by_xpath("//div[@id='product_batch_list_error_view']/h2").text: status=1 break except: pass time.sleep(1) else: print(u"已经有批次") if (status==1): print(u"中间按钮") driver.find_element_by_xpath("//div[@id='product_batch_list_error_view']/button").click() else: print(u"点击顶部按钮") driver.find_element_by_id("product_batch_add").click() time.sleep(5) driver.find_element_by_xpath("//div[@id='product_batch_edit_line_list']/div/i[2]").click() driver.find_element_by_xpath("//div[@id='product_batch_edit_line_list']/div[2]/ul[2]/li").click() driver.find_element_by_xpath("//div[@id='product_batch_edit_product_list']/div/span").click() driver.find_element_by_xpath("//div[@id='product_batch_edit_product_list']/div[2]/ul[2]/li").click() driver.find_element_by_xpath("//div[@id='product_batch_edit_no']/input").clear() driver.find_element_by_xpath("//div[@id='product_batch_edit_no']/input").send_keys("201700001"+code) driver.find_element_by_id("product_batch_edit_submit").click() msg_text=u"更新批次成功" chk_msg(self,msg_text)
def test_a_add(self): open_homepage(self) requst = login(self) driver = self.driver status = 0 code = random.randint(100, 9999) code = str(code) driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[4]/div").click() driver.find_element_by_id("main_navigation_member_levels").click() time.sleep(2) for i in range(10): try: if u"还没有等级" == driver.find_element_by_xpath( "//div[@id='product_product_list_error']/h2").text: status = 1 print(status) break except: pass time.sleep(1) else: print(u"已经有等级") print(status) if (status == 1): print(u"中间按钮") driver.find_element_by_xpath( "//div[@id='product_product_list_error']/button").click() else: print(u"点击顶部按钮") driver.find_element_by_id("member_levels_btn_add").click() time.sleep(5) driver.find_element_by_css_selector("input.ivu-input").clear() driver.find_element_by_css_selector("input.ivu-input").send_keys( u"铜牌会员" + code) driver.find_element_by_xpath( "//div[@id='member_levels_radio_default']/label/span/input").click( ) driver.find_element_by_xpath( "//div[@id='member_levels_radio_default']/label[2]/span/input" ).click() driver.find_element_by_xpath( "//div[@id='app']/div/div[2]/div/div/div[2]/div/div[2]/form/div[3]/div/div/div/div/div/span[2]" ).click() driver.find_element_by_xpath( "//div[@id='app']/div/div[2]/div/div/div[2]/div/div[2]/form/div[3]/div/div/div/div/div[2]/ul[2]/li[2]" ).click() driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemin']/div[2]/input").clear( ) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemin']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemin']/div[2]/input" ).send_keys(Keys.BACKSPACE, 1) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemax']/div[2]/input").clear( ) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemax']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemax']/div[2]/input" ).send_keys(Keys.BACKSPACE, 999) time.sleep(2) driver.find_element_by_xpath( "//div[@id='app']/div/div[2]/div/div/div[2]/div/div[2]/form/div[3]/div[2]/div/div/div/div/i[2]" ).click() driver.find_element_by_xpath( "//div[@id='app']/div/div[2]/div/div/div[2]/div/div[2]/form/div[3]/div[2]/div/div/div/div[2]/ul[2]/li[2]" ).click() driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmin']/div[2]/input").clear( ) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmin']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmin']/div[2]/input" ).send_keys(Keys.BACKSPACE, 99) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmax']/div[2]/input").clear( ) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmax']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmax']/div[2]/input" ).send_keys(Keys.BACKSPACE, 999) time.sleep(2) driver.find_element_by_xpath( "//div[@id='member_levels_input_priority']/div[2]/input").clear() driver.find_element_by_xpath( "//div[@id='member_levels_input_priority']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_input_priority']/div[2]/input" ).send_keys(Keys.BACKSPACE, 20) driver.find_element_by_tag_name("html").send_keys(Keys.PAGE_DOWN) driver.find_element_by_id("member_levels_btn_savelevel").click() msg_text = u"添加成功" chk_msg(self, msg_text)
def test_b_edit(self): open_homepage(self) requst = login(self) driver = self.driver status = 0 code = random.randint(100, 9999) code = str(code) driver.find_element_by_xpath( "//div[@id='app']/div/nav/ul/li[4]/div").click() driver.find_element_by_id("main_navigation_member_levels").click() #driver.find_element_by_xpath("(//button[@type='button'])[6]").click() time.sleep(10) driver.find_element_by_xpath("(//button[@type='button'])[6]").click() driver.find_element_by_css_selector("input.ivu-input").clear() driver.find_element_by_css_selector("input.ivu-input").send_keys( u"铜牌会员" + code) driver.find_element_by_xpath( "//div[@id='member_levels_radio_default']/label/span/input").click( ) driver.find_element_by_xpath( "//div[@id='member_levels_radio_default']/label[2]/span/input" ).click() driver.find_element_by_xpath( "//div[@id='app']/div/div[2]/div/div/div[2]/div/div[2]/form/div[3]/div/div/div/div/div/span[2]" ).click() driver.find_element_by_xpath( "//div[@id='app']/div/div[2]/div/div/div[2]/div/div[2]/form/div[3]/div/div/div/div/div[2]/ul[2]/li[2]" ).click() driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemin']/div[2]/input").clear( ) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemin']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemin']/div[2]/input" ).send_keys(Keys.BACKSPACE, 22) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemax']/div[2]/input").clear( ) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemax']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_numinput_timemax']/div[2]/input" ).send_keys(Keys.BACKSPACE, 222) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmin']/div[2]/input").clear( ) time.sleep(2) driver.find_element_by_xpath( "//div[@id='app']/div/div[2]/div/div/div[2]/div/div[2]/form/div[3]/div[2]/div/div/div/div/i[2]" ).click() driver.find_element_by_xpath( "//div[@id='app']/div/div[2]/div/div/div[2]/div/div[2]/form/div[3]/div[2]/div/div/div/div[2]/ul[2]/li[2]" ).click() driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmin']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmin']/div[2]/input" ).send_keys(Keys.BACKSPACE, 11) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmax']/div[2]/input").clear( ) driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmax']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_numinput_mountmax']/div[2]/input" ).send_keys(Keys.BACKSPACE, 111) driver.find_element_by_xpath( "//div[@id='member_levels_input_priority']/div[2]/input").clear() driver.find_element_by_xpath( "//div[@id='member_levels_input_priority']/div[2]/input" ).send_keys(Keys.CONTROL, 'a') driver.find_element_by_xpath( "//div[@id='member_levels_input_priority']/div[2]/input" ).send_keys(Keys.BACKSPACE, 20) driver.find_element_by_tag_name("html").send_keys(Keys.PAGE_DOWN) driver.find_element_by_id("member_levels_btn_savelevel").click() msg_text = u"保存成功" chk_msg(self, msg_text)