def admin_reject_voyage_service(self, status, name, act, reject_reason_text, status_1): commen.click_ele(By.LINK_TEXT, "航空服务号") commen.click_ele(left_bussyniss_virify[0], left_bussyniss_virify[1]) commen.find_ele(virify_title[0], virify_title[1]) commen.click_ele(virifing[0], virifing[1]) #点击审核中 commen.find_ele( By.XPATH, ".//td/div/span[@title='{}']/../../../td/div/span[contains(text(),'{}')]" .format(status, name)) #判断列表中的状态 #执行操作:同意/驳回/查看详情 commen.click_ele( By.XPATH, ".//td/div/span[@title='{}']/../../../td/div/button[contains(text(),'{}')]" .format(name, act)) commen.find_ele(reject_reason[0], reject_reason[1]) commen.send_text(reject_reason_input[0], reject_reason_input[1], reject_reason_text) commen.click_ele(confirm_button[0], confirm_button[1]) #点击确定按钮 commen.click_ele(finish_virify[0], finish_virify[1]) #点击已完成审核,进入已完成审核列表 commen.find_ele( By.XPATH, ".//td/div/span[@title='{}']/../../../td/div/span[contains(text(),'{}')]" .format(status_1, name)) #判断列表中的状态
def edit_supplier_apply(self, file, file_1, file_2, tel, email): commen.click_ele(By.LINK_TEXT, "协同制造") commen.click_ele(By.XPATH, ".//span[contains(text(),'供应商认证')]") commen.init_driver().switch_to.default_content() commen.init_driver().switch_to.frame(1) commen.find_ele(By.XPATH, ".//h2[contains(text(), '供应商信息')]") commen.click_ele(By.XPATH, ".//a[contains(text(), '编辑')]") commen.find_ele(By.XPATH, ".//input[@class='upload-img__input']").send_keys( "D:\\tencent-clould\\Resource\\fig\\{}".format( file)) # 上传机构Logo commen.click_ele(By.XPATH, ".// button[contains(text(), '生成图片')]") commen.find_ele( By.XPATH, ".// span[contains(text(), '添加文件')] /../ input[@type = 'file']" ).send_keys( "D:\\tencent-clould\\Resource\\fig\\{}".format(file_1)) # 上传审核资质文件 commen.find_one_ele(By.XPATH, ".//input[@class='upload-img__input']", 1).send_keys( 'D:\\tencent-clould\\Resource\\fig\{}'.format( file_2)) # 上传介绍页展示图 commen.click_ele(By.XPATH, ".// button[contains(text(), '生成图片')]") commen.send_text(By.XPATH, ".//textarea[@class='tc-15-input-textarea']", "能力描述6666") # 输入能力描述 commen.click_ele(By.XPATH, ".//button[contains(text(),'下一步')]") commen.find_one_ele(By.XPATH, ".//input", 0).clear() commen.find_one_ele(By.XPATH, ".//input", 0).send_keys(tel) # 输入手机号 commen.find_one_ele(By.XPATH, ".//input", 1).clear() commen.find_one_ele(By.XPATH, ".//input", 1).send_keys(email) # 输入邮箱 commen.click_ele(By.XPATH, ".//button[contains(text(),'提交')]") # 点击提交 commen.find_ele(By.XPATH, ".//h4[@class='media-heading']") # 显示提交成功提示语
def login_console(): commen.init_driver().get(console_url) commen.click_ele(By.XPATH, ".//button[@class='seal-button seal-button--link'][1]") commen.send_text(By.XPATH, ".//input[@placeholder='邮箱地址']", username_busyniss) commen.send_text(By.XPATH, ".//input[@placeholder='密码']", password_busyniss) commen.click_ele(By.XPATH, ".//button[@type='submit']") time.sleep(15) commen.get_ele_text(By.XPATH, ".//ul[@class='account-content']", username_busyniss)
def add_fictitious_needs(status, item_name): commen.init_driver().switch_to.default_content() commen.init_driver().switch_to.frame(1) commen.time.sleep(3) commen.find_one_ele(By.XPATH, ".//input", 0).send_keys(item_name) # 输入项目名称 commen.find_one_ele(By.XPATH, ".//input", 1).send_keys("需求概述001") # 输入需求概述 commen.find_ele(By.XPATH, ".//button[contains(text(),'一口价')]").click() # 选择项目预算 commen.find_one_ele(By.XPATH, ".//input", 2).send_keys("99") # 输入项目预算 commen.find_ele(By.XPATH, ".//button[contains(text(),'线上交易')]").click() # 选择交易方式 commen.click_ele(By.XPATH, ".//a[contains(text(),'从通讯录获取')]") # 点击从通讯录获取 commen.find_ele(By.XPATH, ".//strong[contains(text(),'通讯录')]") commen.click_ele(By.XPATH, ".//input[@type='checkbox']") # 点击选择联系人 commen.time.sleep(1) commen.find_one_ele(By.XPATH, ".//button[contains(text(),'确定')]", 1).click() # 点击确定 commen.time.sleep(1) commen.click_ele(By.XPATH, ".//a[contains(text(),'全部')]") commen.click_ele(By.XPATH, ".//a[contains(text(),'{}')]".format(province)) # 选择省 commen.time.sleep(1) # commen.click_ele(By.XPATH, ".//a[contains(text(),'全部')]") # commen.time.sleep(1) # commen.click_ele(By.XPATH, ".//a[contains(text(),'{}')]".format(city)) # 选择市 # commen.time.sleep(1) # commen.click_ele(By.XPATH, ".//a[contains(text(),'全部')]") # commen.time.sleep(1) # commen.click_ele(By.XPATH, ".//a[contains(text(),'{}')]" .format(area)) # 选择区 commen.send_text(By.XPATH, "//div[@class='notranslate public-DraftEditor-content']", "需求详情111") commen.time.sleep(1) commen.click_ele(By.XPATH, ".//button[contains(text(),'下一步')]") # 点击下一步 commen.time.sleep(1) commen.find_one_ele(By.XPATH, ".//a[@role='menuitem']", 1) # 选择接包对象 # 默认选择其他的选项 commen.click_ele(By.XPATH, ".//button[contains(text(),'完成')]") # 点击完成 commen.time.sleep(5) commen.find_ele(By.XPATH, ".//h4[contains(text(),'需求提交成功')]") # 验证需求提交成功 commen.click_ele(By.XPATH, ".//button[contains(text(),'返回需求列表')]") # 点击返回需求列表 commen.init_driver().switch_to.default_content() commen.init_driver().switch_to.frame(1) commen.time.sleep(5) commen.find_ele(By.XPATH, ".//h2[contains(text(),'需求列表')]") commen.find_ele( By.XPATH, ".//td/div[contains(text(),'{}')]/../../td/div[@title='{}']".format( status, item_name))
def test_aviation_service(self): # 验证航空服务号跳转 commen.init_driver().find_element_by_link_text("航空服务号").click() commen.time.sleep(1) commen.find_ele(By.XPATH, ".//div[contains(text(),'机构类型')]") #验证航空服务号搜索 commen.send_text(By.XPATH, ".//input[@class='seal-input']", "上海沐冬电子科技有限公司") commen.find_ele(By.XPATH, ".//input[@class='seal-input']").send_keys( commen.Keys.ENTER) commen.time.sleep(1) commen.get_ele_text(By.XPATH, ".//span[@class='list-head-number']", "2") #验证航空服务号详情页跳转 commen.click_ele(By.XPATH, ".//li/div[@class='seal-flex']") commen.time.sleep(1) commen.get_ele_text(By.XPATH, ".//div[@class='tabs-item']", "关于我们")
def edit_voyage_service(self, file, slogan, brief, website, domain, email, province, city, address, phone, code): commen.find_ele(basic_information_manage[0], basic_information_manage[1]) #基本信息管理 commen.click_ele(basic_information[0], basic_information[1]) #点击基本信息tab commen.click_ele(edit[0], edit[1]) #点击编辑 commen.find_ele(upload_logo[0], upload_logo[1]).send_keys( "D:\\tencent-clould\\Resource\\fig\\{}".format(file)) # 上传logo commen.click_ele(create_fig[0], create_fig[1]) # 生成图片 commen.send_text(slogan_input[0], slogan_input[1], slogan) # 输入标语 commen.send_text(brief_input[0], brief_input[1], brief) # 输入简介 commen.send_text(website_input[0], website_input[1], website) # 输入官网 commen.send_text(domain_input[0], domain_input[1], domain) # 输入域名 commen.send_text(email_input[0], email_input[1], email) # 输入邮箱 commen.click_ele(address_choose_1[0], address_choose_1[1]) # 点击地址选择框 commen.click_ele(province_ele[0], province_ele[1]) # 点击省份tab commen.click_ele( By.XPATH, ".//li/div[contains(text(),'{}')]".format(province)) # 选择省 commen.click_ele(city_ele[0], city_ele[1]) # 点击城市tab commen.click_ele( By.XPATH, ".//li/div[contains(text(),'{}')]".format(city)) # 选择市 commen.send_text(address_input[0], address_input[1], address) # 输入详细地址 commen.send_text(phone_input[0], phone_input[1], phone) # 输入电话 commen.send_text(credit_code_input[0], credit_code_input[1], code) # 输入统一社会信用代码 commen.click_ele(update[0], update[1])
def open_voyage_service(self, file, slogan, brief, website, domain, email, province, city, address, phone, code): commen.find_ele(By.XPATH, ".//h2[contains(text(),'开通航空服务号')]") commen.click_ele(By.XPATH, ".// button[contains(text(), '立即开通')]") commen.find_ele(upload_logo[0], upload_logo[1]).send_keys( "D:\\tencent-clould\\Resource\\fig\\{}".format(file)) #上传logo commen.click_ele(create_fig[0], create_fig[1]) #生成图片 commen.send_text(slogan_input[0], slogan_input[1], slogan) #输入标语 commen.send_text(brief_input[0], brief_input[1], brief) #输入简介 commen.send_text(website_input[0], website_input[1], website) #输入官网 commen.send_text(domain_input[0], domain_input[1], domain) #输入域名 commen.send_text(email_input[0], email_input[1], email) #输入邮箱 commen.click_ele(address_choose_1[0], address_choose_1[1]) #点击地址选择框 commen.click_ele(province_ele[0], province_ele[1]) # 点击省份tab commen.click_ele( By.XPATH, ".//li/div[contains(text(),'{}')]".format(province)) #选择省 commen.click_ele(city_ele[0], city_ele[1]) # 点击城市tab commen.click_ele( By.XPATH, ".//li/div[contains(text(),'{}')]".format(city)) # 选择市 commen.send_text(address_input[0], address_input[1], address) #输入详细地址 commen.send_text(phone_input[0], phone_input[1], phone) # 输入电话 commen.send_text(credit_code_input[0], credit_code_input[1], code) #输入统一社会信用代码 commen.click_ele(commit_verify[0], commit_verify[1]) #点击提交审核 commen.click_act("确定提交审核么", "确定") #确认提交审核 commen.find_ele(commit_success[0], commit_success[1]) #提交审核成功后出现的提示 commen.find_ele(commit_success[0], commit_success[1]) # 提交审核成功后出现的提示