def test_wzdj(self): """文字作品版权登记加急测试""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2) ActionChains(self.driver).move_to_element(self.driver.find_element_by_css_selector(
def test_mg(self): """美国商标注册测试""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2) ActionChains(self.driver).move_to_element(self.driver.find_element_by_css_selector(
def test_mfsb(self): """免费商标查询测试""" 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(2) > dd > a:nth-child(1)").click() time.sleep(3) # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) self.assertIn("注册商标查询_中国商标查询_权大师官网",self.driver.title) print(self.driver.title) get_screenshort(self.driver, "test_mfsb.png")
def test_fmzl_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) dl.dengLu() time.sleep(2) self.driver.find_element_by_css_selector( "#com-navbar > div > ul > li:nth-child(2) > a").click() self.assertIn("发明专利申请基础型_权大师", self.driver.title) print(self.driver.title) #self.driver.find_element_by_css_selector("#slowItems > label.label.active > input[type=\"checkbox\"]") #单个申请人减缓 self.driver.find_element_by_css_selector( "#slowItems > label:nth-child(2) > input[type=\"checkbox\"]" ).click() #多个申请人减缓 #self.driver.find_element_by_css_selector("#slowItems > label:nth-child(3) > input[type=\"checkbox\"]") #不减缓 self.driver.find_element_by_css_selector( "#serviceName > li.list.active").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_name("ownerContactPerson").send_keys("全大师") self.driver.find_element_by_name("ownerContactPhone").send_keys( "15624992498") self.driver.find_element_by_name("contactMail").send_keys( "*****@*****.**") self.driver.find_element_by_css_selector("#remark").send_keys("test") get_screenshort(self.driver, "test_fmzl_2.png") for i in self.driver.find_elements_by_css_selector( "body > div.section-myorder.width1200 > div > div > 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.section-myorder.width1200 > div > div > ul > li.row-step > a.btn-next.submitOrder" ).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_gnsb(self): """国内商标查询测试""" 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(2) > dd > a:nth-child(2)").click() time.sleep(3) # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) self.assertIn("国内商标查询(报告)-国内商标查询报告-权大师",self.driver.title) print(self.driver.title) 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_name("ownerContactPerson").send_keys("全大师") self.driver.find_element_by_name("ownerContactPhone").send_keys("15624992498") self.driver.find_element_by_name("contactMail").send_keys("*****@*****.**") self.driver.find_element_by_css_selector("#remark").send_keys(time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") get_screenshort(self.driver, "test_gnsb.png") for i in self.driver.find_elements_by_css_selector( "body > div.section-myorder.width1200 > div > div > 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.section-myorder.width1200 > div > div > ul > li.row-step > a.btn-next.submitOrder").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_rjzz(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(2) self.driver.find_element_by_css_selector( "#com-navbar > div > ul > li:nth-child(3) > a").click() self.assertIn("软件著作权登记-权大师", self.driver.title) print(self.driver.title) self.driver.find_element_by_css_selector( "#serviceName > li.list.active").click() #WebElement' object is not iterable #element + s (解决) for c in self.driver.find_elements_by_xpath( "//*[@id=\"total-price\"]"): print("费用总计:" + c.text) cc = c.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_name("ownerContactPerson").send_keys("全大师") self.driver.find_element_by_name("ownerContactPhone").send_keys( "15624992498") self.driver.find_element_by_name("contactMail").send_keys( "*****@*****.**") self.driver.find_element_by_css_selector("#remark").send_keys("test") get_screenshort(self.driver, "rjzztest.png") for i in self.driver.find_elements_by_css_selector( "body > div.section-myorder.width1200 > div > div > ul > li.row-sense > em > i" ): print("总价:" + i.text) ii = i.text self.assertIn(cc, ii) print("价格一致") self.driver.find_element_by_css_selector( "body > div.section-myorder.width1200 > div > div > ul > li.row-step > a.btn-next.submitOrder" ).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_mdl(self): """马德里商标注册测试""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2) ActionChains(self.driver).move_to_element(self.driver.find_element_by_css_selector( <<<<<<< HEAD "#com-navbar > div > div.drop-nav > div > ul > li:nth-child(1) > h3 > a")).perform()
def test_fmzlbz_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) dl.dengLu() time.sleep(2)
def test_gnsb(self): """国内商标查询测试""" 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(
def test_yd(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(6) > dd > a:nth-child(5)").click() time.sleep(3) # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) self.assertIn("印度商标注册",self.driver.title) print(self.driver.title) 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_name("ownerContactPerson").send_keys("全大师") self.driver.find_element_by_name("ownerContactPhone").send_keys("15624992498") self.driver.find_element_by_name("contactMail").send_keys("*****@*****.**") self.driver.find_element_by_css_selector("#remark").send_keys("test") get_screenshort(self.driver, "test_yd.png") for i in self.driver.find_elements_by_css_selector( "body > div.section-myorder.width1200 > div > div > 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.section-myorder.width1200 > div > div > ul > li.row-step > a.btn-next.submitOrder").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_mfsb(self): """免费商标查询测试""" 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( <<<<<<< HEAD "#com-navbar > div > div.drop-nav > div > ul > li:nth-child(1) > h3 > a")).perform()
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)
def test_gwyj(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("#com-header > div > div.item-right > ul.r-maps > 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_name("receiptNo").send_keys("23491381") self.driver.find_element_by_xpath("//*[@id=\"personalCenter2-rightContainer\"]/div[1]/form/p/input").click() self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.person-postofficial.order-page > div.official-doc-wrap > table > tbody > tr:nth-child(2) > td:nth-child(1) > span").click() self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.cho-wrap-wrap > div > dl > dd.next-btn").click() time.sleep(1) self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.person-postofficial.order-page > div.confirm-post-addr > p.addr-head > a").click() self.driver.find_element_by_name("receivedName").send_keys("老戏骨") self.driver.find_element_by_name("receivedTel").send_keys("15624992422") self.driver.find_element_by_name("divisionName").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() self.driver.find_element_by_name("street").send_keys("TBD云集中心") time.sleep(1) self.driver.find_element_by_xpath("//*[@id=\"address_info\"]/p[5]/a[2]").click() get_screenshort(self.driver,"gwyjtest.png") print("官文邮寄成功!") print("测试通过!")
def test_fpsq(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-rightContainer > div.order-page.p-invoice-content > div.tabsPanel > ul > li.list.selected > a").click() self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-page.p-invoice-content > div.tabsPanel > ul > li:nth-child(3) > a").click() self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-page.p-invoice-content > div.search-form > form > ul > li:nth-child(1) > dl:nth-child(1) > dd > input").send_keys("Z80509824620") self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-page.p-invoice-content > div.search-form > form > ul > li:nth-child(2) > div > input").click() self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-page.p-invoice-content > div.tabsPanel > div > div.section1 > table > tbody > tr > td:nth-child(8) > div > a").click() #self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-page.p-invoice-content > div.tabsPanel > div > div.section1 > table > tfoot > tr > td.td-selectSingle > div > a").click() time.sleep(2) #self.driver.find_element_by_css_selector("#invoiceModal > ul > li.tab.active") self.driver.find_element_by_css_selector("#invoiceModal > ul > li.tab.active").click() #self.driver.find_element_by_name("invoiceType").click() self.driver.find_element_by_css_selector("#radio-isgs > label:nth-child(2)").click() self.driver.find_element_by_css_selector("#invoiceModal > div.tabs-boder > div.tabs-content.active > table > tbody > tr:nth-child(3) > td:nth-child(2) > input").clear() self.driver.find_element_by_css_selector("#invoiceModal > div.tabs-boder > div.tabs-content.active > table > tbody > tr:nth-child(3) > td:nth-child(2) > input").send_keys("北京梦知网科技有限公司") self.driver.find_element_by_css_selector("#invoiceModal > div.tabs-boder > div.tabs-content.active > table > tbody > tr.tr-sbh.active > td:nth-child(2) > input").clear() self.driver.find_element_by_css_selector("#invoiceModal > div.tabs-boder > div.tabs-content.active > table > tbody > tr.tr-sbh.active > td:nth-child(2) > input").send_keys("91330784689989022Q") self.driver.find_element_by_css_selector("#invoice-general").click() print("发票申请提交成功") 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("商标搜索测试通过")
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_number1(self): """网站地图测试""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2) self.driver.find_element_by_css_selector("body > div.footer-wrap > div > ul.items-2 > li:nth-child(7) > a").click() # url = 'https://pre-www.quandashi.com/site-map/index' # r = requests.get(url) # r.encoding = 'gb2312' # # # 利用 re (太黄太暴力!) # matchs = re.findall(r"(?<=href=\").+?(?=\")|(?<=href=\').+?(?=\')", r.text) # for link in matchs: # print(link) for link in self.driver.find_elements_by_tag_name("a"): print(link.get_attribute("href"))
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': '7e09dbab5948a23d2f825a5f16671bd93c1b9209', # 一周有效期 2018-7-9_10-46 'Domain': '.quandashi.com'}) self.driver.refresh() self.driver.find_element_by_css_selector("body > div.brandSearch2-page > div > div.search > div.searchPanel.clearfix > input.input.search-text").send_keys("测试") self.driver.find_element_by_css_selector("#btnSearchkey").click() time.sleep(4) self.assertIn("测试_全球更好用的商标搜索_权大师",self.driver.title) print(self.driver.title) get_screenshort(self.driver, "test_sbss.png") print("商标搜索测试通过")
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_mszp(self): """美术作品版权登记测试""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2)
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()
def test_sbss(self): """商标搜索""" dl = dengLuPage(self.driver) dl.dengLu() time.sleep(2)
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_bmks(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(1) self.driver.find_element_by_css_selector( "#com-navbar > div > ul > li:nth-child(1) > a").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) 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.list.active" ).click() ##total-price 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_name("ownerContactPerson").send_keys("全大师") self.driver.find_element_by_css_selector( "body > div.myOrder-wrap > div.section-myorder.width1200 > div > table:nth-child(2) > tbody > tr:nth-child(2) > td.td-2 > input" ).send_keys("15624992498") self.driver.find_element_by_css_selector( "body > div.myOrder-wrap > div.section-myorder.width1200 > div > table:nth-child(2) > tbody > tr:nth-child(3) > td.td-2 > input" ).clear() self.driver.find_element_by_css_selector( "body > div.myOrder-wrap > div.section-myorder.width1200 > div > table:nth-child(2) > tbody > tr:nth-child(3) > td.td-2 > input" ).send_keys("*****@*****.**") self.driver.find_element_by_css_selector("#remark").send_keys("test") get_screenshort(self.driver, "bmkstest.png") for i in self.driver.find_elements_by_css_selector( "body > div.myOrder-wrap > div.section-myorder.width1200 > div > div > 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.myOrder-wrap > div.section-myorder.width1200 > div > div > ul > li.row-step > a.btn-next.submitOrder" ).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_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_ddzx(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_css_selector("#personalCenter2-leftNav > ul > li.menu.open > ul > li:nth-child(1) > a").click() self.assertIn("权大师_我的商标", self.driver.title) print(self.driver.title) self.driver.find_element_by_css_selector("#s-form > ul > li:nth-child(1) > input").send_keys("Z80510326116") self.driver.find_element_by_css_selector("#s-form > ul > li:nth-child(7) > input").click() self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-page > div.tabsPanel > div > div > table > tbody > tr > td:nth-child(8) > div > a").click() time.sleep(1) """修改商标名字""" self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-detail-page > div:nth-child(4) > h2 > a").click() self.driver.find_element_by_css_selector("#modal-brand > div.modal-button > a.button.save").click() print("商标名字修改成功") time.sleep(1) """修改尼斯分类""" suiji=random.randint(2, 46) self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-detail-page > div.order-detail-box.order-categories > h2 > a").click() self.driver.find_element_by_css_selector("#section-selfchoice > div.group-right > div > div > h4 > div.header-right > a > i").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() self.driver.find_element_by_css_selector("#edit-category > div.modal-button > a.button.save").click() time.sleep(2) print("尼斯分类修改为第{}类".format(suiji-1)) time.sleep(2) """申请人信息""" self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-detail-page > div.order-detail-box.applicant-info > h2 > a").click() self.driver.find_element_by_css_selector("#change-applicant-info > div.modal-body.scroll > div > table > thead > tr:nth-child(1) > td.td-content > a.btn-choice.fownertype.active").click() self.driver.find_element_by_css_selector("#change-applicant-info > div.modal-body.scroll > div > div > div > div > table > tbody.tbody-gsh > tr:nth-child(1) > td.td-content.contact-select-container > dl > dt > input").clear() self.driver.find_element_by_css_selector("#change-applicant-info > div.modal-body.scroll > div > div > div > div > table > tbody.tbody-gsh > tr:nth-child(1) > td.td-content.contact-select-container > dl > dt > input").send_keys("田伟") self.driver.find_element_by_css_selector("#geren-idCard").clear() self.driver.find_element_by_css_selector("#geren-idCard").send_keys("130184198908191520") self.driver.find_element_by_css_selector("#change-applicant-info > div.modal-button > a.button.save").click() print("申请人信息修改成功") time.sleep(4) """订单联系人""" self.driver.find_element_by_css_selector("#personalCenter2-rightContainer > div.order-detail-page > div:nth-child(8) > div > h2 > a").click() self.driver.find_element_by_css_selector("#change-contact-info > div.section-base > table > tbody.tbody-qiye > tr:nth-child(1) > td.td-content > input").clear() self.driver.find_element_by_css_selector("#change-contact-info > div.section-base > table > tbody.tbody-qiye > tr:nth-child(1) > td.td-content > input").send_keys("大西瓜") self.driver.find_element_by_name("ftelephone").clear() self.driver.find_element_by_name("ftelephone").send_keys("0351-5925212") self.driver.find_element_by_css_selector("#change-contact-info > div.modal-button > a.button.save").click() print("订单联系人修改成功") time.sleep(1) get_screenshort(self.driver,"ddzxtest.png") print("测试通过!")
def test_dbwy(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(2)").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) # abwy注册 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(2)").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_name("ownerContactPerson").send_keys("全大师") self.driver.find_element_by_css_selector( "body > div.myOrder-wrap > div.section-myorder.width1200 > div > table:nth-child(2) > tbody > tr:nth-child(2) > td.td-2 > input").send_keys( "15624992498") self.driver.find_element_by_css_selector( "body > div.myOrder-wrap > div.section-myorder.width1200 > div > table:nth-child(2) > tbody > tr:nth-child(3) > td.td-2 > input").clear() self.driver.find_element_by_css_selector( "body > div.myOrder-wrap > div.section-myorder.width1200 > div > table:nth-child(2) > tbody > tr:nth-child(3) > td.td-2 > input").send_keys( "*****@*****.**") self.driver.find_element_by_css_selector("#remark").send_keys(time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") get_screenshort(self.driver, "test_dbwy.png") for i in self.driver.find_elements_by_css_selector("body > div.myOrder-wrap > div.section-myorder.width1200 > div > div > 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.myOrder-wrap > div.section-myorder.width1200 > div > div > ul > li.row-step > a.btn-next.submitOrder").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_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_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("订单已发送客户付款!")