def test_02checkPagination(self,platform,browserName,version,length,width): result=0 filename = "test_02checkPagination_" + platform + browserName + length + width + ".png" desired_capabilities = {"platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } driver = webdriver.Remote(command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) # print("browersName:"+str(browserName)+" version:"+self.driver.capabilities['version']) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username,self.password) #勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) #翻页 flag=dp.pagiation() if(flag==0): result=0 time.sleep(2) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) self.logger.printlog("视频和语气结果匹配") print("视频和语气结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_02checkPagination fail"
def test_02checkPagination(self, platform, browserName, version, length, width): result_pag = 0 filename = "test_02checkPagination_" + platform + browserName + length + width + ".png" desired_capabilities = { "platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } try: driver = webdriver.Remote( command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) # print("browersName:"+str(browserName)+" version:"+self.driver.capabilities['version']) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) #勾选All dp.checkAll("check") print("check All") self.logger.printlog("check All") time.sleep(1) # 去掉勾选Sort and Favorite dp.checkDynamicSorting("uncheck") time.sleep(1) dp.checkFavorite('uncheck') time.sleep(1) #翻页 flag = dp.pagiation() if (flag == 0): result_pag = 0 else: result_pag = 1 time.sleep(3) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size # result = dp.checkVideoSize(self.expected_vsize) # if(result==1): # self.logger.printlog("视频和预期结果匹配") # print("视频和预期结果匹配") except Exception as e: print("Reason:", e) finally: dp.quit_page() self.assertEqual(result_pag, 1), "test_02checkPagination fail"
def test_02checkPagination(self,platformName,browserName,deviceName,udid): filename = "test_02checkPagination" + deviceName + ".png" # self.logger.printlog("test_01mobile") desired_capabilities = {"platformName": platformName, "browserName": browserName, "platformVersion": "12.1.0", "deviceName": deviceName, "automationName": "XCUITest", "udid": udid, "useNewWDA": True } driver = wd.Remote(command_executor="http://10.12.128.233:4444/wd/hub", desired_capabilities=desired_capabilities) # print("browersName:"+str(browserName)+" version:"+self.driver.capabilities['version']) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 翻页 flag = dp.pagiation() if (flag == 0): result = 0 print("翻页找不到页码") else: time.sleep(2) driver.get_screenshot_as_file(self.path + filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) self.logger.printlog("视频和语气结果匹配") print("视频和语气结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_02checkPagination fail"
def test_02checkPagination(self, deviceName): result = 0 filename = "test_02checkPagination_" + deviceName + ".png" mobile_emulation = {"deviceName": deviceName} chrome_options = webdriver.ChromeOptions() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) # prefs = {"profile.managed_default_content_settings.images": 2} # chrome_options.add_experimental_option("prefs", prefs) # chrome_options.add_argument('blink-settings=imagesEnabled=false') driver = webdriver.Chrome( executable_path= "D:\\Python36\\chromedriver_win32\\chromedriver.exe", desired_capabilities=chrome_options.to_capabilities()) # print("browersName:"+str(browserName)+" version:"+self.driver.capabilities['version']) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 翻页 flag = dp.pagiation() if (flag == 0): result = 0 time.sleep(2) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) self.logger.printlog("视频和语气结果匹配") print("视频和语气结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_02checkPagination fail"