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)
Example #2
0
    def GetLocalHtmlKeyWord(self, isHD):
        # url = "https://www.qimai.cn/trend/keywordExtend/keyword/"+word 
        url = "file:///F:/sourcecode/unity/aso_web/app.html"
        if isHD:
            url = "file:///F:/sourcecode/unity/aso_web/app_hd.html"
        print(url)
        self.driver.get(url)
        webcmd = WebDriverCmd(self.driver)

        key = "//a[@class='search-word']"
        list = webcmd.FindList(key,True)
        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
Example #3
0
    def SearchAppGetAdInfo(self, ishd):
        self.SearchApp(ishd)
        webcmd = WebDriverCmd(self.driver)

        # 关联广告位
        key = "//a[@style='cursor: pointer;']"
        item = webcmd.Find(key, True)
        item = webcmd.AddCmdList(CmdType.CLICK_Action, key, 1, 1)
        webcmd.Run(True)

        # 关联广告位
        # <a style="cursor: pointer;">关联广告位</a>
        # list = self.driver.find_elements(
        #     By.XPATH, )
        # a = list[1]
        # a.click()
        time.sleep(1)

        # table media-table js-media-details
        # table = self.driver.find_element(By.XPATH, "//table[@class='table media-table js-media-details']")
        # list = table.find_elements_by_xpath('//tbody/tr')
        # print("tr len =",len(list))
        # print(table.get_attribute('innerHTML'))
        # for tr in list:
        #     span_list = tr.find_elements_by_xpath("//span")
        #     # [@class='field-value']
        #     # print(span_list[1].text)

        self.ParseAdInfo(ishd)
    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)
Example #5
0
    def LoginQQ(self, user, password):
        # 3452644866
        webcmd = WebDriverCmd(self.driver)
        print("waiting for login")
        time.sleep(2)
        webcmd.WaitKeyBoard("q")
        return
        # 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.driver.switch_to.frame("ptlogin_iframe")
        time.sleep(2)

        # key =  "//div[@id='qqLoginCt']"
        # webcmd.AddCmdWait(CmdType.CLICK,key)
        # webcmd.Run(True)

        self.driver.find_element_by_id('switcher_plogin').click()
        time.sleep(1)

        item = self.driver.find_element(By.XPATH, "//input[@id='u']")
        item.send_keys(user)

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

        item = self.driver.find_element(By.XPATH,
                                        "//input[@id='login_button']")
        item.click()
        time.sleep(5)
Example #6
0
    def SearchApp(self, ishd):
        name = self.GetAppName(ishd)
        self.driver.get("https://adnet.qq.com/medium/list")
        time.sleep(3)

        webcmd = WebDriverCmd(self.driver)
        key = "//input[@class='form-control']"
        item = webcmd.Find(key, True)
        time.sleep(1)
        item.send_keys(name)
        # item.send_keys("儿童写汉字")

        time.sleep(1)

        # search
        self.driver.find_element_by_id('search_medium_id').click()
        time.sleep(2)

        # 筛选
        item = self.driver.find_element(
            By.XPATH, "//button[@class='btn filter-operate']")
        # item = self.driver.find_element(By.XPATH, "//div[@class='filter-parent-control']")

        # error
        # item.click()
        self.driver.execute_script("arguments[0].click();", item)
        time.sleep(2)

        # <input type="checkbox" class="check" name="" value="IOS">
        if self.osApp == Source.ANDROID:
            item = self.driver.find_element(By.XPATH,
                                            "//input[@value='Android']")
            # item.click()
            self.driver.execute_script("arguments[0].click();", item)
            time.sleep(1)

        if self.osApp == Source.IOS:
            item = self.driver.find_element(By.XPATH, "//input[@value='IOS']")
            # item.click()
            self.driver.execute_script("arguments[0].click();", item)
            time.sleep(1)

        # 确定
        item = self.driver.find_element(By.XPATH,
                                        "//button[@class='btn btn-primary']")
        # item.click()
        self.driver.execute_script("arguments[0].click();", item)
        time.sleep(2)

        # 点击第一个
        # <span class="media-heading" title="天天开心拼图">天天开心拼图</span>
        # key = "//span[@class='media-heading' and title ='"+name+"']"
        key = "//span[@class='media-heading']"
        list = self.driver.find_elements(By.XPATH, key)
        for span in list:
            if span.get_attribute('title') == name:
                span.click()
                time.sleep(1)
 def GetApkUrl(self, appid):
     html = self.GetHtml(appid)
     webcmd = WebDriverCmd(self.driver)
     strappid = "C" + appid
     key = "//div[@appid='" + strappid + "']"
     item = webcmd.Find(key)
     url = item.get_attribute("apkdownloadurl")
     print("apk=", url)
     return url
Example #8
0
    def GetAdInfo(self, ishd):
        print("GetAdInfo ishd=", ishd)
        self.SearchApp(ishd)

        name = self.GetAppName(ishd)
        webcmd = WebDriverCmd(self.driver)
        # self.driver.get("http://union.baidu.com/bqt/appco.html#/union/slot")
        # http://union.baidu.com/bqt/appco.html#/union/slot?system=2&appId=275514138
        system = 1
        if self.osApp == Source.ANDROID:
            system = 2

        if self.osApp == Source.IOS:
            system = 1

        url = "http://union.baidu.com/bqt/appco.html#/union/slot?system=" + str(
            system) + "&appId=" + self.appKey
        print("GetAdInfo url=", url)
        self.driver.get(url)
        time.sleep(3)
        key = "//div[@id='watermarker-id']"
        div_main = webcmd.Find(key)

        key = ".//table[@ui='slim alt' and @class='veui-table']"
        table = webcmd.FindChild(div_main, key)
        # <table ui="slim alt" class="veui-table">

        # <input type="text" autocomplete="off" role="searchbox" aria-haspopup="listbox" class="veui-input-input">
        # key = "//input[@type='text' and @role='searchbox']"
        # webcmd.AddCmd(CmdType.INPUT, key,name)
        # webcmd.Run(True)
        # https://blog.csdn.net/weixin_41858542/article/details/85068645
        # WebElement parent = child.findElement(By.xpath("./.."));// 找到父元素
        # List<WebElement> children = parent.findElements(By.xpath("./*"));// 找到所有子元素
        # <div class="veui-table-cell"><div title="激励视频 创建于 2020-07-29" class="slot-cell">激励视频 创建于 2020-07-29</div><div class="tableID filter-cell">ID:7177592</div></div>
        key = "//div[@class='tableID filter-cell' and contains(text(),'ID:')]"
        list = webcmd.FindList(key)
        for item in list:
            adid = self.GetAdPlaceId(item.text)
            # 兄弟节点
            brother = item.find_element_by_xpath(
                ".//../div[@class='slot-cell']")
            title = brother.text
            print(title)
            if title.find(self.BANNER) >= 0:
                self.adIdBanner = adid
            if title.find(self.INSERT) >= 0:
                self.adIdInsert = adid
            if title.find(self.VIDEO) >= 0:
                self.adIdVideo = adid

        self.SaveAdIdToJson(self.osApp, ishd, Source.BAIDU)
Example #9
0
 def GetAdId(self, tr, keyword):
     webcmd = WebDriverCmd(self.driver)
     adid = "0"
     key = ".//div[@class='inner']"
     list = webcmd.FindListChild(tr, key)
     # print("GetAdId list =",len(list))
     for div in list:
         # print("GetAdId keyword =",keyword," div.text=",div.text)
         if div.text == keyword:
             keytmp = ".//span[@class='field-value']"
             h4 = webcmd.FindChild(tr, keytmp)
             adid = h4.text
             # print("GetAdId adid = ", adid)
     return adid
    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)
Example #11
0
    def CreateAdInsert(self, isHD):
        webcmd = WebDriverCmd(self.driver)
        # self.driver.get("https://adnet.qq.com/placement/add")
        # https://adnet.qq.com/placement/60503466885129/add
        self.driver.get(self.urlCreatePlaceId)
        time.sleep(1)

        time.sleep(3)

        # div class="card-inner"
        key = "//div[@class='card-inner']"
        webcmd.AddCmdList(CmdType.CLICK_Action, key, 5, 2)
        webcmd.Run(True)

        # <ul class="union-card-list card-list-banner list-contain-1"
        key = "//ul[@class='union-card-list card-list-cp list-contain-2']"
        ul = webcmd.Find(key, True)

        # bug
        # list = ul.find_elements By.XPATH, "//li[@class='union-card-item']")
        # ok 查找子元素li
        list = ul.find_elements_by_xpath('li')

        list[1].click()
        time.sleep(1)

        # item = self.driver.find_element(By.XPATH, "//input[@class='spaui-input has-normal spaui-component']")
        list = self.driver.find_elements(By.XPATH, "//input[@type='text']")
        # self.driver.execute_script("arguments[0].scrollIntoView();", item)
        # self.driver.execute_script('window.scrollTo(0,1000000)')
        time.sleep(1)
        list[1].send_keys("i")

        # upload image
        # item = self.driver.find_element(
        #     By.XPATH, "//button[@id='spaui-uploader_2-empty']")
        # item.click()
        # time.sleep(1)
        # self.OpenFileBrowser()
        # time.sleep(1)
        self.UploadImage(True)

        # finish
        # item = self.driver.find_element(
        #     By.XPATH, "//button[@class='union-complete-btn spaui-button spaui-button-primary spaui-component']")
        # item.click()
        # time.sleep(1)
        # finish
        self.OnClickFinish()
Example #12
0
    def ParseMusicBoardList(self):
        url = "https://www.kugou.com/yy/html/rank.html?from=homepage"
        self.driver.get(url)
        time.sleep(1) 
        webcmd = WebDriverCmd(self.driver)

        key = "//div[@class='pc_temp_side']"
        div = webcmd.Find(key,True)        
        key = ".//ul/li/a"
        list = webcmd.FindListChild(div,key) 
        print("ParseMusicBoardList len=",len(list))
        for a in list:
            title =a.get_attribute('title')
            href =a.get_attribute('href')
            print(title)
            print(href) 
    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
Example #14
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
Example #15
0
    def ParseBoardMusicList(self):
        url = "https://www.kugou.com/yy/rank/home/1-6666.html?from=rank"
        self.driver.get(url)
        time.sleep(1) 
        webcmd = WebDriverCmd(self.driver)

        key = "//div[@class='pc_temp_songlist']"
        div = webcmd.Find(key,True)        
        key = ".//ul/li"
        list = webcmd.FindListChild(div,key) 
        print("ParseMusicBoardList len=",len(list))
        for li in list:
            key = ".//a[@data-active='playDwn']"
            a = webcmd.FindChild(li,key) 
            title =a.get_attribute('title')
            href =a.get_attribute('href')
            print(title)
            print(href) 
Example #16
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)
Example #17
0
    def ParseAdInfo(self, ishd):
        webcmd = WebDriverCmd(self.driver)

        self.adIdBanner = "0"
        self.adIdInsert = "0"
        self.adIdVideo = "0"
        self.adIdNative = "0"
        self.adIdSplash = "0"

        key = "//div[@class='media media-info-general']"
        div = webcmd.Find(key, True)
        key = ".//span[@class='text']"
        h4 = webcmd.FindChild(div, key)
        self.appName = h4.text
        print(self.appName)

        key = ".//span[@class='field-value']"
        h4 = webcmd.FindChild(div, key)
        self.appId = h4.text
        print(self.appId)

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

        key = ".//tr"
        list = webcmd.FindListChild(table, key)
        print("list =", len(list))
        if len(list) == 0:
            print("retry get ad list")
            self.ParseAdInfo(ishd)

        for tr in list:
            # 横幅
            if self.adIdBanner == "0":
                self.adIdBanner = self.GetAdId(tr, "Banner2.0")
                # print("Banner 0:", self.adIdBanner)

            # 插屏
            if self.adIdInsert == "0":
                self.adIdInsert = self.GetAdId(tr, "插屏2.0")

            # 激励视频
            if self.adIdVideo == "0":
                self.adIdVideo = self.GetAdId(tr, "激励视频")
            # 原生
            if self.adIdNative == "0":
                self.adIdNative = self.GetAdId(tr, "原生")

            # 开屏
            if self.adIdSplash == "0":
                self.adIdSplash = self.GetAdId(tr, "开屏")

        print("Banner:", self.adIdBanner)
        print("插屏:", self.adIdInsert)
        print("激励视频:", self.adIdVideo)
        print("原生:", self.adIdNative)
        print("开屏:", self.adIdSplash)

        self.SaveAdIdToJson(self.osApp, ishd, Source.GDT)
Example #18
0
    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)
Example #19
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)
Example #20
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
Example #21
0
    def Search(self, word):
        print(word)
        url = "https://www.kugou.com/yy/html/search.html#searchType=song&searchKeyWord="+word
        self.driver.get(url)
        time.sleep(1) 
        webcmd = WebDriverCmd(self.driver)

        key = "//div[@class='song_list']"
        div = webcmd.Find(key,True)
        key = ".//ul/li"
        list = webcmd.FindListChild(div,key) 
        print("Search len=",len(list))
        for li in list:
            key = ".//a[@class='song_name']" 
            if webcmd.IsElementChildExist(li,key):
                a = webcmd.FindChild(li,key)
                
                title =a.get_attribute('title')
                href =a.get_attribute('href')
                print(title)
                print(href) 
                # a.click()
                action= ActionChains(self.driver)
                action.click(a).perform()
                self.ParseMusicInfoWebCmd()
Example #22
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
Example #23
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
    def Switch2MainFrameView(self):
        webcmd = WebDriverCmd(self.driver)
        # 等待网页加载成功
        key = "//iframe[@id='mainIframeView']"
        while True:
            time.sleep(1)
            print("web is Switch2MainFrameView...")
            if self.IsElementExist(key) == True:
                print("web Switch2MainFrameView finish")
                break

        self.driver.switch_to.frame("mainIframeView")
        time.sleep(2)
Example #25
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)
Example #26
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)
Example #27
0
    def GetKeyWord(self, word):
        url = "https://www.qimai.cn/trend/keywordExtend/keyword/"+word  
        print(url)
        self.driver.get(url)
        webcmd = WebDriverCmd(self.driver)

        key = "//a[@class='search-word']"
        list = webcmd.FindList(key,True)
        aso = ""
        idx =0
        for a in list:
            text = a.text
            # print(text)
            if len(aso)<100:
                if idx==0:
                    aso=text
                else:
                    aso+=","+text

            idx+=1
        
        print(aso)
        return aso
Example #28
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
Example #29
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)
Example #30
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)