def RunDownloadSigniOS(self): # self.Init() # self.LoginAppleDeveloper("*****@*****.**","Moonqianlizhiwai1") # self.PreDownloadSigniOS(False) # self.PreDownloadSigniOS(True) appid = mainAppInfo.GetAppId(False, Source.APPSTORE) mainAppConnectApi.GetAppProfile( mainAppInfo.GetAppPackage(Source.IOS, False), appid) appid = mainAppInfo.GetAppId(True, Source.APPSTORE) mainAppConnectApi.GetAppProfile( mainAppInfo.GetAppPackage(Source.IOS, True), appid)
def BuildProject(self, isHD, channel): name = self.GetProjectName(channel) dirproject = mainResource.GetRootCocosBuildOutput() + "/" + name appid = mainAppInfo.GetAppId(isHD, channel) if name == Source.ProjectNameMiniGameWeixin or name == Source.ProjectNameMiniGameByte: filepath = mainResource.GetProjectConfigDefault( ) + "/" + name + "/game.json" strfile = FileUtil.GetFileString(filepath) strfile = strfile.replace("_Orientation_", "portrait") filepath = dirproject + "/game.json" FileUtil.RemoveFile(filepath) FileUtil.SaveString2File(strfile, filepath) filepath = mainResource.GetProjectConfigDefault( ) + "/" + name + "/project.config.json" strfile = FileUtil.GetFileString(filepath) print("BuildWeixin appid=" + appid) # wx3e44af039aee1b96 strfile = strfile.replace("_APPID_", appid) # print("BuildWeixin strfile="+strfile) filepath = dirproject + "/project.config.json" FileUtil.RemoveFile(filepath) FileUtil.SaveString2File(strfile, filepath) # python 里无法直接执行cd目录,要用chdir改变当前的工作目录 if os.path.exists(dirproject): os.chdir(dirproject) print("dirproject:" + dirproject) if name == Source.ProjectNameMiniGameVivo: os.system("npm install") os.system("npm run build")
def FillAppPrice(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) webcmd = WebDriverCmd(self.driver) # 价格与销售范围 # <li class=" sc-EHOje tb-nav-active jvzENE"><a href="/apps/1552686772/appstore/pricing" class="tb-nav-active" aria-current="page">价格与销售范围</a></li> # key = "//a[text()='价格与销售范围']" # webcmd.AddCmd(CmdType.CLICK, key) # webcmd.Run(True) url = "https://appstoreconnect.apple.com/apps/" + appid + "/appstore/pricing" self.driver.get(url) time.sleep(2) # <select><option value="-1" disabled="">选取</option><option value="0">CNY 0.00 (免费)</option key = "//select" # key = "//option[text()='选取']" webcmd.AddCmdWait(CmdType.CLICK, key) webcmd.Run(True) key = "//option[contains(text(),'CNY 0.00')]" webcmd.AddCmdWait(CmdType.CLICK, key) webcmd.Run(True) # # <div class="buttons___1H5xc" id="heading-buttons"><button class="tb-btn--disabled sc-bwzfXH tb-btn--primary uTxCW" type="primary">存储</button></div> key = "//button[text()='存储']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(3)
def FillAppInfo2(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) webcmd = WebDriverCmd(self.driver) # <li class=" sc-EHOje tb-nav-active jvzENE"><a href="/apps/1552686772/appstore/info" class="tb-nav-active" aria-current="page">App 信息</a></li> # key = "//a[text()='App 信息']" # webcmd.AddCmd(CmdType.CLICK, key) # webcmd.Run(True) url = "https://appstoreconnect.apple.com/apps/" + appid + "/appstore/info" self.driver.get(url) time.sleep(2) # 内容版权 # <button class="inline___3EHpT btn-link___7P55x" data-state="" type="button">编辑</button> key = "//button[text()='设置内容版权信息']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) # <label for="contentRights_no">不,它不包含、显示或访问第三方内容</label> key = "//label[@for='contentRights_no']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) # <button class="sc-bwzfXH tb-btn--disabled uTxCW" type="disabled">完成</button> key = "//button[text()='完成']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) # <div class="buttons___1H5xc" id="heading-buttons"><button class="sc-bwzfXH tb-btn--disabled uTxCW" type="disabled">存储</button></div> key = "//button[text()='存储']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True)
def GoHome(self, isHD, login): # self.AddCookie(self.fileCookie) # self.driver.get("https://www.taptap.com/developer") # self.driver.get("https://www.taptap.com/developer/dashboard/14628/apps") # app # https://www.taptap.com/developer/dashboard/14628?app_id=56016 # https://www.taptap.com/developer/dashboard/14628/apps appid = mainAppInfo.GetAppId(isHD, Source.TAPTAP) print("GoHome appid=", appid, " isHD=" + str(isHD)) # url = "https://www.taptap.com/developer/dashboard/14628?app_id="+appid url = "https://www.taptap.com/developer/dashboard/14628/apps" # print(url) self.driver.get(url) # self.AddCookie() # time.sleep(1) # self.AddCookie() # self.driver.get(url) # return if login == True: # <div class="icon-font ic_qq"></div> # 跳转qq登录 item = self.driver.find_element(By.XPATH, "//div[@class='icon-font ic_qq']") item.click() time.sleep(1)
def DeleteAllScreenShot(self, isHD): print("DeleteAllScreenShot isHD=", isHD) if not Platform.isWindowsSystem(): mainUpdateAppstore.DeleteAllScreenshots(isHD) self.UpdateAppInfo(isHD) return # isHD = True appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) version = mainAppInfo.GetAppVersion(Source.IOS, isHD) total_screenshot = 5 idx_country = 0 idx_display = 0 for country in self.listCountry: idx_display = 0 for type in self.listDisplay: try: mainAppConnectApi.DeleteAllScreenShot( appid, version, country, type) except Exception as e: print("DeleteAllScreenShot eror=", e) idx_display += 1 idx_country += 1
def SubmitAppByWeb(self, isHD): self.Init() self.GoHome(isHD) appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) url = "https://appstoreconnect.apple.com/apps/" + appid + "/appstore/ios/version/inflight" self.driver.get(url) time.sleep(2)
def FillAppPrivacy(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) webcmd = WebDriverCmd(self.driver) # key = "//a[text()='App 隐私']" # webcmd.AddCmd(CmdType.CLICK, key) # webcmd.Run(True) url = "https://appstoreconnect.apple.com/apps/" + appid + "/appstore/privacy" self.driver.get(url) time.sleep(2) # try: # <button class="sc-bwzfXH tb-btn--primary uTxCW" type="primary">开始</button> key = "//button[text()='开始']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) # <label for="collectData_no"><span><strong>否</strong>,我们不会从此 App 中收集数据</span></label> key = "//label[@for='collectData_no']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) # <button class="sc-bwzfXH tb-btn--primary uTxCW" type="primary" data-id="mainbutton">存储</button> key = "//button[text()='存储']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(2) # <div class="buttons___1H5xc" id="heading-buttons"><button class="sc-bwzfXH tb-btn--disabled uTxCW" type="disabled">发布</button></div> key = "//button[text()='发布']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(2) key = "//button[text()='发布']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True)
def UpdateAppInfo(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) defaultLang = "en-US" policyUrl = self.GetPrivacy(isHD) mainHuaweiAppGalleryApi.UpdateAppBaseInfo(appid, defaultLang, policyUrl) idx = 0 for country in self.listCountry: lan = self.listCountryLanguage[idx] title = mainAppInfo.GetAppName(Source.ANDROID, isHD, lan) detail = mainAppInfo.GetAppDetail(isHD, lan) shortDetail = mainAppInfo.GetAppPromotion(isHD, lan) whatsNew = mainAppInfo.GetAppUpdate(isHD, lan) mainHuaweiAppGalleryApi.UpdateAppInfo(appid, country, title, detail, shortDetail, whatsNew) # subtitle= mainAppInfo.GetAppSubtitle(isHD,lan) # # policyText ="" # keywords = mainAppInfo.GetAso(isHD,Source.APPSTORE,lan) # marketingUrl = mainAppInfo.GetAppSoftwareUrl(isHD) # promotionalText = mainAppInfo.GetAppPromotion(isHD, lan) # supportUrl = mainAppInfo.GetAppSupportUrl(isHD) idx += 1
def GenerateProject(self, isHD, channel): name = self.GetProjectName(channel) # cloudres # output dir = mainResource.GetRootCocosBuildOutput() + "/" + name FileUtil.RemoveDir(dir) # 0f6 2f1 UNITYPATH = "" if Platform.isWindowsSystem(): # UNITYPATH="E:/Unity/"+Source.UNITY_VERSION_WIN+"/Editor/Unity.exe" UNITYPATH = "CocosCreator.exe" else: # UNITYPATH="/Applications/Unity/Hub/Editor/"+Source.UNITY_VERSION_MAC+"/Unity.app/Contents/MacOS/Unity" UNITYPATH = "/Applications/CocosCreator/Creator/" + Source.Cocos_Version + "/CocosCreator.app/Contents/MacOS/CocosCreator" # --project projectPath--build "platform=web-desktop;debug=true" appid = mainAppInfo.GetAppId(isHD, channel) PROJECT_PATH = mainResource.GetRootProjectUnity() # cmd = UNITYPATH+" --project "+ PROJECT_PATH+" --build "+ "\"platform=wechatgame;debug=false\"" # package = "packages: { wechatgame: {appid: '*****',}}" package = "packages: { wechatgame: {appid: '" + appid + "',}}" # cmd = UNITYPATH+" --project "+ PROJECT_PATH+" --build "+ "\"platform="+name+";debug=false;packages="+package+"\"" cmd = UNITYPATH + " --project " + PROJECT_PATH + " --build " + "\"platform=" + name + ";debug=false" + "\"" print("BuildWeixin cmd=" + cmd) # ps = subprocess.Popen(cmd) # ps.wait()#让程序阻塞 os.system(cmd) print("BuildWeixin end")
def SubmitApp(self, isHD): self.SubmitAppByWeb(isHD) return appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) mainAppConnectApi.SubmitApp(appid, package)
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
def UploadScreenShot(self, isHD): self.UpdateAppInfo(isHD) appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) # isHD = True version = mainAppInfo.GetAppVersion(Source.IOS, isHD) total_screenshot = 5 idx_country = 0 idx_display = 0 for country in self.listCountryScreentShot: idx_display = 0 for type in self.listDisplay: # try: # mainAppConnectApi.DeleteAllScreenShot(appid, version, country, type) # except Exception as e: # print("DeleteAllScreenShot eror=",e) for i in range(total_screenshot): filepath = mainResource.GetOutPutScreenshot( isHD) + "/" + self.listCountryLanguage[ idx_country] + "/" + self.listDisplayName[ idx_display] + "/" + str(i + 1) + ".jpg" print("UploadScreenShot filepath=", filepath) if os.path.exists(filepath): mainAppConnectApi.UploadScreenShot( appid, version, country, type, filepath) idx_display += 1 idx_country += 1
def GoHome(self, isHD): # self.AddCookie(self.fileCookie) appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) url = "https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/myApp" print(url) self.driver.get(url) self.urlold = self.driver.current_url time.sleep(3)
def CreateBundleID(self, isHD): print("CreateBundleID enter=") # isHD = True appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) # package = "com.moonma.fillfood.pad2" print("CreateBundleID package=", package, " appid=", appid) mainAppConnectApi.CreateBundleID(package)
def UpdateApp(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.TAPTAP) # dir = self.rootDirProjectOutPut if appid == "0": self.SearchApp(isHD) time.sleep(1) self.GoToAPPPage(isHD) # print("UpdateApp appid=",appid," isHD="+isHD) # https://www.taptap.com/developer/app-update/56016/14628 time.sleep(2) old_window = self.driver.current_window_handle # key = "//a[@data-taptap-btn='updateAppData']" # if self.IsElementExist(key): # item = self.driver.find_element(By.XPATH, key) # item.click() # time.sleep(2) # else: # print("updateAppData button not find ") # print("updateAppData current_url=", self.driver.current_url) # self.UpdateApp(isHD) # 跳转到新的页面 # 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) webcmd = WebDriverCmd(self.driver) key = "//span[text()='更新游戏']" item = webcmd.Find(key, True) webcmd.DoCmd(item, CmdType.CLICK) self.UpLoadApk(isHD) # https://www.taptap.com/developer/fill-form/14628?apk_id=496448&app_id=56016 self.SubmitApp(True)
def UpdateAppInfo(self, isHD, isUpdateName=True): if not Platform.isWindowsSystem(): # self.UpdateAppstore(isHD) self.UpdateIAPInfo(isHD) appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) version = mainAppInfo.GetAppVersion(Source.IOS, isHD) idx = 0 print("UpdateAppInfo 1 appid=" + appid + " isHD=" + str(isHD)) for country in self.listCountry: lan = self.listCountryLanguage[idx] name = mainAppInfo.GetAppName(Source.IOS, isHD, lan) subtitle = mainAppInfo.GetAppSubtitle(isHD, lan) # policyUrl= mainAppInfo.GetAppPrivacyUrl(isHD) policyUrl = mainAppStoreAcount.GetPrivacy( Source.APPSTORE, mainAppInfo.GetAppStoreAcount(isHD, Source.APPSTORE)) policyText = "" description = mainAppInfo.GetAppDetail(isHD, lan) keywords = mainAppInfo.GetAso(isHD, Source.APPSTORE, lan) marketingUrl = mainAppInfo.GetAppSoftwareUrl(isHD) promotionalText = mainAppInfo.GetAppPromotion(isHD, lan) supportUrl = mainAppInfo.GetAppSupportUrl(isHD) whatsNew = mainAppInfo.GetAppUpdate(isHD, lan) print("UpdateAppInfo whatsNew=" + whatsNew + " lan=" + lan) mainAppConnectApi.UpdateAppInfo(appid, version, country, description, keywords, marketingUrl, promotionalText, supportUrl, whatsNew) if isUpdateName: try: test = 0 mainAppConnectApi.UpdateAppName(appid, version, country, name, policyText, policyUrl, subtitle) except Exception as e: print("UpdateAppName eror=", e) idx += 1
def DeleteAllLanguage(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) for country in self.listCountry: mainHuaweiAppGalleryApi.DeleteLanuage(appid, country)
def UpdateApkApi(self, isHD): package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) apk = mainResource.GetOutPutApkPath(Source.HUAWEI, isHD) appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) mainHuaweiAppGalleryApi.UploadApk(appid, apk)
def UpdateApp(self, isHD): # self.UpdateAppOld(isHD) # return old_window = self.driver.current_window_handle webcmd = WebDriverCmd(self.driver) # 打开新标签 # self.driver.find_element_by_xpath('//body').send_keys(Keys.CONTROL,"t") # js = "window.open('')" # self.driver.execute_script(js) # time.sleep(2) appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) # https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/myApp/101054959 url = "https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/myApp/" + appid self.driver.get(url) time.sleep(1) # 等待网页加载成功 # 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 = "//span[@title='版本信息']" if self.IsElementExist(key) == False: print("find 版本信息 fail key=", key) self.UpdateApp(isHD) key = "//span[@class='green-circle']" # red-circle if self.IsElementExist(key) == False: print("key fail key=", key) # 待修改 key = "//span[@class='red-circle']" if self.IsElementExist(key) == False: key = "//span[@class='yellow-circle']" # 第一次上传apk # self.PreSubmitApp(isHD) # return if self.IsElementExist(key) == False: print("key fail key2=", key) print("self.driver.current_url fail=", self.driver.current_url) # print(self.driver.page_source) mainResource.saveString2File(self.driver.page_source, "1.html") webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(5) # 跳转到新的页面 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(3) print("self.driver.current_url 2=", self.driver.current_url) # self.driver.switch_to.frame("mainIframeView") self.Switch2MainFrameView() old_window = self.driver.current_window_handle # 升级按钮 key = "//a[@id='VersionUpgradeButton']" if self.IsElementExist(key): webcmd.AddCmd(CmdType.CLICK_Action, key) webcmd.Run(True) time.sleep(2) # 跳转到新的页面 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(3) print("self.driver.current_url 2=", self.driver.current_url) # self.driver.switch_to.frame("mainIframeView") # time.sleep(3) self.Switch2MainFrameView() self.UpdateApk(isHD) time.sleep(1) self.SubmitApp(isHD)
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)
def Run(self, type, isHD): name = mainAppInfo.GetAppStoreAcount(isHD, Source.HUAWEI) mainHuaweiAppGalleryApi.ClientId = mainAppStoreAcount.GetClientId( Source.HUAWEI, name) mainHuaweiAppGalleryApi.ClientSecret = mainAppStoreAcount.GetClientSecret( Source.HUAWEI, name) print(" mainHuaweiAppGalleryApi.ClientId =", mainHuaweiAppGalleryApi.ClientId, "name=", name) if type == "createapp": appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) if appid == "0": self.Init() self.GoHome(isHD) # self.Login("*****@*****.**", "Qianlizhiwai1") name = mainAppInfo.GetAppStoreAcount(isHD, Source.HUAWEI) self.Login(name, mainAppStoreAcount.GetPassword(Source.HUAWEI, name)) # # self.SaveCookie(self.fileCookie) if isHD: self.CreateApp(isHD) else: self.CreateApp(False) time.sleep(3) self.ShowWebHome() self.CreateApp(True) # if type == "update": # # if isHD: # # self.UpdateApp(True) # # else: # # self.UpdateApp(False) # # time.sleep(3) # # ad.UpdateApp(True) if type == "UploadScreenShot": if isHD: self.UploadScreenShot(True) else: self.UploadScreenShot(False) time.sleep(3) # ad.UpdateApp(True) if type == "UpdateAppInfo": self.UpdateAppInfo(False) self.UpdateAppInfo(True) if type == "DeleteAllLanguage": self.DeleteAllLanguage(isHD) if type == "UpdateApk": if isHD: self.UpdateApkApi(True) else: self.UpdateApkApi(False) time.sleep(3) # ad.UpdateApp(True) # ad.Quit(300) if type == "UpdateVersion": if isHD: self.UpdateApkApi(True) else: self.UpdateApkApi(False) time.sleep(3) self.SubmitAppApi(isHD) print("AppStoreHuawei sucess")
def DownloadProfile(self, isHD): # isHD = True appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) print("DownloadProfile package=", package, " appid=", appid) mainAppConnectApi.GetAppProfile(package, appid)
def UpdateApp(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) webcmd = WebDriverCmd(self.driver) time.sleep(2) # https://appstoreconnect.apple.com/apps/1230426472/appstore/ios/version/inflight apk = common.GetOutPutApkPathWin32(mainr.GetProjectOutPut(), Source.TAPTAP, isHD) # F:\\sourcecode\\unity\\product\\kidsgame\\ProjectOutPut\\xiehanzi\\hanziyuan\\screenshot\\shu\\cn\\480p\\1.jpg self.OpenFileBrowser(apk, True) while True: time.sleep(2) # for win in self.driver.window_handles: # if win!=old_window: # self.driver.switch_to.window(win) # self.urlold = self.driver.current_url # old_window = win # print("urlold 2=",self.urlold) # self.driver.switch_to.window(self.driver.window_handles[0]) self.urlnew = self.driver.current_url print("urlnew=", self.urlnew) if self.urlnew != self.urlold: print("new page =", self.urlnew) break # <div class="progress"><div class="progress-bar" style="width: 82%;" aria-valuenow="82"></div></div> # while True: # item = self.driver.find_element(By.XPATH, "//div[@class='progress']") # if item is not None: # value = item.get_attribute('aria-valuenow') # int_v = int(value) # if int_v>=100: # break # time.sleep(1) # 手动等待上传 # time.sleep(60*2) # https://www.taptap.com/developer/fill-form/14628?apk_id=496448&app_id=56016 # 未成年人防沉迷 # <input required="" type="radio" name="anti_addiction_read" value="1"> item = self.driver.find_element( By.XPATH, "//input[@name='anti_addiction_read']") item.click() time.sleep(1) # <input required="required" type="radio" name="anti_addiction_status" value="1"> item = self.driver.find_element( By.XPATH, "//input[@name='anti_addiction_status']") item.click() time.sleep(1) # 提交审核 # <button id="postAppSubmitV2" type="submit" value="submit" class="leave_current_page btn btn-primary btn-lg">保存并提交审核</button> item = self.driver.find_element(By.XPATH, "//button[@id='postAppSubmitV2']") item.click() time.sleep(2) # 确定 # section = self.driver.find_element(By.XPATH, "//section[@class='modal fade taptap-modal global-tip-modal in']") # # <button class="btn btn-primary" data-default-text="确定">确定</button> # # item = self.driver.find_element(By.XPATH, "//button[@data-default-text='确定']") # item = section.find_element(By.XPATH, "//button[@data-default-text='确定']") list = self.driver.find_elements(By.XPATH, "//button[@data-default-text='确定']") item = list[1] print("确定") self.driver.execute_script("arguments[0].click();", item) time.sleep(1)
def SubmitAppApi(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) mainHuaweiAppGalleryApi.SubmitApp(appid)
def CreateApp(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) print("CreateApp appid=", appid, " isHD=", isHD) if appid != "0": self.UpdateAppInfo(isHD) self.UploadScreenShot(isHD) self.UpdateApkApi(isHD) return # self.Init() # self.GoHome(isHD) # self.Login("*****@*****.**", "Qianlizhiwai1") # self.SaveCookie(self.fileCookie) webcmd = WebDriverCmd(self.driver) old_window = self.driver.current_window_handle url = "https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/myApp" self.driver.get(url) time.sleep(2) title = self.GetAppName(isHD, Source.LANGUAGE_CN) print("title =", title) # 等待网页加载成功 key = "//iframe[@id='mainIframeView']" while True: time.sleep(1) print("web is loading...") if self.IsElementExist(key) == True: print("web loading finish") break # 跳转到新的页面 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) # self.driver.switch_to.frame("mainIframeView") # time.sleep(1) self.Switch2MainFrameView() webcmd.AddCmdWait(CmdType.CLICK, "//button[@id='MyAppListNewApp']") webcmd.Run(True) # 请选择应用名称,或填写新应用名称(限64字符) print("title= ", title) # try: # webcmd.AddCmd(CmdType.INPUT, "//input[contains(@placeholder,'请选择应用名称')]", title, 1) # webcmd.Run(True) # except Exception as e: # print("INPUT eror=",e) key = "//input[contains(@id='PubProAppSortCombo')]" webcmd.AddCmd(CmdType.CLICK, key) # <div class="ucd-droplist-option ng-binding ng-scope" ng-bind="parentType.value">应用</div> key = "//span[text()='应用']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) # key = "//span[contains(text(),'请选择语言')]" key = "//input[contains(@id='PubProDefaultLanguagetCombo')]" webcmd.AddCmd(CmdType.CLICK, key) key = "//span[text()='" + self.defaultLanguage + "']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) old_window = self.driver.current_window_handle # waiting 确定 print("waiting 确定 手动点击 ") while True: time.sleep(1) if self.IsElementExist("//a[@id='PubProDetermine']") == False: break 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) # self.driver.switch_to.frame("mainIframeView") self.Switch2MainFrameView() item = webcmd.Find("//span[@id='AppInfoAppIdContent']", True) appid = item.text print(appid) mainAppInfo.SetAppId(isHD, Source.ANDROID, Source.HUAWEI, appid)
def FillAppInfo(self, isHD): webcmd = WebDriverCmd(self.driver) old_window = self.driver.current_window_handle 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) # 跳转到新的页面 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(2) self.Switch2MainFrameView() # 填写语言资料 lanKeys = ("简体中文", "英式英语", "美式英语") applans = (Source.LANGUAGE_CN, Source.LANGUAGE_EN, Source.LANGUAGE_EN) # 添加语言 for lan in range(0, len(lanKeys)): self.AddLanguage(webcmd, lanKeys[lan]) # 填写语言 for lan in range(0, len(lanKeys)): self.FillLanguage(webcmd, isHD, lanKeys[lan], applans[lan]) # 滚动到浏览器顶部 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) # 应用分类 isSort = True # 请选择二级分类 key = "//span[contains(text(),'请选择二级分类')]" isSort = self.IsElementExist(key) if isSort == False: print("not find key=" + key) isSort = False # return if isSort: item = webcmd.AddCmd(CmdType.CLICK, key) self.SetItemVisible(item) webcmd.Run(True) # <div class="ucd-droplist-option ng-binding">教育</div> key = "//div[@class='ucd-droplist-option ng-binding' and contains(text(),'教育')]" item = webcmd.AddCmd(CmdType.CLICK, key) self.SetItemVisible(item) webcmd.Run(True) key = "//span[contains(text(),'请选择三级分类')]" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) # <div class="ucd-droplist-option ng-binding">学习</div> key = "//div[@class='ucd-droplist-option ng-binding' and contains(text(),'学习')]" item = webcmd.AddCmd(CmdType.CLICK, key) self.SetItemVisible(item) webcmd.Run(True) key = "//input[@id='AppInfoCustomerEmailInputBox']" item = webcmd.AddCmd(CmdType.INPUT, key, "*****@*****.**") self.SetItemVisible(item) webcmd.Run(True) # 保存 key = "//a[@id='AppInfoSaveButtonCn']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(3) # 确定 key = "//a[@id='CommonConfirmButtonOk']" if self.IsElementExist(key): webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) self.PreSubmitApp(isHD) else: self.PreSubmitApp(isHD)
def CreateNewVersion(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) mainAppConnectApi.CreateNewVersion( appid, mainAppInfo.GetAppVersion(Source.IOS, isHD), mainAppInfo.GetAppPackage(Source.IOS, isHD))
def CreateApp(self, isHD): self.driver.get("https://adnet.qq.com/medium/add") time.sleep(1) webcmd = WebDriverCmd(self.driver) appChannel = Source.TAPTAP appid = mainAppInfo.GetAppId(isHD, Source.TAPTAP) if appid == "0": appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) appChannel = Source.HUAWEI # Android平台 item = self.driver.find_element( By.XPATH, "//button[@data-id='mediumTypeSelector']") item.click() time.sleep(1) list = self.driver.find_elements(By.XPATH, "//a[@role='option']") if self.osApp == Source.ANDROID: list[0].click() if self.osApp == Source.IOS: list[1].click() # 应用商店 item = self.driver.find_element( By.XPATH, "//button[@data-id='appStoreSelector']") item.click() time.sleep(1) ul_list = self.driver.find_elements( By.XPATH, "//ul[@class='dropdown-menu inner']") list = ul_list[1].find_elements(By.XPATH, "//a[@role='option']") idx = 0 if appChannel == Source.TAPTAP: idx = 9 else: # huawei idx = 7 if self.osApp == Source.ANDROID: list[idx].click() if self.osApp == Source.IOS: list[0].click() # 应用分类 item = self.driver.find_element( By.XPATH, "//button[@data-id='industryOneSelector']") item.click() time.sleep(1) ul_list = self.driver.find_elements( By.XPATH, "//ul[@class='dropdown-menu inner']") list = ul_list[2].find_elements(By.XPATH, "//a[@role='option']") list[12].click() item = self.driver.find_element( By.XPATH, "//button[@data-id='industrySecondSelector']") item.click() time.sleep(1) ul_list = self.driver.find_elements( By.XPATH, "//ul[@class='dropdown-menu inner']") list = ul_list[3].find_elements(By.XPATH, "//a[@role='option']") list[3].click() # url item = self.driver.find_element( By.XPATH, "//input[@class='form-control size-410 form-control']") url = "" if self.osApp == Source.ANDROID: if appChannel == Source.TAPTAP: url = "https://www.taptap.com/app/" + appid else: # url = "http://appstore.huawei.com/C"+appid # https://appgallery1.huawei.com/#/app/C100358289 url = "https://appgallery1.huawei.com/#/app/C" + appid if self.osApp == Source.IOS: appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) # https://itunes.apple.com/cn/app/id1303020002 # https://apps.apple.com/cn/app/id668407890 url = "https://apps.apple.com/cn/app/id" + appid item.send_keys(url) # name name = self.GetAppName(isHD) list = self.driver.find_elements(By.XPATH, "//input[@id='placementName']") list[0].send_keys(name) list = self.driver.find_elements(By.XPATH, "//input[@id='placementName']") list[1].send_keys(name) item = self.driver.find_element_by_id('formControlsTextarea') name += name name += name name += name name += name item.send_keys(name) item = self.driver.find_element(By.XPATH, "//input[@id='packageName']") package = mainAppInfo.GetPackage(Source.ANDROID, isHD) item.send_keys(package) # key = "//button[@id='spaui-uploader_2-empty']" # webcmd.AddCmd(CmdType.CLICK_Action,key) # webcmd.Run(True) # time.sleep(1) # self.OpenFileBrowser() # time.sleep(2) # 创建 item = self.driver.find_element( By.XPATH, "//a[@class='btn btn-primary btn-160']") item.click()
def Run(self, type, isHD): name = mainAppInfo.GetAppStoreAcount(isHD, Source.APPSTORE) mainAppConnectApi.API_KEY_ID = mainAppStoreAcount.GetiOSAPI_KEY_ID( name) mainAppConnectApi.API_USER_ID = mainAppStoreAcount.GetiOSAPI_USER_ID( name) mainAppConnectApi.teamID = mainAppStoreAcount.GetiOSteamID(name) mainAppConnectApi.CertificateID = mainAppStoreAcount.GetiOSCertificateID( name) mainUploadAssetApple.KEY_ID = mainAppConnectApi.API_KEY_ID mainUploadAssetApple.ISSUER_ID = mainAppConnectApi.API_USER_ID mainUploadAssetApple.PRIVATE_KEY = mainAppConnectApi.GetKEY_PRIVATE() mainUploadAssetApple.tokenKey = mainAppConnectApi.GetToken() if type == "createapp": appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) if appid == "0" or appid == "": self.CreateBundleID(isHD) self.Init() self.GoHome(isHD) if isHD: self.CreateApp(True) else: self.CreateApp(False) self.ShowWebHome() self.CreateApp(True) # mainAppConnectApi.CreateProfile(mainAppInfo.GetAppPackage(Source.IOS,True)) if type == "new_version": # isHD = True try: self.CreateNewVersion(isHD) except Exception as e: print("CreateNewVersion eror=", e) try: self.UpdateAppInfo(isHD, False) except Exception as e: print("UpdateAppInfo eror=", e) if type == "UploadScreenShot": self.UploadScreenShot(isHD) if type == "CreateBundleID": self.CreateBundleID(False) self.CreateBundleID(True) if type == "DownloadProfile": self.DownloadProfile(False) self.DownloadProfile(True) if type == "DeleteAllScreenShot": self.DeleteAllScreenShot(isHD) if type == "UpdateAppInfo": self.UpdateAppInfo(False) self.UpdateAppInfo(True) if type == "UpdateIAPInfo": self.UpdateIAPInfo(False) self.UpdateIAPInfo(True) if type == "SubmitApp": self.SubmitApp(isHD) if type == "update": if isHD: self.UpdateApp(True) else: self.UpdateApp(False) time.sleep(3)