Example #1
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)
Example #2
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()