def test_free_search(self): """免费商标查询测试""" dl = DengLuPage(self.driver) # 官方推荐有find_element(By.*(""))代替find_element_by_*("") # self.driver.find_element_by_id() # self.driver.find_element() dl.login() 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_free_search.png")
def test_classify_1(self): """商品分类搜索测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(1) self.driver.execute_script("window.scrollBy(0,1200)") # 滑动滚动条 ActionChains(self.driver).move_to_element( self.driver.find_element_by_css_selector("#section-tools > div > ul > li:nth-child(3)")).perform() time.sleep(2) ActionChains(self.driver).release() self.driver.find_element_by_link_text("立即使用").click() time.sleep(2) self.assertIn("商品分类_商标类似商品和服务区分表基于尼斯分类第十版2016", self.driver.title) print(self.driver.title) dl.refresh() brand = unicode() self.driver.find_element_by_css_selector("#niceList > div.page-search.w-center > div > input").send_keys(brand) print("商品关键词:" + brand) time.sleep(2) self.driver.find_element_by_css_selector("#search").click() get_screenshort(self.driver,"test_classify_1.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_nanny(self): """保姆快速注册测试""" self.driver.find_element_by_xpath("//android.widget.TextView[@text=\"保姆快速注册\"]").click() service_price = self.driver.find_element_by_id("com.dream.ipm:id/tv_product_service_price").text print("服务费:" + service_price) official_price = self.driver.find_element_by_id("com.dream.ipm:id/tv_product_official_price").text print("服务费:" + official_price) """选择保姆注册""" # self.driver.find_element_by_id("com.dream.ipm:id/cb_product_detail_option").click() self.driver.find_element_by_id("com.dream.ipm:id/tv_product_detail_order").click() """确认订单填写信息""" self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_name").clear() self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_name").send_keys("test") self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_tel").clear() self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_tel").send_keys("15624992498") self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_email").clear() self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_email").send_keys("*****@*****.**") self.driver.find_element_by_id("com.dream.ipm:id/et_product_confirm_message").send_keys(time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") self.driver.find_element_by_id("com.dream.ipm:id/tv_product_confirm_submit").click() """确认支付""" total_price = str(self.driver.find_element_by_id("com.dream.ipm:id/tv_order_pay_total_price_bottom").text).replace("¥", "") print("应付总额:" + total_price) self.assertEqual(total_price, str(600.0), "金额异常请检查!") self.driver.find_element_by_id("com.dream.ipm:id/bt_order_pay_submit").click() get_screenshort(self.driver, "test_nanny.png") print("保姆注册测试通过!")
def test_trademark_hot_1(self): """商标热搜测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(2) rs1 = self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-search > div > dl > dt > span.hot-search-item" ).text print("热搜商标_1:" + str(rs1).replace("\n", " ")) self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-search > div > dl > dd" ).click() time.sleep(2) rs2 = self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-search > div > dl > dt > span.hot-search-item" ).text print("热搜商标_2:" + str(rs2).replace("\n", " ")) self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-search > div > dl > dd" ).click() time.sleep(2) rs3 = self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-search > div > dl > dt > span.hot-search-item" ).text print("热搜商标_3:" + str(rs3).replace("\n", " ")) get_screenshort(self.driver, "test_trademark_hot_1.png") print("热搜正常,测试通过!")
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_Korea(self): """韩国商标注册测试""" dl = DengLuPage(self.driver) dl.login() 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(8) > dd > a:nth-child(10)").click() time.sleep(3) # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) # 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("{}".format(unicode())) 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_Korea.png") for i in self.driver.find_elements_by_css_selector( "body > div.section-myorder.orderinfo-wrap.width1200 > div:nth-child(6) > 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.section-myorder.orderinfo-wrap.width1200 > div:nth-child(6) > div.btns > 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_address(self): """发票地址管理""" dl = DengLuPage(self.driver) dl.login() 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) try: self.driver.find_elements_by_css_selector( ".modal-body > .close")[0].click() except Exception: pass """添加邮寄地址""" 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, "test_address.png") print("测试通过!")
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_invention_patent_bz_2(self): """发明专利标准_多个人""" self.driver.find_element_by_xpath( "//android.widget.TextView[@text=\"发明专利标准申请\"]").click() """选择标准""" # 默认标准申请 self.driver.find_element_by_xpath( "//android.widget.TextView[@text=\"多个申请人减缓\"]").click() """打印费用""" service_price = self.driver.find_element_by_id( "com.dream.ipm:id/tv_product_service_price").text print("服务费:" + service_price) official_price = self.driver.find_element_by_id( "com.dream.ipm:id/tv_product_official_price").text print("服务费:" + official_price) # 点击立即办理 self.driver.find_element_by_xpath( "//android.widget.TextView[@resource-id=\"com.dream.ipm:id/tv_product_detail_order\"]" ).click() # """确认订单填写信息""" # self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_name").clear() # self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_name").send_keys("test") # # self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_tel").clear() # self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_tel").send_keys("15624992498") # # self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_email").clear() # self.driver.find_element_by_id("com.dream.ipm:id/et_product_contact_email").send_keys("*****@*****.**") # # self.driver.find_element_by_id("com.dream.ipm:id/et_product_confirm_message").send_keys(time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") total_price_1 = self.driver.find_element_by_id( "com.dream.ipm:id/tv_product_confirm_total_price").text self.driver.find_element_by_id( "com.dream.ipm:id/tv_product_confirm_submit").click() """确认支付""" print("应付总额:" + total_price_1) price = self.driver.find_element_by_xpath( "//android.widget.TextView[@resource-id=\"com.dream.ipm:id/tv_order_pay_total_price_bottom\"]" ).text self.driver.find_element_by_id( "com.dream.ipm:id/bt_order_pay_submit").click() get_screenshort(self.driver, "test_invention_patent_bz_2.png") self.assertEqual(total_price_1, price, "金额异常请检查!") print("发明专利标准_多个人申请测试通过!")
def trade_name(self, name, title, images): dl = LoginPage(self.driver) dl.login() ActionChains(self.driver).move_to_element(self.driver.find_element_by_css_selector( "#__layout > div > div:nth-child(1) > div:nth-child(1) > div > div.fl.drop_nav")).perform() time.sleep(2) ActionChains(self.driver).move_to_element(self.driver.find_element_by_css_selector( "#__layout > div > div:nth-child(1) > div:nth-child(1) > div > div.hoverMenu.drop-body > ul.cont.cont-1 > li > h3 > a")).perform() ActionChains(self.driver).release() self.driver.find_element_by_link_text(name).click() time.sleep(3) # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) self.assertEqual(title, self.driver.title) print(self.driver.title) price_text_1 = str(self.driver.find_element_by_css_selector( "#__layout > div > div.show-content > div.w1200 > div.product > div.hidden > div.type > dl:nth-child(3) > dd > b").text).replace( "¥", "") s1 = int(price_text_1) + 0 print("总费用:" + price_text_1) self.driver.find_element_by_link_text("立即办理").click() self.driver.find_element_by_name("name").send_keys(unicode()) self.driver.find_element_by_name("phone").send_keys("18636825212") self.driver.find_element_by_name("email").send_keys("*****@*****.**") self.driver.find_element_by_class_name("myTextarea").send_keys(time.strftime("%Y-%m-%d_%H-%M-%S") + "测试订单") get_screenshort(self.driver, images) price_text_2 = self.driver.find_element_by_css_selector( "#__layout > div > div.content.myOrder-wrap.w1200 > div > div:nth-child(6) > div.last-pay.personal-last-pay > ul > li.row-sense > em > i").text s2 = int(price_text_2) + 0 self.assertEqual(s1, s2, "金额异常!") self.driver.find_element_by_link_text("提交订单").click() info = self.driver.find_element_by_css_selector( "#__layout > div > div.smartRegister-page.smartRegister3-page > div.paying-wrap > div.section-orderInfo.clearfix > div > div").text print(str(info)) price_text_3 = str(self.driver.find_element_by_class_name("payable").text).replace("¥", "").replace(".00", "") s3 = int(price_text_3) + 0 self.assertEqual(s2, s3, "金额异常!") print("价格一致!") self.driver.find_element_by_link_text("确认支付").click() print(name + "测试通过!")
def test_trade_11(self): """价格区间测试""" dl = DengLuPage(self.driver) dl.login() self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-navbar > div > ul > li:nth-child(5) > a" ).click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) dl.refresh() self.driver.set_window_size(1920, 1080) self.assertIn("商标交易_商标转让_商标买卖_商标交易网-权大师", self.driver.title) print(self.driver.title) low = random.randint(1, 5000) high = random.randint(5000, 50000) self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > div.searchCriteriaBox > dl.brandPrice.chooseType > dd.inputNum > input[type=\"text\"]:nth-child(1)" ).send_keys(low) self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > div.searchCriteriaBox > dl.brandPrice.chooseType > dd.inputNum > input[type=\"text\"]:nth-child(3)" ).send_keys(high) print("价格区间:" + str(low) + "_" + str(high)) get_screenshort(self.driver, "test_trade_11.png") result = self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > div.searchCriteriaBox > dl.CompreRanking > dd:nth-child(3)" ).text print(result) number = self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > div.searchCriteriaBox > dl.CompreRanking > dd:nth-child(3) > span" ).text number1 = int(number) print(number1) if number1 == 0: print("没有相关可出售商标,您可以发布求购需求!") else: print( self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > ul > li:nth-child(1) > div" ).text) selected = self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > div.searchCriteriaBox > dl.SelectedConditions > dd" ).text print("已选条件:" + str(selected).replace("\n", " ")) print("筛选商标测试通过!")
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_trademark_hot_2(self): """热搜跳转测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(2) rs = self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-search > div > dl > dt > span.hot-search-item" ).text print("热搜商标:" + str(rs).replace("\n", " ")) hot = random.randint(1, 6) name = self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-search > div > dl > dt > span.hot-search-item > span:nth-child({})" .format(hot)).text print("商标名称:" + name) self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-search > div > dl > dt > span.hot-search-item > span:nth-child({})" .format(hot)).click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) print(self.driver.title) dl.refresh() time.sleep(3) zf = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > div.search-top" ).text print(str(zf)) number = re.sub(r"\D", "", zf) time.sleep(2) self.driver.execute_script("window.scrollBy(0,1200)") # 滑动滚动条 if int(number) == 0: tips = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > div.no-search-data > div" ).text print(str(tips).replace("\n", " ")) print("热搜跳转正常,测试通过!") else: brand = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child(1) > div.result-href > div.brand-info > a > h2" ).text print("商标名称:" + brand) info = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child(1) > div.result-href > div.brand-info > div > ul" ).text print(str(info).replace("\n", " ")) print("热搜跳转正常,测试通过!") get_screenshort(self.driver, "test_trademark_hot_2.png")
def test_PreliminaryPublicationDetails(self): """初审公告详情测试""" dl = DengLuPage(self.driver) time.sleep(2) self.driver.get("https://so.quandashi.com/search/notice/index") time.sleep(2) self.driver.set_window_size(1920, 1080) self.assertIn("初审公告搜索", self.driver.title) print(self.driver.title) dl.refresh() self.driver.find_element_by_css_selector( "#noticeList > div > div.page-form > ul:nth-child(1) > li:nth-child(1) > input[type=\"text\"]" ).send_keys("大") print("商标名称:大") self.driver.find_element_by_css_selector( "#noticeList > div > div.page-form > div > a").click() time.sleep(5) result = self.driver.find_element_by_css_selector( "#noticeList > div > div.page-form > div > span").text print(str(result)) """查询到的第一个商标信息""" info = self.driver.find_element_by_css_selector( "#noticeList > div > div.page-content > table > tbody > tr:nth-child(3)" ).text print("商标信息:" + str(info).replace("\n", " ").replace( "查看详情", "").replace("我要异议", "")) self.driver.find_element_by_css_selector( "#noticeList > div > div.page-content > table > tbody > tr:nth-child(3) > td.td-href > a:nth-child(1)" ).click() # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) get_screenshort(self.driver, "test_PreliminaryPublicationDetails_1.png") """点击下载初审公告""" self.driver.find_element_by_css_selector( "body > div.page > div.w-center > div.page-detail > div.btns > a.sc_notice_download.button.button-white" ).click() time.sleep(5) print("初审公告pdf文件下载测试通过!请在默认目录查看文件!") self.driver.find_element_by_css_selector( "body > div.page > div.w-center > div.page-detail > div.btns > a.sc_notice_brand.button" ).click() time.sleep(2) get_screenshort(self.driver, "test_PreliminaryPublicationDetails_2.png")
def test_trademark_search(self): """搜索详情测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(2) self.driver.find_element_by_css_selector("#serch-word").click() # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) self.assertIn("注册商标查询_中国商标查询_权大师官网", self.driver.title) print(self.driver.title) dl.refresh() ss = "DD" print("搜索商标名称:" + ss) self.driver.find_element_by_name("key").send_keys("{}".format(ss)) self.driver.find_element_by_css_selector("#btnSearchkey").click() time.sleep(4) print(self.driver.title) result = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > div.search-top" ).text print(str(result)) number = random.randint(1, 20) info = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child({}) > div.result-href" .format(number)).text print(str(info).replace("\n", " ")) self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child({}) > div.result-href" .format(number)).click() windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) print(self.driver.current_url) brand_info = self.driver.find_element_by_css_selector( "#searchDetail > div.page-brand > div > div.brand-left > div.brand-info" ).text print(str(brand_info).replace("\n", " ")) get_screenshort(self.driver, "test_trademark_search.png") print("商标搜索测试通过")
def test_famous(self): """驰著名商标测试""" dl = DengLuPage(self.driver) self.driver.get("https://so.quandashi.com/") dl.refresh() self.driver.find_element_by_name("key").send_keys( xz("驰著名商标.txt").replace(".0", "")) time.sleep(2) self.driver.find_element_by_css_selector( "body > div.page > div.page-index > div.page-index-form.search > ul.page-index-icon > li:nth-child(3) > a > img" ).click() time.sleep(5) selected = self.driver.find_element_by_css_selector( "#searchList > div.page-form.w-center > div.selected-category" ).text print((str(selected).replace("\n", " ")).replace("×", " ")) selected_1 = self.driver.find_element_by_css_selector( "#searchList > div.page-form.w-center > div.selected-category > div.selected-category-box > a:nth-child(1) > span" ).text if selected_1 == "驰名商标": pass else: self.assertEqual(1, 2, "已选条件异常请及时查看") result = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > div.search-top" ).text print(str(result)) number = 1 info = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child({}) > div.result-href" .format(number)).text print(str(info).replace("\n", " ")) self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child({}) > div.result-href" .format(number)).click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) print(self.driver.current_url) get_screenshort(self.driver, "test_famous.png") result2 = self.driver.find_element_by_css_selector( "#searchDetail > div.page-brand > div > div.brand-left > div.brand-info > h2" ).text print(str(result2))
def test_special_trademark(self): """特殊商标测试""" dl = DengLuPage(self.driver) self.driver.get("https://so.quandashi.com/") dl.refresh() time.sleep(2) trademark = ("地理标志商标.txt", "著名商标.txt", "驰名商标.txt") filename = random.choice(trademark) print(filename) application_number = xz(filename) print("申请号:" + str(application_number).replace(".0", "")) self.driver.find_element_by_css_selector( "body > div.page > div.page-index > div.page-index-form.search > div > input.input.search-text" ).send_keys(str(application_number).replace(".0", "")) self.driver.find_element_by_css_selector("#btnSearchkey").click() time.sleep(5) result = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > div.search-top" ).text print(str(result)) info = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child(1) > div.result-href" ).text print(str(info).replace("\n", " ")) number = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li > div.result-href > div.brand-info > div > ul > li:nth-child(2) > span:nth-child(4)" ).text print(str(number)) self.assertIn(str(application_number).replace(".0", ""), str(number)) self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child(1) > div.result-href" ).click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) print(self.driver.current_url) result2 = self.driver.find_element_by_css_selector( "#searchDetail > div.page-brand > div > div.brand-left > div.brand-info > h2" ).text get_screenshort(self.driver, "test_special_trademark.png") print(str(result2))
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_trade_3(self): """提交报价测试""" dl = DengLuPage(self.driver) dl.login() self.driver.find_element_by_css_selector( "body > div.section-banner > div.public-navbar > div > ul > li:nth-child(5) > a" ).click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) dl.refresh() self.driver.set_window_size(1920, 1080) self.assertIn("商标交易_商标转让_商标买卖_商标交易网-权大师", self.driver.title) print(self.driver.title) brand = random.randint(1, 36) name = self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > ul > li:nth-child({}) > div > b" .format(brand)).text price = self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > ul > li:nth-child({}) > div > i" .format(brand)).text lb = self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > ul > li:nth-child({}) > div > span" .format(brand)).text print("商标信息:" + str(name) + "_" + str(price) + "_" + str(lb)) self.driver.find_element_by_css_selector( "#app > div > div.brandMarketBox > ul > li:nth-child({}) > div > p > a:nth-child(1)" .format(brand)).click() self.driver.find_element_by_css_selector( "#app > div > div:nth-child(6) > div > div > p:nth-child(1) > input[type=\"text\"]" ).send_keys(unicode()) self.driver.find_element_by_css_selector( "#app > div > div:nth-child(6) > div > div > p:nth-child(2) > input[type=\"text\"]" ).send_keys("15624992422") price = random.randint(1, 20000000) self.driver.find_element_by_css_selector( "#app > div > div:nth-child(6) > div > div > p:nth-child(3) > input[type=\"text\"]" ).send_keys(price) print("报价:" + str(price) + "元!") # self.driver.find_element_by_css_selector("#app > div > div:nth-child(6) > div > p.subBtn > a").click() get_screenshort(self.driver, "test_trade_3.png") print("提交报价成功!")
def _monitor_4(self): """代理机构监控测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(1) self.driver.find_element_by_link_text("智能工具").click() time.sleep(2) self.driver.find_element_by_link_text("商标监控").click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) self.assertIn("商标监控首页_权大师", self.driver.title) print(self.driver.title) self.driver.find_element_by_css_selector( "body > div.brandMonitor-wrap > div > div.wrap > ul > li:nth-child(4) > a > i" ).click() self.driver.find_element_by_css_selector( "body > div.brandMonitor-wrap > div > div > div.myPanel-bodyer > div.section1 > table > tbody > tr.row-brandname > td:nth-child(2) > div > input" ).send_keys("权大师") print("代理机构:权大师") self.driver.find_element_by_css_selector( "body > div.brandMonitor-wrap > div > div > div.myPanel-bodyer > div.section1 > table > tbody > tr.row-brandname > td:nth-child(2) > div > button > i" ).click() self.driver.find_element_by_css_selector( "#jinsi > label:nth-child(1)").click() print("代理机构监控添加成功!") self.driver.find_element_by_css_selector( "body > div.brandMonitor-wrap > div > div > div.myPanel-bodyer > div.section2 > div > a" ).click() time.sleep(1) self.driver.find_element_by_css_selector( "#addSuccessModal > div > div > table > tbody > tr.tr-2 > td > div > a.mybtn.mybtn-inverse" ).click() time.sleep(1) info = self.driver.find_element_by_css_selector( "body > div.brandMonitor-wrap > div > div > div.myPanel-bodyer.brandMonitor-all > div > table > tbody > tr:nth-child(1)" ).text get_screenshort(self.driver, "test_monitor_4.png") print("监控信息" + str(info)) print("信息无误,测试通过!")
def test_try(self): """尝试注册测试""" dl = DengLuPage(self.driver) self.driver.get("https://so.quandashi.com/") dl.refresh() time.sleep(2) brand = unicode() self.driver.find_element_by_name("key").send_keys(brand) self.driver.find_element_by_id("btnSearchkey").click() time.sleep(3) result = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > div.search-top > i" ).text print(result) time.sleep(2) if int(result) == 0: print("亲,未检测到您关注的商标,请换个词试试~ 不过您可以就~{}~提起商标申请哦".format(brand)) wsq = self.driver.find_element_by_css_selector( "#searchList > div.page-form.w-center > div.no-result-category > div.no-result-category-box > a:nth-child(1)" ).text print(str(wsq)) self.driver.find_element_by_css_selector( "#searchList > div.page-form.w-center > div.no-result-category > div.no-result-category-box > a:nth-child(1)" ).click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) print(self.driver.current_url) get_screenshort(self.driver, "test_try.png") else: # 搜索结果 jg = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > div.search-top" ).text print(jg) # 第一个商标信息 jg1 = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-left > ul > li:nth-child(1) > div.result-href > div.brand-info > div > ul" ).text print(str(jg1).replace("\n", " "))
def test_data_2(self): """BIReportName""" dl = DengLuPage(self.driver) dl.login() time.sleep(2) self.driver.find_element_by_link_text("商标大数据").click() windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) self.driver.find_element_by_class_name("md").click() self.driver.find_element_by_css_selector( "#BIShow > div.tabBtn.clearfix > a:nth-child(1)").click() report = ["最新报告", "代理机构排行", "商标申请人排行", "申请类别排行", "申请地区排行", "地理标志"] suiji = random.choice(report) name = self.driver.find_element_by_link_text("{}".format(suiji)).text self.driver.find_element_by_link_text("{}".format(suiji)).click() print(name) time.sleep(2) if suiji == "地理标志": suiji_2 = random.randint(1, 2) else: suiji_2 = random.randint(1, 10) info_2 = self.driver.find_element_by_css_selector( "#BIShow > div.infoListBox > ul > li:nth-child({})".format( suiji_2)).text self.driver.find_element_by_css_selector( "#BIShow > div.infoListBox > ul > li:nth-child({})".format( suiji_2)).click() print(info_2) windows = self.driver.window_handles self.driver.switch_to.window(windows[-1]) time.sleep(2) self.driver.set_window_size(1920, 1080) print("PDF文档链接: " + self.driver.current_url) get_screenshort(self.driver, "test_data_2.png")
def test_hot_trade(self): """热门商标出售测试""" dl = DengLuPage(self.driver) self.driver.get("https://so.quandashi.com/") dl.refresh() time.sleep(2) self.driver.find_element_by_name("key").send_keys("小米") self.driver.find_element_by_id("btnSearchkey").click() time.sleep(5) trade = self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-right > div > ul > li:nth-child(1) > div.hot-brand-detail").text print("热门商标信息:" + str(trade).replace("\n", " ")) self.driver.find_element_by_css_selector( "#searchList > div.page-content.w-center > div.page-content-right > div > ul > li:nth-child(1) > div.hot-brand-detail > a").click() get_screenshort(self.driver, "test_hot_trade.png") print("热门商标信息正常测试通过!")
def test_bq2(self): """版权二级页测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(2) # self.driver.find_element_by_css_selector("body > div.festival-modal-bg > a.close").click() self.driver.find_element_by_css_selector("#section-hotservice > div > dl:nth-child(4) > dt > a.more").click() # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.assertIn("版权登记|版权登记流程|版权变更|版权转让-权大师", self.driver.title) print(self.driver.title) get_screenshort(self.driver,"test_bq2.png")
def test_zl2(self): """专利二级页测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(2) # self.driver.find_element_by_css_selector("body > div.festival-modal-bg > a.close").click() self.driver.find_element_by_css_selector("#section-hotservice > div > dl.body2 > dt > a.more").click() # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.assertIn("专利查询|国家专利查询|专利申请|实用新型专利-权大师", self.driver.title) print(self.driver.title) get_screenshort(self.driver,"test_zl2.png")
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_know(self): """权知道测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(1) self.driver.execute_script("window.scrollBy(0,3500)") # 滑动滚动条 get_screenshort(self.driver,"test.png") time.sleep(2) self.driver.find_element_by_css_selector("#section-news > div > ul > li.col-know > div > a").click() # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.assertIn("商标注册常识_专业的商标业务知识分享平台_权大师", self.driver.title) print(self.driver.title)
def test_perspective(self): """行业透视测试""" dl = DengLuPage(self.driver) dl.login() time.sleep(1) self.driver.execute_script("window.scrollBy(0,3500)") # 滑动滚动条 get_screenshort(self.driver, "test.png") time.sleep(2) self.driver.find_element_by_css_selector("#section-news > div > ul > li:nth-child(1) > div.row2 > a").click() # 获取打开的多个窗口句柄 windows = self.driver.window_handles # 切换到当前最新打开的窗口 self.driver.switch_to.window(windows[-1]) time.sleep(2) self.assertIn("更前沿的商标,专利,版权资讯,更快更准确的把握行业信息_权大师", self.driver.title) print(self.driver.title)