예제 #1
0
    def UploadScreenShot(self, isHD):
        appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI)
        # mainHuaweiAppGalleryApi.DeleteLanuage(appid,"zh-CN")
        # return

        pic = mainResource.GetOutPutCopyRightPathWin32(
            mainResource.GetProjectOutPut(), isHD) + "\\huawei.png"
        mainHuaweiAppGalleryApi.UploadImageCopyRight(appid, pic)
        # return

        idx = 0
        for country in self.listCountry:
            lan = self.listCountryLanguage[idx]
            icon = mainResource.GetOutPutIconPathWin32(
                mainResource.GetProjectOutPut(), Source.TAPTAP,
                isHD) + "\\huawei\\icon_android_216.png"
            mainHuaweiAppGalleryApi.UploadImageIcon(appid, icon, country)
            mainHuaweiAppGalleryApi.StartScreenShot()
            for i in range(0, 5):
                pic = mainResource.GetOutPutScreenshotPathWin32(
                    mainResource.GetProjectOutPut(), Source.TAPTAP,
                    isHD) + "\\" + lan + "\\1080p\\" + str(i + 1) + ".jpg"
                if Platform.isMacSystem():
                    pic = pic.replace("\\", "/")

                if os.path.exists(pic):
                    print(pic)
                    mainHuaweiAppGalleryApi.UploadOneScreenShot(
                        appid, pic, isHD)

            mainHuaweiAppGalleryApi.CommitScreenShot(appid, isHD, country)

            idx += 1
예제 #2
0
    def UpLoadApk(self, isHD):
        webcmd = WebDriverCmd(self.driver)

        self.urlold = self.driver.current_url
        old_window = self.driver.current_window_handle
        print("urlold=", self.urlold)

        # key = "//span[contains(text(),上传APK)]"
        key = "//span[text()='上传APK']"
        item = webcmd.Find(key, True)

        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//span[text()='确 定']"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        # key =  "//div[@class='container--form upload-apk-wrapper old-style']"
        # item = webcmd.Find(key)
        # key = ".//button[@class='btn--edit ant-btn ant-btn-primary']"
        # subitem = webcmd.FindChild(item,key)
        # webcmd.DoCmd(subitem,CmdType.CLICK)

        # # <a data-toggle="modal" data-target=".confirm-upload-apk" class="btn btn-primary">上传APK</a>
        # # item = self.driver.find_element(
        # #     By.XPATH, "//a[@data-target='.confirm-upload-apk']")
        # # # item = self.driver.find_element(By.XPATH, "//a[@data-toggle='modal']")
        # # item.click()
        # time.sleep(2)

        # # <a id="selectfiles" href="javascript:void(0);" class="btn btn-primary" style="position: relative; z-index: 1;">开始上传APK</a>
        # item = self.driver.find_element(By.XPATH, "//a[@id='selectfiles']")
        # item.click()
        # time.sleep(2)

        # 手动点击上传
        # webcmd.WaitKeyBoard("q")
        apk = mainResource.GetOutPutApkPathWin32(
            mainResource.GetProjectOutPut(), Source.TAPTAP, isHD)
        if not os.path.exists(apk):
            apk = mainResource.GetOutPutApkPathWin32(
                mainResource.GetProjectOutPut(), Source.HUAWEI, isHD)

        if Platform.isMacSystem():
            apk = FileUtil.GetLastDirofDir(apk)

        # F:\\sourcecode\\unity\\product\\kidsgame\\ProjectOutPut\\xiehanzi\\hanziyuan\\screenshot\\shu\\cn\\480p\\1.jpg
        self.OpenFileBrowser(apk, True)
        time.sleep(1)

        # 等待文件長傳結束
        key = "//a[@title='基础信息']"
        item = webcmd.Find(key, True)
예제 #3
0
    def UploadScreenShot(self, webcmd, isHD, lan, applan):
        # screenshot
        for i in range(0, 1):
            # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器
            # self.SelectLanguage(webcmd,lan)
            time.sleep(1)

            # 将 滚动条 底部对齐

            # lan_shot = "chs-contents"
            # key = "//div[@id='"+lan_shot+"']"
            # div = self.driver.find_element(By.XPATH, key)
            # if div==None:
            #     print("not find screenshot div")
            #     return

            # 查找子元素
            # 当您启动XPath表达式时//,它会从文档的根目录中搜索,忽略您的父元素。你应该在表达前加上.

            # element2 = driver.find_element_by_xpath("//div[@title='div2']")
            # element2.find_element_by_xpath(".//p[@class='test']").text

            # key = ".//input[@type='file' and @data-target='#screenshots']"
            # item = div.find_element(By.XPATH, key)
            item_root = self.GetItemOfScreenShot(lan)

            key = ".//div[@class='ant-upload-drag-container']"
            item_div = webcmd.FindChild(item_root, key)

            # item = self.driver.find_element(By.XPATH, key)
            # item_div = webcmd.AddCmd2(CmdType.CLICK_Action, key)
            self.SetItemVisible(item_div)
            webcmd.DoCmd(item_div, CmdType.CLICK)

            time.sleep(1)

            pic = mainResource.GetOutPutScreenshotPathWin32(
                mainResource.GetProjectOutPut(), Source.TAPTAP,
                isHD) + "\\" + applan + "\\1080p\\" + str(i + 1) + ".jpg"
            if Platform.isMacSystem():
                # apk = FileUtil.GetLastDirofDir(apk)
                pic = pic.replace("\\", "/")
                pic = FileUtil.GetLastDirofDir(pic)
                test = 0

            flag = os.path.exists(pic)
            if flag:
                print(pic)
                self.OpenFileBrowser(pic, True)
                time.sleep(2)

            # 等待上传完成
            key = ".//span[@class='upload_img']"
            # print(key)
            item = webcmd.FindChild(item_root, key, True)
예제 #4
0
    def UpLoadSignAndroid(self):
        webcmd = WebDriverCmd(self.driver)
        # E:\Users\moon\Downloads

        if Platform.isWindowsSystem():
            downloadDir = "C:\\Users\\moon\\Downloads"

        if Platform.isMacSystem():
            downloadDir = "/Users/moon/Downloads"

        self.DeleteAllDownloadFile(downloadDir, ".apk")

        # 下载空包 E:\Users\moon\Downloads\mssp-verify-b8920a35.apk
        key = "//button[@class='veui-button bottom20']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        time.sleep(3)
        apk_unsign = self.GetDownloadFile(downloadDir, ".apk")
        apk_sign = mainResource.GetProjectOutPut() + "/mssp_baidu/signed.apk"
        FileUtil.CreateDir(FileUtil.GetLastDirofDir(apk_sign))
        jks = mainResource.GetDirProductCommon() + "/Ad/moonma.jks"

        if Platform.isWindowsSystem():

            # sign apk:
            # jarsigner -verbose -keystore ~/sourcecode/mssp_baidu/moonma.jks -signedjar ~/sourcecode/mssp_baidu/signed.apk ~/sourcecode/mssp_baidu/empty.apk moonma -storepass qianlizhiwai
            cmd = "jarsigner -verbose -keystore " + jks + " -signedjar " + apk_sign + " " + apk_unsign + " moonma -storepass qianlizhiwai"

        if Platform.isMacSystem():
            # sign apk:
            # jarsigner -verbose -keystore ~/sourcecode/mssp_baidu/moonma.jks -signedjar ~/sourcecode/mssp_baidu/signed.apk ~/sourcecode/mssp_baidu/empty.apk moonma -storepass qianlizhiwai
            cmd = "jarsigner -verbose -keystore " + jks + " -signedjar " + apk_sign + " " + apk_unsign + " moonma -storepass qianlizhiwai"

        print(cmd)
        os.system(cmd)
        time.sleep(1)

        # sign end

        # 滚动到浏览器顶部
        js_top = "var q=document.documentElement.scrollTop=0"
        # 滚动到浏览器底部
        js_bottom = "var q=document.documentElement.scrollTop=document.documentElement.scrollHeight"
        self.driver.execute_script(js_bottom)
        time.sleep(2)

        # 上传签名包
        # key = "//input[@accept='.apk' and @name='file']"
        key = "//label[@class='veui-button veui-uploader-input-label']"
        item = webcmd.AddCmd(CmdType.CLICK_Action, key)
        # webcmd.SetItemVisible(item)
        webcmd.Run(True)

        self.OpenFileBrowser(apk_sign)
    def UploadScreenShot(self, isHD):
        # isHD = True
        package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD)
        version = mainAppInfo.GetAppVersion(Source.ANDROID, isHD)

        total_screenshot = 5
        idx_country = 0
        idx_display = 0
        for country in self.listCountry:
            idx_display = 0
            for type in self.listDisplay:
                for i in range(total_screenshot):
                    applan = self.listCountryLanguage[idx_country]
                    filepath = mainResource.GetOutPutScreenshot(
                        isHD) + "/" + applan + "/" + self.listDisplayName[
                            idx_display] + "/" + str(i + 1) + ".jpg"
                    if self.listDisplayName[idx_display] == "icon":
                        filepath = mainResource.GetOutPutIconPathWin32(
                            mainResource.GetProjectOutPut(), Source.TAPTAP,
                            isHD) + "\\icon_android_512.png"
                        if i > 0:
                            continue

                    if self.listDisplayName[idx_display] == "adhome":
                        filepath = mainResource.GetOutPutAdPathWin32(
                            mainResource.GetProjectOutPut(), Source.TAPTAP,
                            isHD
                        ) + "\\" + applan + "\\" + "ad_home_1024x500.png"
                        if i > 0:
                            continue

                    print("UploadScreenShot filepath=", filepath)
                    if os.path.exists(filepath):
                        mainGooglePlayApi.DeleteAllScreenShot(
                            package, version, country, type)
                        mainGooglePlayApi.UploadOneScreenShot(
                            package, filepath, country, type)

                idx_display += 1

            idx_country += 1
예제 #6
0
    def Run(self,type): 
        print ("IPABuild type="+type)

        RootDir = mainResource.GetRootProjectIos()
        target = "Unity-iPhone"  
        ipa_file = RootDir + "/app/" + target

        isUploadIPA = False
        isExportIPA = False

        # 清空频道文件
        channel_dir = mainResource.GetRootDirXcode() + "/Data/Raw/channel"
        flag = os.path.exists(channel_dir)
        if flag:
            shutil.rmtree(channel_dir)

        if type == "upload_ipa":
            isUploadIPA = True
            # ipa_file = RootDir + "/app_export_ipa/" + target
            target = "game"
            self.UploadOneIPA(ipa_file + "/" + target + ".ipa")

        if type == "export_ipa":
            isExportIPA = True
            if count > 2:
                channel = sys.argv[2] 
                ipa_file = RootDir + "/app_" + channel + "/" + target

            # 生成频道文件
            os.makedirs(channel_dir)
            fp = open(channel_dir + "/" + channel, "w")
            if fp:
                fp.close()

            
            self.ExportIPA(ipa_file)

        if type == "ipa_build":
            # CopyXcodeProject(False)
            self.BuildIPA(ipa_file)
            self.ExportIPA(ipa_file)
            
                
        if type == "upload_allipa":
            self.UploadAllIPA(mainResource.GetProjectOutPut()+"/IPA")
        
        if type == "CopyXcodeProject":
            self.CopyXcodeProject(True)

        if type == "zip_project":
            self.ZipProject()

        print ("ipa_build sucess")
예제 #7
0
    def UploadIcon(self, webcmd, isHD, lan):
        # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器
        # self.SelectLanguage(webcmd,lan)
        # icon
        # <input type="file" name="image" data-valid-width="512" data-valid-height="512" data-taptap-ajax="upload" data-target="#icon-zh_CN" data-target-input="#icon-input-zh_CN" data-url="https://www.taptap.com/ajax/image">
        # "//input[@type='file' and @data-target='#icon-zh_CN']"
        key = "//div[@id='submitApp_translations.zh_CN.icon']"
        if lan == self.LAN_KEY_EN:
            key = "//div[@id='submitApp_translations.en_US.icon']"

            # key ="//img[@id='icon-" +   lanKeys[lan]+"']"
            # key = "//input[@type='file' and  @name='image']"
            # key = "//span[@class='fileinput-button fixed-size square icon']"

            # "//input[@name='anti_addiction_read']"
        print(key)
        item_root = webcmd.Find(key)

        key = ".//div[@class='ant-upload-drag-container']"
        item_div = webcmd.FindChild(item_root, key)

        # item = self.driver.find_element(By.XPATH, key)
        # item_div = webcmd.AddCmd2(CmdType.CLICK_Action, key)
        self.SetItemVisible(item_div)
        webcmd.DoCmd(item_div, CmdType.CLICK)
        # webcmd.Run(True)
        # self.driver.execute_script("arguments[0].click();", item)
        time.sleep(2)

        icon = mainResource.GetOutPutIconPathWin32(
            mainResource.GetProjectOutPut(), Source.TAPTAP,
            isHD) + "\\icon_android_512.png"
        print(icon)
        if Platform.isMacSystem():
            icon = icon.replace("\\", "/")
            icon = FileUtil.GetLastDirofDir(icon)
            test = 0

            # webcmd.Run(True)
        self.OpenFileBrowser(icon, True)
        time.sleep(1)

        # 等待上传完成
        key = ".//span[@class='upload_img']"
        # print(key)
        item = webcmd.FindChild(item_div, key, True)
예제 #8
0
    def UpdateApk(self, isHD):
        webcmd = WebDriverCmd(self.driver)

        # 滚动到浏览器顶部
        js_top = "var q=document.documentElement.scrollTop=0"
        # 滚动到浏览器底部
        js_bottom = "var q=document.documentElement.scrollTop=document.documentElement.scrollHeight"
        self.driver.execute_script(js_top)
        time.sleep(2)

        # key = "//iframe[@id='mainIframeView']"
        # if self.IsElementExist(key)==True:
        #     self.driver.switch_to.frame("mainIframeView")
        # time.sleep(1)

        # 软件包管理
        # time.sleep(1)
        # info = CmdInfo()
        # info.type = CmdType.CLICK_SCRIPT
        # info.cmd = "//a[@id='VerInfoDownloadLink']"
        # info.value = ""
        # info.delay = 1
        # info.isWaiting = True
        # item = webcmd.AddCmdInfo(info)
        # self.SetItemVisible(item)
        key = "//a[@id='VerInfoDownloadLink']"
        item = webcmd.Find(key, True)
        self.SetItemVisible(item)

        webcmd.AddCmdWait(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        webcmd.AddCmd(CmdType.CLICK_SCRIPT,
                      "//a[@id='ManageAppUploadPackageButton']")
        webcmd.Run(True)

        # <a class="agc-button-primary agc-button-normal ng-binding" ng-click="uploadPkg()" ng-show="!notAllowedUploadPkg" target="_blank">上传</a>
        # 第一次上传
        key = "//a[@ng-show='!notAllowedUploadPkg' and contains(text(),'上传')]"
        if self.IsElementExist(key):
            webcmd.AddCmd(CmdType.CLICK_SCRIPT, key)
            webcmd.Run(True)

        webcmd.AddCmd(CmdType.CLICK_Action,
                      "//div[@id='uploaderSelectContainer']")
        webcmd.Run(True)

        time.sleep(2)
        apk = mainResource.GetOutPutApkPathWin32(
            mainResource.GetProjectOutPut(), Source.HUAWEI, isHD)
        print(apk)
        self.OpenFileBrowser(apk, True)
        time.sleep(1)

        # <div class="uploader-progress-bar" ng-style="{width: uploadProgress}"></div>

        # # <div class="progress"><div class="progress-bar" style="width: 82%;" aria-valuenow="82"></div></div>
        # 等待上传完成
        isUploading = False
        while True:
            time.sleep(1)
            key = "//div[@class='uploader-progress-bar']"
            if self.IsElementExist(key):
                item = self.driver.find_element(By.XPATH, key)
                if item is not None:
                    style = item.get_attribute('style')
                    isUploading = True
                    print(style)
                    # if style.find("100") >=0:
                    #     time.sleep(1)
                    #     print("upload apk finish")
                    #     break
            else:
                if isUploading == True:
                    isUploading = False
                    time.sleep(1)
                    print("upload apk finish")
                    break

        time.sleep(1)
예제 #9
0
    def PreSubmitApp(self, isHD):

        appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI)
        url = "https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/myApp/" + appid
        print(url)
        self.driver.get(url)
        time.sleep(3)
        old_window = self.driver.current_window_handle

        webcmd = WebDriverCmd(self.driver)
        # 准备提交
        key = "//span[@class='yellow-circle']"
        webcmd.AddCmdWait(CmdType.CLICK, key)
        webcmd.Run(True)

        # 跳转到新的页面
        print("self.driver.current_url=", self.driver.current_url)
        # self.driver.switch_to.window(self.driver.window_handles[0])
        for win in self.driver.window_handles:
            if win != old_window:
                self.driver.switch_to.window(win)
        time.sleep(1)
        print("self.driver.current_url 2=", self.driver.current_url)

        # 等待网页加载成功
        # key = "//iframe[@id='mainIframeView']"
        # while True:
        #     time.sleep(1)
        #     print("web is loading...")
        #     if self.IsElementExist(key) == True:
        #         print("web loading finish")
        #         break

        # self.driver.switch_to.frame("mainIframeView")
        # time.sleep(3)
        self.Switch2MainFrameView()

        # # 管理国家
        # key = "//a[@id='VerInfoManageCountryButton']"
        # webcmd.AddCmd(CmdType.CLICK, key)
        # webcmd.Run(True)

        # # 全球
        # key = "//span[@id='CountryCheckMarkGlobal']"
        # webcmd.AddCmd(CmdType.CLICK, key)
        # webcmd.Run(True)

        # self.UpdateApk(isHD)

        # 分级
        # key = "//a[@class='agc-button-primary agc-button-normal version-info-rate ml-0 ng-binding' and contains(text(),'分级')]"
        key = "//a[contains(text(),'分级')]"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)
        time.sleep(3)

        # 分级勾选
        key = "//div[@class='rate-dialog-content']"
        # div =  self.driver.find_element(By.XPATH, key)
        key = "//label[@class='radio rate-dialog-huaweiRating']"
        webcmd.AddCmd(CmdType.CLICK, key)

        # 分级确认
        key = "//a[@id='submit']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        # copyright
        key = "//img[@id='AppInfoUploadCertificateURLs1']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)
        apk = mainResource.GetOutPutCopyRightPathWin32(
            mainResource.GetProjectOutPut(), isHD) + "\\huawei.png"
        print(apk)
        flag = os.path.exists(apk)
        if flag:
            self.OpenFileBrowser(apk, True)
            time.sleep(2)

        # 隐私政策网址
        key = "//input[@id='VerInfoPrivacyPolicyInputBox']"
        webcmd.AddCmd(CmdType.INPUT, key, self.GetPrivacy(isHD))
        webcmd.Run(True)

        # <span class="text ng-binding">审核通过立即上架</span>
        key = "//span[@class='text ng-binding' and contains(text(),'审核通过立即上架')]"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        # 保存
        key = "//a[@id='VerInfoSaveButton']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)
        time.sleep(2)

        # 确定 保存
        # <a class="btn btn-primary btn-small ng-binding" data-dismiss="dialog" ng-click="callback()">确定</a>
        key = "//a[@class='btn btn-primary btn-small ng-binding' and contains(text(),'确定')]"
        if self.IsElementExist(key):
            webcmd.AddCmd(CmdType.CLICK, key)
            webcmd.Run(True)
            self.UpdateApk(isHD)
            self.SubmitApp(isHD)
예제 #10
0
    def FillLanguage(self, webcmd, isHD, lanName, lanKey):

        # 选择语言
        # webcmd.AddCmd(CmdType.CLICK, "//input[@type='search' and @aria-owns='ui-select-choices-3']", "", 1)
        item = webcmd.AddCmd(
            CmdType.CLICK, "//span[@class='ui-select-match-text pull-left']",
            "", 2)
        self.SetItemVisible(item)
        webcmd.Run(True)

        # 简体中文-默认
        if lanName == self.defaultLanguage:
            lanName = lanName + "-默认"

        key = "//div[@class='ucd-droplist-option ng-binding' and text()='" + \
            lanName+"']"
        # key = "//div[@class='ucd-droplist-option ng-binding' and text()='"+lanName+"-默认"+"']"
        # if self.IsElementExist(key)==False:
        #     key = "//div[@class='ucd-droplist-option ng-binding' and text()='"+lanName+"']"

        # 模糊匹配
        # key = "//div[@class='ucd-droplist-option ng-binding' and contains(text(),'"+lanName+"')]"

        item = webcmd.AddCmd(CmdType.CLICK, key, "", 1)
        if item == None:
            print(key)
        else:
            self.SetItemVisible(item)

        webcmd.Run(True)

        title = self.GetAppName(isHD, lanKey)
        print(title)
        pyperclip.copy(title)
        key = "//input[@id='AppInfoAppNameInputBox']"
        webcmd.AddCmd2(CmdType.INPUT_CLEAR, key)
        # webcmd.AddCmd(CmdType.ENTER, "//input[@id='AppInfoAppNameInputBox']",title,1)
        pyperclip.paste()

        webcmd.AddCmd2(CmdType.CTR_V, key)
        webcmd.Run(True)

        title = self.GetAppDetail(isHD, lanKey)
        pyperclip.copy(title)
        key = "//textarea[@id='AppInfoAppIntroduceInputBox']"
        # webcmd.AddCmd(CmdType.CLICK, key,title,1)
        pyperclip.paste()
        webcmd.AddCmd2(CmdType.INPUT_CLEAR, key)
        webcmd.AddCmd2(CmdType.CTR_V, key)
        # webcmd.AddCmd(CmdType.INPUT, "//textarea[@id='AppInfoAppIntroduceInputBox']",title,2)
        webcmd.Run(True)
        time.sleep(2)

        title = self.GetAppPromotion(isHD, lanKey)
        print(title)
        pyperclip.copy(title)
        key = "//input[@id='AppInfoAppBriefInputBox']"
        item = self.driver.find_element(By.XPATH, key)

        ActionChains(self.driver).move_to_element(item).perform()
        time.sleep(1)
        # webcmd.AddCmd(CmdType.ENTER, "//input[@id='AppInfoAppBriefInputBox']",title,1)
        pyperclip.paste()
        # webcmd.AddCmd2(CmdType.INPUT_CLEAR, key)
        webcmd.AddCmd2(CmdType.CLICK, key)
        webcmd.AddCmd2(CmdType.INPUT_CLEAR, key)
        # 必须enter选中
        webcmd.AddCmd2(CmdType.ENTER, key)
        webcmd.AddCmd2(CmdType.CTR_V, key)
        webcmd.Run(True)
        time.sleep(2)

        # icon
        key = "//img[@id='AppInfoAppIconAddButton']"
        item = self.driver.find_element(By.XPATH, key)
        ActionChains(self.driver).move_to_element(item).perform()
        time.sleep(2)
        # webcmd.AddCmd2(CmdType.ENTER, key)
        # webcmd.AddCmd(CmdType.CLICK, key, "", 2)
        item.click()

        icon = mainResource.GetOutPutIconPathWin32(
            mainResource.GetProjectOutPut(), Source.TAPTAP,
            isHD) + "\\huawei\\icon_android_216.png"
        print(icon)
        # webcmd.Run(True)
        time.sleep(2)
        self.OpenFileBrowser(icon, True)
        time.sleep(2)

        #    <span class="text ng-binding">横向截图</span>
        idx_start = 6
        strkey = "竖向截图"
        if isHD:
            idx_start = 1
            strkey = "横向截图"

        key = "//span[@class='text ng-binding' and text()='" + strkey + "']"
        item = webcmd.AddCmd(CmdType.CLICK, key)
        self.SetItemVisible(item)
        webcmd.Run(True)

        for i in range(0, 5):
            key = "//img[@id='AppIntroScreenshot" + str(i + idx_start) + "']"
            item = self.driver.find_element(By.XPATH, key)

            if i >= 2:
                # 将 滚动条 底部对齐
                self.driver.execute_script(
                    "arguments[0].scrollIntoView(false);", item)
                time.sleep(2)
            # 鼠标悬停
            ActionChains(self.driver).move_to_element(item).perform()
            time.sleep(2)
            # webcmd.AddCmd(CmdType.CLICK, key, "", 2)
            item.click()
            time.sleep(2)
            # webcmd.AddCmd2(CmdType.ENTER, key)
            pic = mainResource.GetOutPutScreenshotPathWin32(
                mainResource.GetProjectOutPut(), Source.TAPTAP,
                isHD) + "\\" + lanKey + "\\1080p\\" + str(i + 1) + ".jpg"
            print(pic)
            # webcmd.Run(True)
            self.OpenFileBrowser(pic, True)
            time.sleep(2)
예제 #11
0
    def UploadAdHome(self, webcmd, isHD, lan, applan):
        # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器
        # self.SelectLanguage(webcmd,lan)
        # adhome
        # self.SelectLanguage(webcmd,lan)
        # self.driver.switch_to.window(self.driver.window_handles[0])

        key = "//div[@id='submitApp_translations.zh_CN.banner_4.android.developer.img']"
        if lan == self.LAN_KEY_EN:
            key = "//div[@id='submitApp_translations.en_US.banner_4.android.developer.img']"

        print(key)

        item_root = webcmd.Find(key)

        key = ".//div[@class='ant-upload-drag-container']"
        item_div = webcmd.FindChild(item_root, key)

        # item = self.driver.find_element(By.XPATH, key)
        # item_div = webcmd.AddCmd2(CmdType.CLICK_Action, key)
        self.SetItemVisible(item_div)
        webcmd.DoCmd(item_div, CmdType.CLICK)
        time.sleep(1)

        pic = mainResource.GetOutPutAdPathWin32(
            mainResource.GetProjectOutPut(), Source.TAPTAP,
            isHD) + "\\" + applan + "\\" + "ad_home_1920x1080.png"
        # pic = mainResource.GetOutPutScreenshotPathWin32(mainResource.GetProjectOutPut(), Source.TAPTAP, True) + "\\"+applan+"\\1080p\\"+"1.jpg"
        pic = os.path.normpath(pic)
        print(pic)
        if Platform.isMacSystem():
            pic = pic.replace("\\", "/")
            pic = FileUtil.GetLastDirofDir(pic)
            test = 0

        self.OpenFileBrowser(pic, True)
        time.sleep(1)

        # 等待上传完成
        key = ".//span[@class='upload_img']"
        # print(key)
        item = webcmd.FindChild(item_div, key, True)

        # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器
        # self.SelectLanguage(webcmd,lan)
        key = "//div[@id='submitApp_translations.zh_CN.banner_4.ios.developer.img']"
        if lan == self.LAN_KEY_EN:
            key = "//div[@id='submitApp_translations.en_US.banner_4.ios.developer.img']"

        item_root = webcmd.Find(key)

        key = ".//div[@class='ant-upload-drag-container']"
        item_div = webcmd.FindChild(item_root, key)
        self.SetItemVisible(item_div)
        webcmd.DoCmd(item_div, CmdType.CLICK)
        time.sleep(1)

        # print(pic)
        self.OpenFileBrowser(pic, True)
        time.sleep(1)

        # 等待上传完成
        key = ".//span[@class='upload_img']"
        # print(key)
        item = webcmd.FindChild(item_div, key, True)