def test_dzgl(self): """发票地址管理""" # logging.basicConfig(filename='../LOG/' + __name__ + '.log', # format='[%(asctime)s-%(filename)s-%(levelname)s: %(message)s]', level=logging.DEBUG, # filemode='a', datefmt='%Y-%m-%d%I:%M:%S %p') dl = dengLuPage(self.driver) dl.dengLu() time.sleep(1) self.driver.find_element_by_css_selector("#page-header > div.item-right > ul > li:nth-child(1) > a").click() time.sleep(1) """添加邮寄地址""" self.driver.find_element_by_link_text("邮寄地址管理").click() self.assertIn("权大师_邮寄地址管理", self.driver.title) print(self.driver.title) time.sleep(1) #self.driver.find_element_by_css_selector("#personalCenter2-leftNav > ul > li:nth-child(3) > ul > li.selected > a").click() self.driver.find_element_by_css_selector("#addAddress").click() ss=Unicode() self.driver.find_element_by_css_selector("#add_Address > table > tbody > tr:nth-child(1) > td:nth-child(2) > input").send_keys("{}".format(ss)) print("收件人名称:{}".format(ss)) self.driver.find_element_by_css_selector("#add_Address > table > tbody > tr:nth-child(2) > td:nth-child(2) > input").send_keys("15624992422") self.driver.find_element_by_css_selector("#address_info").click() self.driver.find_element_by_css_selector("#administrative > div > div.d-dropdown > div.tab-content.active.tab-province > dl.item.item-a-g.clearfix > dd > span:nth-child(1)").click() self.driver.find_element_by_css_selector("#administrative > div > div.d-dropdown > div.tab-content.tab-city.active > dl.item.item-a-g.clearfix > dd > span:nth-child(1)").click() qq=Unicode() self.driver.find_element_by_css_selector("#add_Address > table > tbody > tr:nth-child(4) > td:nth-child(2) > textarea").send_keys("{}".format(qq)) print("收件人地址:北京市昌平区{}街道".format(qq)) self.driver.find_element_by_css_selector("#add_Address > table > tbody > tr:nth-child(3) > td.td-title").click() self.driver.find_element_by_css_selector("#submit-editAddress").click() print("添加邮寄地址成功!") get_screenshort(self.driver,"dzgltest.png") print("测试通过!")
def test_sbss(self): """商标搜索""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2) # ActionChains(self.driver).move_to_element(self.driver.find_element_by_css_selector( # "#com-navbar > div > div.drop-nav > div > ul > li:nth-child(1) > h3 > a")).perform() # ActionChains(self.driver).release() # self.driver.find_element_by_css_selector("#com-navbar > div > div.drop-nav > div > ul > li:nth-child(1) > div > dl:nth-child(1) > dd > a:nth-child(1)").click() # time.sleep(2) # # # 获取打开的多个窗口句柄 # windows = self.driver.window_handles # # 切换到当前最新打开的窗口 # self.driver.switch_to.window(windows[-1]) # self.assertIn("注册商标查询_中国商标查询_权大师官网",self.driver.title) # print(self.driver.title) # # self.driver.add_cookie({'name': 'QDS_COOKIE', # 'value': 'ab63c857c28ff94e241a578ecd1994ac520eece6', # 一周有效期 2018-7-9_10-46 # 'Domain': '.quandashi.com'}) # # self.driver.refresh() #self.driver.find_element_by_css_selector("#qds-searchkey").send_keys("测试") self.driver.find_element_by_css_selector("#serch-word").click() # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) self.assertIn("注册商标查询_中国商标查询_权大师官网", self.driver.title) print(self.driver.title) dl.refresh() ss=Unicode() print("搜索商标名称:"+ss) self.driver.find_element_by_css_selector("body > div.brandSearch2-page > div > div.search > div.searchPanel.clearfix > input.input.search-text").send_keys("{}".format(ss)) self.driver.find_element_by_css_selector("#btnSearchkey").click() time.sleep(4) print(self.driver.title) get_screenshort(self.driver, "test_sbss.png") print("商标搜索测试通过")
# ele_captcha.click() # # # if __name__ == "__main__": # h = HuXiu() # h.visit_index() # import re # string = "127米" # #print (re.findall(r"\d+\.?\d*", string)) # # aa=re.findall(r"\d+\.?\d*", string) # print(aa) # totalCount = '已为您检索到19条近似商标' # # totalCount = re.sub("\D","",totalCount) # # print(totalCount) from config.globalparam import report_path, img_path from utils.random import Unicode print("包针雨我爱你!") s = Unicode() a = len(s) print(a) print(s) print(report_path) print(img_path) print(os.path.dirname(__file__)) print(os.path.abspath(__file__))
def test_hwgs_2(self): """海外高速_自然人测试""" # logging.basicConfig(filename='../LOG/' + __name__ + '.log', # format='[%(asctime)s-%(filename)s-%(levelname)s: %(message)s]', level=logging.DEBUG, # filemode='a', datefmt='%Y-%m-%d%I:%M:%S %p') dl = dengLuPage(self.driver) # 官方推荐有find_element(By.*(""))代替find_element_by_*("") # self.driver.find_element_by_id() # self.driver.find_element() dl.dengLu() time.sleep(2) self.driver.find_element_by_css_selector("body > div.section-banner > div.public-navbar > div > ul > li:nth-child(1) > a").click() time.sleep(1) self.assertIn("商标注册-权大师",self.driver.title) print(self.driver.title) self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-serviceItems > table > tbody > tr > td.td-cont > ul > li:nth-child(4)").click() for a in self.driver.find_elements_by_css_selector("#total-price"): print("费用总计:"+a.text) aa=a.text self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-btnBuy > a.btn.btn-next.buynow").click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-name > td.td-content > input").send_keys( "test") self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-tuyang.show-create.show-create1 > td.td-content > div.zidongdong-create > ul > li > div.bottom.getBrandPic > a").click() self.driver.find_element_by_css_selector("#create-tuyang > label.label.checked").click() time.sleep(5) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-way > div > a.btn-choice.active").click() suiji=random.randint(2,46) self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li:nth-child({}) > span".format(suiji)).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > span").click() time.sleep(1) self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(1) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(2) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(3) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(4) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(5) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(6) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(7) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(8) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(9) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(10) > span").click() print("选择了第{}类商标分类!".format(suiji)) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div.last-pay > ul > li.row-step > a").click() time.sleep(1) # 企业 自然人 self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > table > thead > tr:nth-child(1) > td.td-content > a:nth-child(2)").click() self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(1) > td.td-content.contact-select-container > dl > dt > input").send_keys("{}".format(Unicode())) self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(2) > td.td-content > input").send_keys("dalao") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(4) > td.td-content > input").send_keys("140121199506133513") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(5) > td.td-content.fcountry-container > input.myInput").click() self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(5) > td.td-content.fcountry-container > div > div.country-list.country-list-ag.active > span:nth-child(1)").click() self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(5) > td.td-title").click() time.sleep(2) self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(6) > td.td-content > input").send_keys("外国人") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(7) > td.td-content > input").send_keys("waiguoren") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(8) > td.td-content > input").send_keys("laotie") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(9) > td.td-content > input").send_keys("17801188215") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(10) > td.td-content > input").send_keys("*****@*****.**") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base.open > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-gsh > tr:nth-child(11) > td.td-content > input").send_keys("03515925212") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-btns.clearfix > a:nth-child(2)").click() time.sleep(2) """订单备注""" self.driver.find_element_by_css_selector( "html body div.smartRegister-page div.orderinfo-wrap div.order-content textarea").send_keys( time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") get_screenshort(self.driver, "test_hwgs_2.png") for i in self.driver.find_elements_by_css_selector("body > div.smartRegister-page > div.orderinfo-wrap > div.last-pay.personal-last-pay > ul > li.row-sense > em > i"): print("总价:"+i.text) ii=i.text self.assertIn(aa,ii) print("价格一致") self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.orderinfo-wrap > div.last-pay.personal-last-pay > div > a").click() for o in self.driver.find_elements_by_class_name("payable"): print("订单提交成功,应付金额:"+o.text) oo=o.text self.assertIn(oo,ii) print("测试通过") self.driver.find_element_by_css_selector("#alisubmit").click()
self.driver.find_element_by_css_selector("body > div.section-banner > div.public-navbar > div > ul > li:nth-child(1) > a").click() time.sleep(1) self.assertIn("商标注册-权大师",self.driver.title) >>>>>>> parent of 96013fa... 8.24 print(self.driver.title) self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-serviceItems > table > tbody > tr > td.td-cont > ul > li:nth-child(4)").click() for a in self.driver.find_elements_by_css_selector("#total-price"): print("费用总计:"+a.text) aa=a.text self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-btnBuy > a.btn.btn-next.buynow").click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-name > td.td-content > input").send_keys( "{}".format(Unicode())) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-tuyang.show-create.show-create1 > td.td-content > div.zidongdong-create > ul > li > div.bottom.getBrandPic > a").click() self.driver.find_element_by_css_selector("#create-tuyang > label.label.checked").click() time.sleep(5) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-way > div > a.btn-choice.active").click() suiji=random.randint(2,46) self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li:nth-child({}) > span".format(suiji)).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(1) > span").click() self.driver.find_element_by_css_selector(
def test_number2(self): """智能注册_推荐商标跳转测试""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2) self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-navbar > div > ul > li:nth-child(1) > a" ).click() time.sleep(1) self.assertIn("商标注册-权大师", self.driver.title) print(self.driver.title) self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-serviceItems > table > tbody > tr > td.td-cont > ul > li:nth-child(3)" ).click() for a in self.driver.find_elements_by_css_selector("#total-price"): print("费用总计:" + a.text) # aa=a.text self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-btnBuy > a.btn.btn-next.buynow" ).click() sbmc = Unicode() self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-name > td.td-content > input" ).send_keys("{}".format(sbmc)) print("商标名称:{}".format(sbmc)) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-tuyang.show-create.show-create1 > td.td-content > div.zidongdong-create > ul > li > div.bottom.getBrandPic > a" ).click() self.driver.find_element_by_css_selector( "#create-tuyang > label.label.checked").click() time.sleep(5) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-way > div > a:nth-child(1)" ).click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-industry1 > div > select.myInput.znfirst" ).click() fl = random.randint(2, 12) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-industry1 > div > select.myInput.znfirst > option:nth-child({})" .format(fl)).click() fenlei1 = self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-industry1 > div > select.myInput.znfirst > option:nth-child({})" .format(fl)).text self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-industry1 > div > select.myInput.znsecond" ).click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-industry1 > div > select.myInput.znsecond > option:nth-child(2)" ).click() fenlei2 = self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-industry1 > div > select.myInput.znsecond > option:nth-child(2)" ).text print("选择所在领域:" + fenlei1 + "_" + fenlei2) zf = self.driver.find_element_by_css_selector( "#section-recommend > div.section-bodyer > div:nth-child(1) > h4 > div.header-left > a:nth-child(2) > span" ).text print(zf) number1 = re.sub("\D", "", zf) print(number1) self.driver.find_element_by_css_selector( "#section-recommend > div.section-bodyer > div:nth-child(1) > h4 > div.header-left > a:nth-child(2) > span" ).click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) dl.refresh() time.sleep(3) self.driver.find_element_by_css_selector( "body > div.page > div.search-help > div.tips.tips1 > a").click() self.driver.find_element_by_css_selector( "body > div.page > div.search-help > div.tips.tips2 > a").click() self.driver.find_element_by_css_selector( "body > div.page > div.search-help > div.tips.tips3 > a").click() self.driver.find_element_by_css_selector( "body > div.page > div.search-help > div.tips.tips4 > a").click() number2 = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > div.search-top > i" ).text print("权大师为您找到相关结果{}个".format(number2)) self.assertIn(number2, number1) print("检索相似商标数量一致,测试通过!")
def test_number1(self): """智能注册_自助商标跳转测试""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2) self.driver.find_element_by_css_selector("body > div.section-banner > div.public-navbar > div > ul > li:nth-child(1) > a").click() time.sleep(1) self.assertIn("保姆快速注册-权大师", self.driver.title) print("智能商标注册-权大师") self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-serviceItems > table > tbody > tr > td.td-cont > ul > li:nth-child(3)").click() for a in self.driver.find_elements_by_css_selector("#total-price"): print("费用总计:"+a.text) #aa=a.text self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-btnBuy > a.btn.btn-next.buynow").click() sbmc=Unicode() self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-name > td.td-content > input").send_keys( "{}".format(sbmc)) print("商标名称:{}".format(sbmc)) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-tuyang.show-create.show-create1 > td.td-content > div.zidongdong-create > ul > li > div.bottom.getBrandPic > a").click() self.driver.find_element_by_css_selector("#create-tuyang > label.label.checked").click() time.sleep(5) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-way > div > a.btn-choice.active").click() suiji = random.randint(2, 46) self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li:nth-child({}) > span".format(suiji)).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(1) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(2) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(3) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(4) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(5) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(6) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(7) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(8) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(9) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(10) > span").click() print("选择了第{}类商标分类!".format(suiji)) zf=self.driver.find_element_by_css_selector("#section-selfchoice > div.group-right > div > div > h4 > div.header-left > a:nth-child(2) > span").text print(zf) number1 = re.sub("\D", "", zf) print(number1) time.sleep(1) self.driver.find_element_by_css_selector("#section-selfchoice > div.group-right > div > div > h4 > div.header-left > a:nth-child(2) > span").click() time.sleep(2) windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) dl.refresh() time.sleep(1) # self.driver.find_element_by_css_selector("body > div.page > div.search-help > div.tips.tips1 > a").click() # time.sleep(1) # self.driver.find_element_by_css_selector("body > div.page > div.search-help > div.tips.tips2 > a").click() # time.sleep(1) # self.driver.find_element_by_css_selector("body > div.page > div.search-help > div.tips.tips3 > a").click() # time.sleep(1) # self.driver.find_element_by_css_selector("body > div.page > div.search-help > div.tips.tips4 > a").click() # time.sleep(1) number2=self.driver.find_element_by_css_selector("#searchList > div.page-content.w-center > div.page-content-left > div.search-top > i").text print("权大师为您找到相关结果{}个".format(number2)) self.assertIn(number2,number1) print("检索相似商标数量一致,测试通过!")
def test_znzz_2(self): """智能注册_个体测试""" # logging.basicConfig(filename='../LOG/' + __name__ + '.log', # format='[%(asctime)s-%(filename)s-%(levelname)s:%(message)s]', level=logging.DEBUG, # filemode='a', datefmt='%Y-%m-%d%I:%M:%S %p') dl = dengLuPage(self.driver) # 官方推荐有find_element(By.*(""))代替find_element_by_*("") # self.driver.find_element_by_id() # self.driver.find_element() dl.dengLu() time.sleep(2) self.driver.find_element_by_css_selector("body > div.section-banner > div.public-navbar > div > ul > li:nth-child(1) > a").click() time.sleep(1) self.assertIn("商标注册-权大师", self.driver.title) print(self.driver.title) self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-serviceItems > table > tbody > tr > td.td-cont > ul > li:nth-child(3)").click() for a in self.driver.find_elements_by_css_selector("#total-price"): print("费用总计:"+a.text) #aa=a.text self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-btnBuy > a.btn.btn-next.buynow").click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-name > td.td-content > input").send_keys( "{}".format(Unicode())) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-tuyang.show-create.show-create1 > td.td-content > div.zidongdong-create > ul > li > div.bottom.getBrandPic > a").click() self.driver.find_element_by_css_selector("#create-tuyang > label.label.checked").click() time.sleep(5) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-way > div > a.btn-choice.active").click() suiji = random.randint(2, 46) self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li:nth-child({}) > span".format(suiji)).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(1) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(2) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(3) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(4) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(5) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(6) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(7) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(8) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(9) > span").click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(10) > span").click() print("选择了第2类商标分类!") self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div.last-pay > ul > li.row-step > a").click() time.sleep(1) #self.driver.execute_script("document.getElementByName('fname').length = 0;") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base > table > thead > tr > td.td-content > a:nth-child(2)").click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base.open > div.applicant-form > table.table-1.table-applicant.table-type1.active > tbody.tbody-gsh > tr:nth-child(1) > td.td-content.contact-select-container > dl > dt > input").clear() self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base.open > div.applicant-form > table.table-1.table-applicant.table-type1.active > tbody.tbody-gsh > tr:nth-child(1) > td.td-content.contact-select-container > dl > dt > input").send_keys( "人{}才".format(suiji)) self.driver.find_element_by_css_selector("#geren-idCard").send_keys("140121198906133513") time.sleep(1) self.driver.find_element_by_css_selector("#personalssq").click() self.driver.find_element_by_css_selector("#personalistrative > div > div.d-dropdown > div.tab-content.active.tab-province > dl.item.item-a-g.clearfix > dd > span:nth-child(1)").click() self.driver.find_element_by_css_selector("#personalistrative > div > div.d-dropdown > div.tab-content.tab-city.active > dl.item.item-a-g.clearfix > dd > span:nth-child(1)").click() self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base.open > div.applicant-form > table:nth-child(13) > tbody.tbody-gsh > tr:nth-child(1) > td.td-content > input").send_keys("dada") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base.open > div.applicant-form > table:nth-child(13) > tbody.tbody-gsh > tr:nth-child(2) > td.td-content > input").send_keys("15122311456") self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base.open > div.applicant-form > table:nth-child(13) > tbody.tbody-gsh > tr:nth-child(3) > td.td-content > input").send_keys("*****@*****.**") #解决常用申请人弹框,点击空白处 self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base.open > div.applicant-form > h2").click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base.open > div.section-btns.clearfix > a:nth-child(2)").click() time.sleep(1) # self.driver.find_element_by_css_selector( # "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap > div.section-base > div.section-btns.clearfix > a:nth-child(2)").click() # time.sleep(1) """订单备注""" self.driver.find_element_by_css_selector( "html body div.smartRegister-page div.orderinfo-wrap div.order-content textarea").send_keys( time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") get_screenshort(self.driver, "test_znzz.png") for i in self.driver.find_elements_by_css_selector("body > div.smartRegister-page > div.orderinfo-wrap > div.last-pay.personal-last-pay > ul > li.row-sense > em > i"): print("总价:"+i.text) ii=i.text #self.assertIn(aa,ii) #print("测试通过") #self.driver.find_element_by_xpath("/html/body/div[6]/div[3]/div[5]/div/a").click() self.driver.find_element_by_css_selector("body > div.smartRegister-page > div.orderinfo-wrap > div.last-pay.personal-last-pay > div > a").click() for o in self.driver.find_elements_by_class_name("payable"): print("订单提交成功,应付金额:"+o.text) oo=o.text self.assertIn(oo,ii) print("测试通过") self.driver.find_element_by_css_selector("#alisubmit").click()
def test_hwgs_1(self): """海外高速测试""" # logging.basicConfig(filename='../LOG/' + __name__ + '.log', # format='[%(asctime)s-%(filename)s-%(levelname)s: %(message)s]', level=logging.DEBUG, # filemode='a', datefmt='%Y-%m-%d%I:%M:%S %p') dl = dengLuPage(self.driver) # 官方推荐有find_element(By.*(""))代替find_element_by_*("") # self.driver.find_element_by_id() # self.driver.find_element() dl.dengLu() time.sleep(2) ActionChains(self.driver).move_to_element( self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-navbar > div > div > h3 > span" )).perform() time.sleep(2) ActionChains(self.driver).move_to_element( self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-navbar > div > div > div > ul:nth-child(1) > li:nth-child(1) > h3 > a" )).perform() ActionChains(self.driver).release() self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-navbar > div > div > div > ul:nth-child(1) > li:nth-child(1) > div > dl:nth-child(3) > dd > a:nth-child(4)" ).click() # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(3) self.assertIn("海外公司智能注册-权大师", self.driver.title) print(self.driver.title) self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-serviceItems > table > tbody > tr > td.td-cont > ul > li:nth-child(4)" ).click() for a in self.driver.find_elements_by_css_selector("#total-price"): print("费用总计:" + a.text) aa = a.text self.driver.find_element_by_css_selector( "body > div.section-product.width1200 > dl > dd > div.cont-btnBuy > a.btn.btn-next.buynow" ).click() ss = Unicode() self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-name > td.td-content > input" ).send_keys("{}".format(ss)) print("商标名称:{}".format(ss)) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(4) > div > table > tbody > tr.row-tuyang.show-create.show-create1 > td.td-content > div.zidongdong-create > ul > li > div.bottom.getBrandPic > a" ).click() self.driver.find_element_by_css_selector( "#create-tuyang > label.label.checked").click() time.sleep(5) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div:nth-child(14) > div.categoryInfo-wrap > div.c-row.row-way > div > a.btn-choice.active" ).click() suiji = random.randint(2, 46) self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li:nth-child({}) > span" .format(suiji)).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(1) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(2) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(3) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(4) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(5) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(6) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(7) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(8) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(9) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > dl > dt:nth-child(10) > span" ).click() print("选择了第{}类商标分类!".format(suiji)) self.driver.find_element_by_css_selector( "body > div.smartRegister-page.smartRegister3-page > div.last-pay > ul > li.row-step > a" ).click() time.sleep(1) # 企业 国外 self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(1) > td.td-content.contact-select-container > dl > dt > input" ).send_keys("{}".format(Unicode())) self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(2) > td.td-content > input" ).send_keys("tesr") self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(3) > td.td-content.fcountry-container > input.myInput" ).click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(3) > td.td-content.fcountry-container > div > div.country-list.country-list-ag.active > span:nth-child(1)" ).click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(4) > td.td-title" ).click() self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(4) > td.td-content > input" ).send_keys("test01") self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(5) > td.td-content > input" ).send_keys("test01") self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(6) > td.td-content > input" ).send_keys("test02") self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(7) > td.td-content > input" ).send_keys("15624992422") self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-base > div.overseas-form > table.table-1.table-overseas.table-type2.active > tbody.tbody-qiye > tr:nth-child(8) > td.td-content > input" ).send_keys("*****@*****.**") self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.agentInfo-wrap.applicant-wrap.overseas > div.section-btns.clearfix > a:nth-child(2)" ).click() """订单备注""" self.driver.find_element_by_css_selector( "html body div.smartRegister-page div.orderinfo-wrap div.order-content textarea" ).send_keys(time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") get_screenshort(self.driver, "test_hwgs_1.png") for i in self.driver.find_elements_by_css_selector( "body > div.smartRegister-page > div.orderinfo-wrap > div.last-pay.personal-last-pay > ul > li.row-sense > em > i" ): print("总价:" + i.text) ii = i.text self.assertIn(aa, ii) print("价格一致") self.driver.find_element_by_css_selector( "body > div.smartRegister-page > div.orderinfo-wrap > div.last-pay.personal-last-pay > div > a" ).click() for o in self.driver.find_elements_by_class_name("payable"): print("订单提交成功,应付金额:" + o.text) oo = o.text self.assertIn(oo, ii) print("测试通过") self.driver.find_element_by_css_selector("#alisubmit").click()
def test_hhrqdxd(self): """渠道下单单个商标注册""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(1) self.driver.find_element_by_css_selector( "#com-header > div > div.item-right > ul.r-maps > li:nth-child(1) > a" ).click() time.sleep(1) self.driver.find_element_by_css_selector( "#personalCenter2-header > div.header-box > div.header-box > div.header-nav > a" ).click() #新版提示 self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div[1]/div/a").click( ) self.driver.find_element_by_css_selector( "#personalCenter2-leftNav > ul > li:nth-child(2) > ul > li:nth-child(2) > a" ).click() """填写渠道账号""" self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div[2]/div[1]/dl/dt/input" ).clear() self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div[2]/div[1]/dl/dt/input" ).send_keys("15122311450") self.driver.find_element_by_xpath("//*[@id=\"inquirer\"]").clear() self.driver.find_element_by_xpath("//*[@id=\"inquirer\"]").send_keys( "15624992422") """填写商标信息""" self.driver.find_element_by_xpath( "//*[@id=\"selectBrandType\"]/label[1]").click() self.driver.find_element_by_name("brandName").send_keys("{}".format( Unicode())) self.driver.find_element_by_xpath( "//*[@id=\"create-tuyang\"]/label[2]").click() self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div[3]/div[1]/div[1]/table/tbody/tr[4]/td[2]/div[3]/ul/li/div[2]/a" ).click() time.sleep(2) print("商标名称填写成功!") self.driver.execute_script("window.scrollBy(0,500)") # 滑动滚动条 """商标类别""" suiji = random.randint(1, 46) self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div[3]/div[1]/div[1]/table/tbody/tr[5]/td[2]/a[2]" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li:nth-child({}) > span" .format(suiji)).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(1) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(2) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(3) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(4) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(5) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(6) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(7) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(8) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(9) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(10) > span" ).click() print("选择了第{}类商标分类".format(suiji)) # for i in self.driver.find_elements_by_css_selector("#personalCenter2-rightContainer > div > div.order-form-page > div > div.order-detail-box.order-categories > div.order-categories-total > span.span-total > strong > i"): # print("总价:"+i.text) # ii=i.text """申请人信息""" self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.smartRegister-page.smartRegister-page-source2.smartRegister-page-personal > div:nth-child(5) > div.agentInfo-wrap.agentInfo-wrap-in > div > table > thead > tr > td.td-content > a.btn-choice.fownertype.active" ).click() self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div[4]/div[1]/div/table/tbody[1]/tr[1]/td[2]/dl/dt/input" ).clear() self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div[4]/div[1]/div/table/tbody[1]/tr[1]/td[2]/dl/dt/input" ).send_keys("文思海辉技术有限公司") self.driver.find_element_by_xpath("//*[@id=\"ssq\"]").click() self.driver.find_element_by_xpath( "//*[@id=\"myadministrative\"]/div/div[2]/div[1]/dl[1]/dd/span[1]" ).click() self.driver.find_element_by_xpath( "//*[@id=\"myadministrative\"]/div/div[2]/div[2]/dl[2]/dd/span[1]" ).click() self.driver.find_element_by_name("fcontactName").clear() self.driver.find_element_by_name("fcontactName").send_keys("蔡妍妍") self.driver.find_element_by_name("fcontactTel").clear() self.driver.find_element_by_name("fcontactTel").send_keys( "17801188215") self.driver.find_element_by_name("ftelephone").send_keys("4001005678") self.driver.find_element_by_name("fcontactMail").send_keys( "*****@*****.**") print("申请人信息填写成功!") get_screenshort(self.driver, "test_hhrqdxd.png") for o in self.driver.find_elements_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div[5]/div/ul/li[3]/em/i" ): print("订单提交成功,应付金额:" + o.text) oo = o.text #self.assertIn(oo,ii) self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.section8 > div > a" ).click()
def test_hhrsbzc(self): """合伙人商标注册""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(1) self.driver.find_element_by_css_selector( "#com-header > div > div.item-right > ul.r-maps > li:nth-child(1) > a" ).click() time.sleep(1) self.driver.find_element_by_css_selector( "#personalCenter2-header > div.header-box > div.header-box > div.header-nav > a" ).click() #新版提示 self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div[1]/div/a").click( ) self.driver.find_element_by_css_selector( "#personalCenter2-leftNav > ul > li:nth-child(2) > ul > li:nth-child(1) > a" ).click() """填写商标信息""" self.driver.find_element_by_css_selector( "#selectBrandType > label.label.checked").click() self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.order-form-page > div > div:nth-child(1) > div.brandInfo-wrap > div > table > tbody > tr.row-name > td.td-content > input" ).send_keys("{}".format(Unicode())) self.driver.find_element_by_css_selector( "#create-tuyang > label.label.checked").click() self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.order-form-page > div > div:nth-child(1) > div.brandInfo-wrap > div > table > tbody > tr.row-tuyang.show-create.show-create1 > td.td-content > div.zidongdong-create > ul > li > div.bottom.getBrandPic > a" ).click() print("商标名称填写成功!") self.driver.execute_script("window.scrollBy(0,500)") # 滑动滚动条 """商标类别""" suiji = random.randint(1, 46) self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li:nth-child({}) > span" .format(suiji)).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div:nth-child(2) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(1) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(2) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(3) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(4) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(5) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(6) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(7) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(8) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(9) > span" ).click() self.driver.find_element_by_css_selector( "#section-selfchoice > div.group-left > ul > li.list.open > div.title-second.open > dl > dt:nth-child(10) > span" ).click() print("选择了第{}类商标分类".format(suiji)) for i in self.driver.find_elements_by_css_selector( "#personalCenter2-rightContainer > div > div.order-form-page > div > div.order-detail-box.order-categories > div.order-categories-total > span.span-total > strong > i" ): print("总价:" + i.text) ii = i.text """申请人信息""" self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div/div[3]/div/table/thead/tr[1]/td[2]/a[1]" ).click() self.driver.find_element_by_xpath( "//*[@id=\"overseastype\"]/label[1]").click() self.driver.find_element_by_xpath( "//*[@id=\"personalCenter2-rightContainer\"]/div/div[1]/div/div[3]/div/div/div/div/table[1]/tbody[1]/tr[1]/td[2]/dl/dt/input" ).send_keys("文思海辉技术有限公司{}".format(random.randint(1, 1000))) self.driver.find_element_by_xpath("//*[@id=\"ssq\"]").click() self.driver.find_element_by_xpath( "//*[@id=\"companylistrative\"]/div/div[2]/div[1]/dl[1]/dd/span[1]" ).click() self.driver.find_element_by_xpath( "//*[@id=\"companylistrative\"]/div/div[2]/div[2]/dl[2]/dd/span[1]" ).click() print("申请人信息填写成功!") """客户联系人信息""" self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.order-form-page > div > div.order-detail-box.contact-box > ul > li:nth-child(1) > input" ).send_keys("dalao") self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.order-form-page > div > div.order-detail-box.contact-box > ul > li:nth-child(2) > input" ).send_keys("15624992488") self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.order-form-page > div > div.order-detail-box.contact-box > ul > li:nth-child(3) > input" ).send_keys("*****@*****.**") print("联系人信息填写成功!") """订单备注""" self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.order-form-page > div > div.order-detail-box.message-box > ul > li > textarea" ).send_keys(time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") #self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div > div.order-form-page > div > div:nth-child(7) > div > a.mybtn.mybtn-inverse.mybtn-lg.saveAll").click() self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div > div.order-form-page > div > div:nth-child(7) > div > a:nth-child(2)" ).click() time.sleep(2) for o in self.driver.find_elements_by_class_name("payable"): print("订单提交成功,应付金额:" + o.text) oo = o.text self.assertIn(oo, ii) self.driver.find_element_by_css_selector( "#payways > ul:nth-child(1) > li").click() self.driver.find_element_by_css_selector("#alisubmit").click() print("价格一致") print("合伙人订单下单成功!") get_screenshort(self.driver, "test_hhrsbzc.png") self.driver.find_element_by_css_selector( "#personalCenter2-rightContainer > div.paying-wrap.paying-sk-wrap > div.paying-sk-button > a.button.send" ).click() print("订单已发送客户付款!")