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)
Exemple #2
0
    def DownloadAppleDeveloper(self, isHd):
        url = "https://developer.apple.com/account/resources/profiles/add"
        self.driver.get(url)
        time.sleep(3)
        webcmd = WebDriverCmd(self.driver)

        key = "//button[@id='action-ok']"
        item = webcmd.Find(key)
        if item is not None:
            item = webcmd.AddCmd(CmdType.CLICK_Action, key)
            webcmd.Run(True)
            self.driver.get(url)

        # <label for="IOS_APP_STORE">
        key = "//label[@for='IOS_APP_STORE']"
        item = webcmd.AddCmdWait(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        # <button type="summit" id="action-continue" class="tb-btn--primary">Continue</button>
        key = "//button[@id='action-continue']"
        item = webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)
        package = mainAppInfo.GetAppPackage(Source.IOS, isHd)
        print(package)
        # select app
        # <div class=" css-1hwfws3">
        key = "//div[@class=' css-1hwfws3']"
        item = webcmd.AddCmdWait(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//input[@id='react-select-2-input']"
        item = webcmd.AddCmdWait(CmdType.INPUT, key, package)
        webcmd.Run(True)

        # 手工输入包名
        # <div><label for="name">Provisioning Profile Name</label><input type="text" maxlength="50" id="name" class="form-text text-input" required=""></div>

        key = "//input[@id='name']"
        item = webcmd.Find(key, True)

        webcmd.AddCmd(CmdType.INPUT, key, package)
        webcmd.Run(True)

        # <button type="submit" id="action-continue" class="tb-btn--primary">Generate</button>
        key = "//button[@id='action-continue']"
        item = webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        # <a class="tb-btn--primary" download="" href="/services-account/QH65B2/account/ios/profile/downloadProfileContent?teamId=Y9ZUK2WTEE&amp;provisioningProfileId=TUNL6PRSZA">Download</a>
        key = "//a[@class='tb-btn--primary']"
        item = webcmd.AddCmdWait(CmdType.CLICK_Action, key)
        webcmd.Run(True)
Exemple #3
0
    def Login(self, user, password):
        print("Login")

        self.urlold = self.driver.current_url
        print("Login urlold=", self.urlold)

        webcmd = WebDriverCmd(self.driver)
        webcmd.AddCmdWait(CmdType.CLICK_Action, "//div[@class='btn-login']")
        webcmd.Run(True)

        webcmd.AddCmd(CmdType.INPUT, "//input[@id='uc-common-account']", user)
        webcmd.AddCmd(CmdType.INPUT, "//input[@id='ucsl-password-edit']",
                      password)

        # 登录
        # <div class="login-action">
        # webcmd.AddCmd(CmdType.CLICK_Action,"//input[@id='submit-formt']")
        # webcmd.AddCmd(CmdType.CLICK_Action,"//div[@class='login-action']")

        webcmd.Run(True)

        # self.LoginQQ(user, password)
        # self.SaveCookie()
        # 等待登录成功
        while True:
            time.sleep(1)
            self.urlnew = self.driver.current_url
            print("Login urlnew=", self.urlnew)
            if self.urlnew != self.urlold:
                print("Login Finish =", self.urlnew)
                break
Exemple #4
0
    def LoginAppleDeveloper(self, user, password):
        webcmd = WebDriverCmd(self.driver)
        self.driver.get("https://developer.apple.com/account")
        time.sleep(1)

        self.urlold = self.driver.current_url
        print("Login urlold=", self.urlold)

        # 等待网页加载成功
        key = "//iframe[@id='aid-auth-widget-iFrame']"
        while True:
            # self.driver.switch_to.frame('aid-auth-widget-iFrame')
            time.sleep(1)
            print("web is loading...")
            if webcmd.IsElementExist(key) == True:
                print("web loading finish")
                break

        self.driver.switch_to.frame('aid-auth-widget-iFrame')
        time.sleep(1)

        key = "//input[@id='account_name_text_field']"
        item = webcmd.AddCmdWait(CmdType.INPUT, key, user)
        webcmd.Run(True)
        key = "//button[@id='sign-in']"
        item = webcmd.AddCmdWait(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        time.sleep(1)

        key = "//input[@id='password_text_field']"
        item = webcmd.AddCmdWait(CmdType.INPUT, key, password)
        webcmd.Run(True)
        key = "//button[@id='sign-in']"
        item = webcmd.AddCmdWait(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        # 等待登录成功
        while True:
            time.sleep(1)
            self.urlnew = self.driver.current_url
            print("Login urlnew=", self.urlnew)
            if self.urlnew != self.urlold:
                print("Login Finish =", self.urlnew)
                break
Exemple #5
0
    def UpLoadSigniOS(self, isHd):
        webcmd = WebDriverCmd(self.driver)
        # downloadDir = "C:\\Users\\moon\\Downloads"
        # self.DeleteAllDownloadFile(downloadDir,".mobileprovision")

        # self.LoginAppleDeveloper("*****@*****.**","Moonqianlizhiwai1")
        # self.DownloadAppleDeveloper(isHd)

        # .mobileprovision
        # appsign =self.GetDownloadFile(downloadDir,".mobileprovision")
        appsign = self.GetPathXcodePrifile(isHd)

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

        self.OpenFileBrowser(appsign)
    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)
    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 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 CreateApp(self, isHD):
        appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE)
        package = mainAppInfo.GetAppPackage(Source.IOS, isHD)
        if appid != "0":
            self.FillAppInfo(isHD)
            # self.UpdateAppInfo(isHD)
            # self.UploadScreenShot(isHD)
            # self.Init()
            # self.GoHome(isHD)

            return

        # mainAppConnectApi.GetAppProfile(package,appid)
        # package = mainAppInfo.GetAppPackage(Source.IOS,isHD)
        bundleid = mainAppConnectApi.GetBundleIdByPackage(package)
        webcmd = WebDriverCmd(self.driver)
        url = "https://appstoreconnect.apple.com/apps"
        self.driver.get(url)
        time.sleep(2)
        self.urlold = self.driver.current_url

        webcmd.AddCmdWait(CmdType.CLICK, "//button[@id='new-app-btn-icon']")
        webcmd.AddCmd(CmdType.CLICK, "//button[@id='new-app-btn']")
        webcmd.AddCmdWait(CmdType.CLICK,
                          "//input[@name='appStoreVersionsIOS']")
        webcmd.AddCmd(
            CmdType.INPUT, "//input[@id='name']",
            mainAppInfo.GetAppName(Source.IOS, isHD, Source.LANGUAGE_EN))
        webcmd.AddCmd(CmdType.INPUT, "//input[@id='sku']",
                      mainAppInfo.GetAppSKU(isHD))

        key = "//select[@name='primaryLocale']"
        item = webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)
        if item == None:
            item = webcmd.Find(key)

        key = ".//option[@value='en-US']"
        subitem = webcmd.FindChild(item, key)
        webcmd.DoCmd(subitem, CmdType.CLICK)

        item = webcmd.AddCmd(CmdType.CLICK, "//select[@name='bundleId']")
        webcmd.Run(True)
        # time.sleep(2)
        key = ".//option[@value='" + package + "']"
        subitem = webcmd.FindChild(item, key, True)
        webcmd.DoCmd(subitem, CmdType.CLICK)
        time.sleep(1)

        webcmd.AddCmd(CmdType.INPUT, "//input[@id='sku']",
                      mainAppInfo.GetAppSKU(isHD))

        # item=webcmd.AddCmd(CmdType.CLICK_SCRIPT, "//button[@type='primary'] and text()='创建'")
        # webcmd.Run(True)
        # webcmd.WaitKeyBoard("q")

        # 等待创建成功
        while True:
            time.sleep(1)
            self.urlnew = self.driver.current_url
            print("CreateApp urlnew=", self.urlnew)
            if self.urlnew != self.urlold:
                print("CreateApp Finish =", self.urlnew)
                break

        time.sleep(2)

        # https://appstoreconnect.apple.com/apps/1525843317/appstore/ios/version/inflight
        url = self.driver.current_url
        print(url)
        head = "/apps/"
        idx = url.find(head) + len(head)
        url = url[idx:]
        idx = url.find("/")
        appid = url[0:idx]
        print("appid create =", appid)
        if len(appid) > 2:
            mainAppInfo.SetAppId(isHD, Source.IOS, Source.APPSTORE, appid)
            self.FillAppInfo(isHD)
    def Login(self, user, password):
        mainAppInfo.SetSmsCode("")
        webcmd = WebDriverCmd(self.driver)
        self.urlold = self.driver.current_url
        print("Login urlold=", self.urlold)

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

        self.driver.switch_to.frame('aid-auth-widget-iFrame')
        time.sleep(1)

        key = "//input[@id='account_name_text_field']"
        webcmd.AddCmdWait(CmdType.CLICK, key)
        webcmd.AddCmd(CmdType.INPUT, key, user)
        webcmd.Run(True)

        key = "//button[@id='sign-in']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        key = "//input[@id='password_text_field']"
        webcmd.AddCmd(CmdType.INPUT, key, password)
        webcmd.Run(True)

        key = "//button[@id='sign-in']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        # item = self.driver.find_element(By.XPATH, "//input[@id='password_text_field']")
        # item.send_keys(password)
        # item.click()
        # time.sleep(1)

        # item = self.driver.find_element(By.XPATH, "//button[@id='sign-in']")
        # item.click()
        # time.sleep(1)
        if Platform.isMacSystem():
            # mac 输入双重验证
            test = 0
            time.sleep(3)
            code = self.GetAppleCode()

        else:

            # 输入短信验证码

            # <a class="si-link ax-outline tk-subbody lite-theme-override" id="didnt-get-code" href="#">
            #                 没有收到验证码?
            #             </a>
            key = "//a[@id='no-trstd-device-pop']"
            item = webcmd.Find(key, True)
            if item is not None:
                webcmd.AddCmd(CmdType.CLICK, key)
                webcmd.Run(True)

    # <a class="si-link link ax-outline tk-subbody-headline" id="use-phone-link" href="#" aria-describedby="usePhoneSMSInfo">
    #                                                 发送短信给我
    #                                             </a>

            key = "//a[@id='use-phone-link']"
            item = webcmd.Find(key, True)
            if item is not None:
                webcmd.AddCmd(CmdType.CLICK, key)
                webcmd.Run(True)

            code = self.GetSmsCode()
            print("Login GetSmsCode=", code)

        # 输入code
        # <input maxlength="1" autocorrect="off" autocomplete="off" autocapitalize="off" spellcheck="false" type="tel" id="char0" class="form-control force-ltr form-textbox char-field" aria-label="输入验证码 位 1" placeholder="" data-index="0">
        for i in range(6):
            idkey = "char" + str(i)
            key = "//input[@id='" + idkey + "']"
            item = webcmd.Find(key, False)
            # webcmd.SetInputText(key,code[i])
            code_i = code[i]
            print("input code_i=", code_i)
            item.send_keys(code_i)

        key = "//button[contains(@id,'trust-browser')]"
        item = webcmd.Find(key, True)
        if item is not None:
            webcmd.AddCmd(CmdType.CLICK, key)
            webcmd.Run(True)

        # 等待登录成功
        while True:
            time.sleep(1)
            self.urlnew = self.driver.current_url
            print("Login urlnew=", self.urlnew)
            if self.urlnew != self.urlold:
                print("Login Finish =", self.urlnew)
                break