예제 #1
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
예제 #2
0
    def SubmitApp(self, isHD):
        webcmd = WebDriverCmd(self.driver)
        # 隐私政策网址
        key = "//input[@id='VerInfoPrivacyPolicyInputBox']"
        if self.IsElementExist(key):
            webcmd.AddCmd(CmdType.INPUT, key, self.GetPrivacy(isHD))
            webcmd.Run(True)

        # 不申请
        key = "//span[@id='VerInfoNotApplyButton']"
        if self.IsElementExist(key):
            webcmd.AddCmd(CmdType.CLICK_Action, key)
            webcmd.Run(True)

        # item = self.driver.find_element(By.XPATH, "//span[@id='VerInfoNotApplyButton']")
        # item.click()
        # time.sleep(1)

        # 提交审核
        key = "//a[@id='VerInfoSubmitButton']"
        if self.IsElementExist(key):
            webcmd.AddCmd(CmdType.CLICK_Action, key)
            webcmd.Run(True)
        time.sleep(3)

        # 确定
        key = "//a[@id='AppSubmitConfirmButtonOk']"
        if self.IsElementExist(key):
            webcmd.AddCmd(CmdType.CLICK_Action, key)
            webcmd.Run(True)

        time.sleep(3)
예제 #3
0
    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 Login(self, user, password):
        self.urlold = self.driver.current_url
        print("Login urlold=", self.urlold)

        webcmd = WebDriverCmd(self.driver)

        # 等待网页加载成功
        key = "//input[@type='email']"
        item = webcmd.Find(key, True)
        webcmd.AddCmd(CmdType.INPUT, key, user)
        webcmd.Run(True)

        key = "//span[contains(text(),'下一步')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        time.sleep(1)

        # 等待登录成功
        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
예제 #5
0
    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)
예제 #6
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)
예제 #7
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)
예제 #8
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)
예제 #9
0
    def Login(self, user, password):
        # 3452644866

        # driver.add_cookie("[{'domain': '.id1.cloud.huawei.com', 'expiry': 1908869785, 'httpOnly': False, 'name': 'sid', 'path': '/', 'secure': True, 'value': '2049382e3828ef4470bef8b426c4bb3370e7d9e1147f53a18839e47dad7caf10a233e61ee15337b4373e'}, {'domain': '.id1.cloud.huawei.com', 'expiry': 1908869785, 'httpOnly': False, 'name': 'hwid_cas_sid', 'path': '/', 'secure': True, 'value': '2049382e3828ef4470bef8b426c4bb3370e7d9e1147f53a18839e47dad7caf10a233e61ee15337b4373e'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1624872984, 'httpOnly': False, 'name': 'HW_idts_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': '1593336984125'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1624872984, 'httpOnly': False, 'name': 'HW_id_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': 'cf787be41ac24d65887dcd20c826ac97'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1624872984, 'httpOnly': False, 'name': 'HW_idvc_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': '1'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1593338788, 'httpOnly': False, 'name': 'HW_idn_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': 'ec569450f0ac4cd78fc72965d91ec7e8'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1608888984, 'httpOnly': False, 'name': 'HW_refts_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': '1593336984124'}, {'domain': '.id1.cloud.huawei.com', 'httpOnly': True, 'name': 'CAS_THEME_NAME', 'path': '/', 'secure': True, 'value': 'red'}, {'domain': 'id1.cloud.huawei.com', 'httpOnly': False, 'name': 'cookieBannerOnOff', 'path': '/', 'secure': False, 'value': 'true'}, {'domain': '.id1.cloud.huawei.com', 'httpOnly': True, 'name': 'VERSION_NO', 'path': '/', 'secure': True, 'value': 'UP_CAS_4.0.4.100'}, {'domain': 'id1.cloud.huawei.com', 'httpOnly': True, 'name': 'JSESSIONID', 'path': '/CAS', 'secure': True, 'value': '144E8B2ED3F5D9C8576742C1DDF4CF3D0DCF6949E13D6943'}]")
        self.urlold = self.driver.current_url
        webcmd = WebDriverCmd(self.driver)

        key = "//input[@type='text' and contains(@placeholder,'输入手机号/邮箱') ]"
        webcmd.SetInputText(key, user)

        key = "//input[@type='password']"
        webcmd.SetInputText(key, password)

        key = "//button[@type='button' and contains(text(),'登录')]"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        while True:
            time.sleep(1)
            self.urlnew = self.driver.current_url
            if self.urlnew != self.urlold:
                break
            print("waiting for login self.urlnew=", self.urlnew)

        return
예제 #10
0
    def SearchApp(self, ishd):
        name = self.GetAppName(ishd, Source.LANGUAGE_CN)
        webcmd = WebDriverCmd(self.driver)

        self.driver.get(
            "https://www.taptap.com/developer/dashboard/14628/apps")
        time.sleep(2)

        key = "//input[@class='ant-select-search__field']"
        webcmd.AddCmd(CmdType.INPUT, key, name)

        webcmd.Run(True)

        time.sleep(1)
        # <li role="option" class="ant-select-dropdown-menu-item" unselectable="on" style="user-select: none;"> 诗词大挑战HD(测试版) </li>
        key = "//div[@class='ant-select-dropdown-content']"
        div = webcmd.Find(key)

        # 202132

        list = div.find_elements_by_xpath("ul/li")
        for li in list:
            title = li.text
            print(title)
            if title.find(name) == 0:
                webcmd.DoCmd(li, CmdType.CLICK)
                # app_id=56016
                # url = li.get_attribute('href')
                # strfind = "app_id="
                # idx = url.find(strfind)+len(strfind)
                # print(url)
                # appid = url[idx:]
                # print(appid)
                # mainAppInfo.SetAppId(ishd, Source.ANDROID, Source.TAPTAP, appid)
                break
예제 #11
0
    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)
예제 #12
0
    def CreateAdInsert(self, isHD):
        self.driver.get(
            "http://union.baidu.com/bqt/appco.html#/union/slot/create")
        webcmd = WebDriverCmd(self.driver)
        time.sleep(3)

        name = self.GetAppName(isHD)

        key = "//button[@class='veui-button' and contains(text(),'" + self.INSERT + "')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//input[@name='name']"
        webcmd.AddCmd(CmdType.INPUT_CLEAR, key)
        webcmd.AddCmd(CmdType.INPUT, key, self.INSERT + "_" + name)
        webcmd.Run(True)

        # 选择应用
        self.SelectApp()

        key = "//span[@class='veui-radio-label' and contains(text(),'全屏')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        key = "//span[@class='veui-checkbox-label' and contains(text(),'蜂窝数据4G网络')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        key = "//span[@class='veui-checkbox-label' and contains(text(),'2G/3G等其他网络')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//button[@ui='primary' and @type='submit' and contains(text(),'确定')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)
        time.sleep(3)
예제 #13
0
    def OnClickFinish(self):
        webcmd = WebDriverCmd(self.driver)
        keyFinish = "//button[@class='union-complete-btn spaui-button spaui-button-primary spaui-component']"
        webcmd.AddCmd(CmdType.CLICK_Action, keyFinish)
        webcmd.Run(True)

        key = "//div[@class='text title' and text()='请上传广告位展示截图']"
        if webcmd.IsElementExist(key):
            # 确定
            key = "//button[@class=' t']"
            webcmd.AddCmd(CmdType.CLICK_Action, key)
            webcmd.Run(True)

            # 重新上传
            time.sleep(1)
            print("请上传广告位展示截图")
            self.UploadImage(False)
            webcmd.AddCmd(CmdType.CLICK_Action, keyFinish)
            webcmd.Run(True)
예제 #14
0
    def SetText(self, key, title):
        webcmd = WebDriverCmd(self.driver)
        if Platform.isWindowsSystem():
            pyperclip.copy(title)
            pyperclip.paste()
            webcmd.AddCmd2(CmdType.CLICK_Action, key)
            webcmd.AddCmd2(CmdType.CTR_V, key)
        else:
            webcmd.AddCmd(CmdType.INPUT, key, title)

        webcmd.Run(True)
예제 #15
0
    def SelectApp(self):
        webcmd = WebDriverCmd(self.driver)

        key = "//button[@aria-haspopup='listbox' and @aria-disabled='false']"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//input[@name='basic.appSid']"
        webcmd.AddCmd(CmdType.INPUT, key, self.appId)
        webcmd.Run(True)

        # <span class="veui-select-label">儿童学形状和颜色(andriod) (ID:e72aabfc)</span>
        # 父节点button
        try:
            # key = "//span[@class='veui-option-label' and contains(text(),"+self.appId+")]/parent::button"
            # item = webcmd.Find(key)
            key = "//span[@class='veui-option-label' and contains(text()," + self.appId + ")]"
            item = webcmd.Find(key, True)
            button = webcmd.GetParent(item)
            print(button.tag_name)
            # CLICK_Action
            # webcmd.SetItemVisible(item)
            webcmd.DoCmd(item, CmdType.CLICK)
            time.sleep(2)
            # webcmd.WaitKeyBoard('q')
            # CLICK_SCRIPT CLICK_Action
            # item = webcmd.AddCmd(CmdType.CLICK_Action, key)
            # if item==None:
            #     print("no key SelectApp key=",key)
            # # webcmd.SetItemVisible(item)
            # webcmd.Run(True)
        except Exception as e:
            print(e)  #打印所有异常到屏幕
            # 手动选择
            webcmd.WaitKeyBoard('q')
            time.sleep(2)

        time.sleep(1)
예제 #16
0
    def CreateAdVideo(self, isHD):
        self.driver.get(
            "http://union.baidu.com/bqt/appco.html#/union/slot/create")
        webcmd = WebDriverCmd(self.driver)
        time.sleep(3)

        name = self.GetAppName(isHD)

        key = "//button[@class='veui-button' and contains(text(),'" + self.VIDEO + "')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//input[@name='name']"
        webcmd.AddCmd(CmdType.INPUT_CLEAR, key)
        webcmd.AddCmd(CmdType.INPUT, key, self.VIDEO + "_" + name)
        webcmd.Run(True)

        # 选择应用
        self.SelectApp()

        key = "//button[@ui='primary' and @type='submit' and contains(text(),'确定')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)
        time.sleep(3)
예제 #17
0
    def GetKeyWord(self, word, lan):
        url = "https://www.deepaso.com/kwextend?query=" + word + "&lang=" + lan
        print(url)
        self.driver.get(url)
        webcmd = WebDriverCmd(self.driver)

        # <button data-track="关键词扩展查询" data-type="click" data-value="KwExtend_search" id="button_search" type="submit" class="btn btn-primary" style="margin:-3px 0 0 5px">查询</button>

        key = "//button[@id='button_search']"
        button = webcmd.Find(key, True)

        # key = "//select[@name='lang']"
        # webcmd.AddCmd(CmdType.CLICK,key)
        # webcmd.Run(True)

        # # cn us
        # key = "//option[@value='"+lan+"']"
        # webcmd.AddCmd(CmdType.CLICK,key)
        # webcmd.Run(True)

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

        key = "//table[@class='table table-striped']"
        table = webcmd.Find(key)

        key = ".//tbody"
        tbody = webcmd.FindChild(table, key)

        key = ".//a"
        list = webcmd.FindListChild(tbody, key)
        aso = ""
        idx = 0
        for a in list:
            text = a.text
            # print(text)
            if len(aso + "," + text) < 100:
                if idx == 0:
                    aso = text
                else:
                    aso += "," + text

            idx += 1

        print(aso)
        return aso
예제 #18
0
 def UploadImage(self, isAuto):
     return
     print('UploadImage isAuto', isAuto)
     webcmd = WebDriverCmd(self.driver)
     if isAuto == True:
         key = "//button[@id='spaui-uploader_2-empty']"
         webcmd.AddCmd(CmdType.CLICK_Action, key)
         webcmd.Run(True)
         time.sleep(1)
         self.OpenFileBrowser()
         time.sleep(3)
     else:
         key_press = 'q'
         while True:  #making a loop
             time.sleep(1)
             print('waiting for key press = ', key_press)
             # try:
             if keyboard.is_pressed(key_press):
                 print('You Pressed A Key!')
                 break
예제 #19
0
    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)
예제 #20
0
    def ParseMusicInfoWebCmd(self):
   
        webcmd = WebDriverCmd(self.driver)
        
        # 跳转到新的页面 
        time.sleep(1)
        
        old_window = self.driver.current_window_handle
        key = "//audio[@id='myAudio']"
        if webcmd.IsElementExist(key)==False:
            while True:
                time.sleep(1)
                
                for win in self.driver.window_handles:
                    if win != old_window:
                        self.driver.switch_to.window(win)
                        old_window = self.driver.current_window_handle

                    print("self.driver.current_url 2=", self.driver.current_url) 

                if webcmd.IsElementExist(key):  
                    break

        info = MusicInfo()
        key = "//audio[@id='myAudio']"
        item = webcmd.Find(key,True) 
        audio =item.get_attribute('src')
        info.url = audio
        print(audio)
        mainFileDownload.Download(info.url,"OutPut/1.mp3")

        # play
        key = "//a[@id='toggle']"
        webcmd.AddCmd(CmdType.CLICK_Action,key,1)
        # webcmd.Run(True)
        
        # title
        key = "//span[@class='audioName']"
        span = webcmd.Find(key)
        title =span.get_attribute('title')
        print(title)
        info.title = title

        # artist
        key = "//p[@class='singerName fl']"
        item = webcmd.Find(key,False) 
        key = ".//a"
        a = webcmd.FindChild(item,key)
        title =a.get_attribute('title')
        href =a.get_attribute('href')
        print(title)
        print(href)
        info.artist = title

        # album
        key = "//p[@class='albumName fl']"
        item = webcmd.Find(key,False) 
        key = ".//a"
        a = webcmd.FindChild(item,key)
        title =a.get_attribute('title')
        href =a.get_attribute('href')
        print(title)
        print(href)
        info.album = title

        # 专辑封面
        key = "//div[@class='albumImg']"
        div = webcmd.Find(key) 
        key = ".//img"
        img = webcmd.FindChild(div,key)
        pic =img.get_attribute('src')
        print(pic)
        info.pic = pic
        
        # 歌词
        key = "//div[@class='songWordContent songWordContentM jspScrollable']"
        if webcmd.IsElementExist(key):
            div = webcmd.Find(key)
            webcmd.SetItemVisible(div,1)
            key = ".//p[@class='ie8FontColor']"
            list = webcmd.FindListChild(div,key)
            print("len=",len(list))
            for p in list:
                title = p.text
                if len(title)>0:
                    print(title)

        
        mainDBMusic.AddItem(info)
        db = DBMusic()
예제 #21
0
    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
예제 #22
0
    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)
예제 #23
0
    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)
예제 #24
0
    def SearchApp(self, ishd):
        if self.appId != "0":
            return
        name = self.GetAppName(ishd)
        print("GetAppName=", name)

        webcmd = WebDriverCmd(self.driver)
        self.driver.get(
            "http://union.baidu.com/bqt/appco.html#/promotion/application")
        time.sleep(3)

        key = "//button[@class='veui-button filters' and contains(text(),'筛选')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key, name)
        webcmd.Run(True)

        print("SearchApp self.osApp=", self.osApp)
        if self.osApp == Source.ANDROID:
            key = "//span[@class='filter-option' and contains(text(),'Android')]"
        if self.osApp == Source.IOS:
            key = "//span[@class='filter-option' and contains(text(),'iOS')]"

        print("SearchApp key=", key)
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//button[@ui='primary' and contains(text(),'确定')]"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//input[@role='searchbox']"
        webcmd.AddCmd(CmdType.INPUT, key, name)

        key = "//button[@aria-label='搜索']"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        time.sleep(2)

        key = "//div[@class='table-multi-line']"
        div = webcmd.Find(key)
        key = ".//div[@class='one-line']"
        # div1 = webcmd.FindChild(div,key)
        title = name
        self.appName = title
        print("title=", title)
        # key = ".//div[@class='sec-line']"
        # div2 = webcmd.FindChild(div,key)
        # ID:abb4293d
        # self.appId = self.GetAdPlaceId(div2.text)

        # <div class="table-multi-line"><div class="one-line">开心猜猜乐</div><div class="sec-line">ID:a49df22d</div></div>
        key = "//div[@class='one-line' and text()='" + self.appName + "']/../div[@class='sec-line']"
        item = webcmd.Find(key)
        text = item.text
        head = "ID:"
        idx = text.find(head) + len(head)
        self.appId = text[idx:]
        # self.appId = self.appKey
        # key = "//button[@ui='link' and contains(text(),'修改')]"

        # 先找父节点tr
        key = "//div[@class='one-line' and text()='" + self.appName + "']"
        div_name = webcmd.Find(key)
        tr = webcmd.GetParent(div_name, 4)
        # tr = webcmd.GetParent(tr)
        # tr = webcmd.GetParent(tr)
        # tr = webcmd.GetParent(tr)
        # key = "//div[@class='one-line' and text()='"+self.appName+"']/../../../../button[@ui='link' and contains(text(),'修改')]"
        # key = "//div[@class='one-line' and text()='"+self.appName+"']/../../../../"
        # tr = webcmd.Find(key)
        key = ".//button[@ui='link' and contains(text(),'修改')]"
        button = webcmd.FindChild(tr, key)
        webcmd.DoCmd(button, CmdType.CLICK_Action)
        # listbtn = webcmd.FindList(key)
        # if ishd:
        #     item = listbtn[0]
        # else:
        #     item = listbtn[1]

        # webcmd.DoCmd(item,CmdType.CLICK_Action)
        # webcmd.AddCmd(CmdType.CLICK_Action, key)
        # webcmd.Run(True)
        time.sleep(2)

        print("self.driver.current_url=", self.driver.current_url)
        url = self.driver.current_url
        head = "id="
        idx = url.find(head) + len(head)
        self.appKey = url[idx:]
        print("appKey=", self.appKey)
예제 #25
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)
예제 #26
0
    def Login(self, user, password):
        webcmd = WebDriverCmd(self.driver)
        # 3452644866
        mainAppInfo.SetSmsCode("")
        # 等待扫码登录
        # while True:
        #     time.sleep(1)
        #     self.urlnew = self.driver.current_url
        #     if self.urlnew != self.urlold:
        #         break
        #     print("waiting for login self.urlnew=",self.urlnew)

        # return

        # driver.add_cookie("[{'domain': '.id1.cloud.huawei.com', 'expiry': 1908869785, 'httpOnly': False, 'name': 'sid', 'path': '/', 'secure': True, 'value': '2049382e3828ef4470bef8b426c4bb3370e7d9e1147f53a18839e47dad7caf10a233e61ee15337b4373e'}, {'domain': '.id1.cloud.huawei.com', 'expiry': 1908869785, 'httpOnly': False, 'name': 'hwid_cas_sid', 'path': '/', 'secure': True, 'value': '2049382e3828ef4470bef8b426c4bb3370e7d9e1147f53a18839e47dad7caf10a233e61ee15337b4373e'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1624872984, 'httpOnly': False, 'name': 'HW_idts_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': '1593336984125'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1624872984, 'httpOnly': False, 'name': 'HW_id_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': 'cf787be41ac24d65887dcd20c826ac97'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1624872984, 'httpOnly': False, 'name': 'HW_idvc_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': '1'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1593338788, 'httpOnly': False, 'name': 'HW_idn_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': 'ec569450f0ac4cd78fc72965d91ec7e8'}, {'domain': 'id1.cloud.huawei.com', 'expiry': 1608888984, 'httpOnly': False, 'name': 'HW_refts_id1_cloud_huawei_com_id1_cloud_huawei_com', 'path': '/', 'secure': False, 'value': '1593336984124'}, {'domain': '.id1.cloud.huawei.com', 'httpOnly': True, 'name': 'CAS_THEME_NAME', 'path': '/', 'secure': True, 'value': 'red'}, {'domain': 'id1.cloud.huawei.com', 'httpOnly': False, 'name': 'cookieBannerOnOff', 'path': '/', 'secure': False, 'value': 'true'}, {'domain': '.id1.cloud.huawei.com', 'httpOnly': True, 'name': 'VERSION_NO', 'path': '/', 'secure': True, 'value': 'UP_CAS_4.0.4.100'}, {'domain': 'id1.cloud.huawei.com', 'httpOnly': True, 'name': 'JSESSIONID', 'path': '/CAS', 'secure': True, 'value': '144E8B2ED3F5D9C8576742C1DDF4CF3D0DCF6949E13D6943'}]")
        self.urlold = self.driver.current_url
        item = self.driver.find_element(
            By.XPATH, "//input[@ht='input_pwdlogin_account']")
        item.send_keys(user)

        item = self.driver.find_element(By.XPATH,
                                        "//input[@ht='input_pwdlogin_pwd']")
        item.send_keys(password)

        item = self.driver.find_element(
            By.XPATH, "//div[@ht='click_pwdlogin_submitLogin']")
        item.click()
        time.sleep(1)

        # 获取验证码
        key = "//div[@ht='click_authentication_getAuthcode']"
        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)

        # 输入短信验证码
        item = self.driver.find_element(
            By.XPATH, "//input[@ht='input_authentication_authcode']")
        item.send_keys(code)

        # 确定
        # key = "//div[@ht='click_dialog_rightbtn']"
        key = "//div[@class='dialog-btn btn-next']"
        item = webcmd.Find(key, True)
        if item is not None:
            webcmd.AddCmd(CmdType.CLICK, key)
            webcmd.Run(True)
            # key = ".//span[text()='确定']"
            # key = "//div[@class='dialog-btn btn-next']"
            # subitem = webcmd.FindChild(item,key,True)
            # print("Click 确定=")
            # webcmd.DoCmd(subitem,CmdType.CLICK_Action)

        # 信任
        key = "//div[@ht='click_dialog_rightbtn']"
        item = webcmd.Find(key, True)
        # if item is not None:
        #     key = ".//span[text()='信任']"
        #     subitem = webcmd.FindChild(item,key,True)
        #     webcmd.DoCmd(subitem,CmdType.CLICK)

        while True:
            time.sleep(1)
            self.urlnew = self.driver.current_url
            if self.urlnew != self.urlold:
                break
            print("waiting for login self.urlnew=", self.urlnew)

        return
예제 #27
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)
예제 #28
0
    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)
예제 #29
0
    def FillAppInfo(self, isHD):

        webcmd = WebDriverCmd(self.driver)

        # 等待文件長傳結束
        key = "//a[@title='基础信息']"
        item = webcmd.Find(key, True)

        # default zh_CN en_US
        # self.lanKeys =(self.LAN_KEY_default,self.LAN_KEY_CN, self.LAN_KEY_EN)
        # applans = (Source.LANGUAGE_CN,Source.LANGUAGE_CN, Source.LANGUAGE_EN)

        # default zh_CN
        # self.lanKeys =(self.LAN_KEY_default,self.LAN_KEY_CN)
        # applans = (Source.LANGUAGE_EN,Source.LANGUAGE_CN)
        self.lanKeys = [self.LAN_KEY_CN, self.LAN_KEY_EN]
        applans = [Source.LANGUAGE_CN, Source.LANGUAGE_EN]

        # addlans = ("chs","en")
        # addlans = ("default","chs")
        addlans = ["chs"]
        #
        webcmd.AddCmd(CmdType.CLICK, "//div[@id='submitApp_developer_type']",
                      "", 1)
        webcmd.Run(True)

        list = self.driver.find_elements(
            By.XPATH, "//li[@class='ant-select-dropdown-menu-item']")
        list[2].click()
        time.sleep(1)

        # 类型
        webcmd.AddCmd(CmdType.CLICK, "//div[@id='submitApp_category']", "", 1)
        webcmd.Run(True)

        # list = self.driver.find_elements( By.XPATH, "//li[@class='ant-select-dropdown-menu-item']")
        key = "//li[@class='ant-select-dropdown-menu-item' and contains(text(),'休闲') ]"
        # webcmd.DoCmd(list[1],CmdType.CLICK)
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)
        time.sleep(1)

        # 兼容性
        key = "//div[@id='submitApp_lang']"
        item_div = webcmd.Find(key)

        key = ".//span[contains(text(),'简体中文')]"
        subitem = webcmd.FindChild(item_div, key)
        webcmd.DoCmd(subitem, CmdType.CLICK)

        key = ".//span[contains(text(),'English')]"
        subitem = webcmd.FindChild(item_div, key)
        webcmd.DoCmd(subitem, CmdType.CLICK)

        # 有内购
        key = "//div[@id='submitApp_in_app_purchase']"
        item_div = webcmd.Find(key)

        key = ".//span[contains(text(),'否')]"
        subitem = webcmd.FindChild(item_div, key)
        webcmd.DoCmd(subitem, CmdType.CLICK)

        # 需要网络
        # ><input name="network" type="radio" class="ant-radio-input" value="yes">
        key = "//input[@name='network' and @type='radio' and @value='yes']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        # 添加多语言

        key = "//div[@id='AnchorGameData']"
        item_div = webcmd.Find(key)

        # 管理多语言
        # key = ".//button[@class='float-r btn--edit ant-btn ant-btn-primary ant-btn-background-ghost']"
        # subitem = webcmd.FindChild(item_div,key)
        # webcmd.DoCmd(subitem,CmdType.CLICK)

        # webcmd.AddCmd(CmdType.CLICK, "//a[@id='manage-trans-btn']", "", 1)
        # # trans-select-chs
        # for lan in range(0, len(addlans)):
        #     key = "//input[@id='trans-select-"+addlans[lan]+"']"
        #     print(key)
        #     webcmd.AddCmd2(CmdType.CLICK, key)

        # webcmd.AddCmd(CmdType.CLICK, "//button[@id='manage-trans-submit']", "", 1)

        # webcmd.Run(True)

        # webcmd.AddCmd(  CmdType.CLICK, "//a[@aria-controls='chs']", "", 1)
        # webcmd.Run(True)
        # key = "//input[@type='file' and @data-target='#banner_1_android-"+"cn"+"']"
        # key = "//input[@data-target='#banner_1_android']"
        # key = "//input[@data-target='#icon']"
        # key = "//input[@type='file' and @data-target='#icon']"
        # key = "//input[@type='file' and @data-target='#icon-zh_CN']"

        # #icon
        # # key ="//input[@id='banner_1_android-input']"
        # # key ="//span[@class='fileinput-button fixed-size banner']"

        for lan in range(0, len(self.lanKeys)):

            self.SelectLanguage(webcmd, self.lanKeys[lan])

            self.UploadTitle(webcmd, isHD, self.lanKeys[lan], applans[lan])

            self.UploadIcon(webcmd, isHD, self.lanKeys[lan])

            self.UploadAdHome(webcmd, isHD, self.lanKeys[lan], applans[lan])

            self.UploadScreenShot(webcmd, isHD, self.lanKeys[lan],
                                  applans[lan])

            # break

        # 游戏状态 [Android]
        # 兄弟节点
        key = "//span[@class='th_middle' and contains(text(),'测试')]/../span[@class='tap-radio_point']"
        # brother
        # <span data-v-8bce4f2c="" class="tap-radio_point"></span>
        # webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        self.SubmitApp(True)
예제 #30
0
    def FillAppInfo(self, isHD):
        appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE)
        webcmd = WebDriverCmd(self.driver)

        # App 隐私
        try:
            self.FillAppPrivacy(isHD)
        except Exception as e:
            print("FillAppPrivacy eror=", e)

        try:
            self.FillAppPrice(isHD)
        except Exception as e:
            print("FillAppPrice eror=", e)

        try:
            self.FillAppInfo2(isHD)
        except Exception as e:
            print("FillAppInfo2 eror=", e)

        # base appinfo

        url = "https://appstoreconnect.apple.com/apps/" + appid + "/appstore/ios/version/inflight"
        self.driver.get(url)
        time.sleep(2)

        key = "//input[@id='versionString']"
        #
        webcmd.Find(key, True)
        version = mainAppInfo.GetAppVersion(Source.IOS, isHD)
        print("FillAppInfo version =", appid)
        webcmd.AddCmd(CmdType.INPUT_CLEAR, key)
        webcmd.Run(True)
        webcmd.AddCmd(CmdType.INPUT, key, version)
        # webcmd.SetInputText(key,version)
        webcmd.Run(True)

        webcmd.AddCmd(CmdType.INPUT, "//input[@id='copyright']", "moonma")
        webcmd.Run(True)
        # 截图
        # <input id="choose-file" type="file" multiple="" class="choose-file-input___33eoI">

        # 分级
        webcmd.AddCmd(CmdType.CLICK,
                      "//button[@type='button' and text()='编辑']")
        key = "//input[@type='radio' and @value='NONE' and contains(@id,'_NONE')]"
        webcmd.AddCmd(CmdType.CLICK_List_ALL, key)
        # <input type="radio" name="violenceCartoonOrFantasy" id="violenceCartoonOrFantasy_NONE" value="NONE">
        webcmd.AddCmd(CmdType.CLICK,
                      "//input[@id='unrestrictedWebAccess_false']")
        webcmd.AddCmd(CmdType.CLICK,
                      "//input[@id='gamblingAndContests_false']")
        webcmd.AddCmd(CmdType.CLICK,
                      "//button[@type='primary' and text()='完成']")

        webcmd.AddCmd(CmdType.CLICK, "//input[@id='demoAccountRequired']")
        webcmd.AddCmd(CmdType.INPUT, "//input[@id='contactFirstName']",
                      "YuanFang")
        webcmd.AddCmd(CmdType.INPUT, "//input[@id='contactLastName']", "Chen")
        webcmd.AddCmd(CmdType.INPUT, "//input[@id='contactPhone']",
                      "+8617370716836")
        webcmd.AddCmd(CmdType.INPUT, "//input[@id='contactEmail']",
                      "*****@*****.**")

        key = "//button[text()='存储']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)