Ver Fonte

MOD:计划---投放部分bug-fix

cxyu há 3 anos atrás
pai
commit
73916f5f24
2 ficheiros alterados com 14 adições e 31 exclusões
  1. 8 6
      wechat_action/create_ad_layout.py
  2. 6 25
      wechat_action/create_ad_plan.py

+ 8 - 6
wechat_action/create_ad_layout.py

@@ -441,12 +441,14 @@ class CreateAd:
                     _.get_attribute("value") == '07C160' or _.get_attribute("value") == 'FFFFFF'):
                 input_elements_can_use.append(_)
 
-        input_elements_can_use[0].click()
-        input_elements_can_use[0].send_keys(config_info['textColor'])
-        time.sleep(random.uniform(0.1, 0.5))
-        input_elements_can_use[1].click()
-        input_elements_can_use[1].send_keys(config_info['borderColor'])
-        time.sleep(random.uniform(0.1, 0.5))
+        if config_info['borderColor'] != '#FFFFFF':
+            input_elements_can_use[0].click()
+            input_elements_can_use[0].send_keys(config_info['textColor'])
+            time.sleep(random.uniform(0.1, 0.5))
+        if config_info['borderColor'] != '#FFFFFF':
+            input_elements_can_use[1].click()
+            input_elements_can_use[1].send_keys(config_info['borderColor'])
+            time.sleep(random.uniform(0.1, 0.5))
         input_elements_can_use[2].click()
         input_elements_can_use[2].send_keys(config_info['backColor'])
         time.sleep(random.uniform(0.1, 0.5))

+ 6 - 25
wechat_action/create_ad_plan.py

@@ -23,7 +23,6 @@ class CreateAdPlan():
         self.ad_human_action = HumanAd(self.driver)
 
     def set_ad_title(self):
-        # TODO:广告和投放计划,都需要修改名字,修改成一个名字
         logging.info('开始设置广告标题')
         title_ = self.driver.find_element_by_xpath('//*[@class="input-2lFnByGCRh"]')
         for i in range(40):
@@ -105,6 +104,7 @@ class CreateAdPlan():
         next_button.click()
 
     def set_ad_time(self):
+        # TODO:log 添加user_id方便后期查看
         logging.info('设置对应投放时间')
         WebDriverWait(self.driver, 10).until(
             lambda driver: self.driver.find_elements_by_xpath('//*[@class="adui-input-base"]'))
@@ -112,6 +112,10 @@ class CreateAdPlan():
 
         if self.task['date_set']['date_module'] == '2':
             print(self.task['date_set']['date_list'])
+            select_elements = self.driver.find_elements_by_xpath('//*[@class="adui-radio-base adui-radio-small"]')
+            for _ in select_elements:
+                if '长期投放' in _.text:
+                    _.click()
 
             input_elements[0].click()
             time.sleep(0.1)
@@ -127,22 +131,7 @@ class CreateAdPlan():
 
             time.sleep(random.uniform(0.1, 0.2))
 
-            if self.task['date_set']['date_module'] == '2':
-                select_elements = self.driver.find_elements_by_xpath('//*[@class="adui-radio-base adui-radio-small"]')
-                for _ in select_elements:
-                    if '长期投放' in _.text:
-                        _.click()
-
-        # time.sleep(0.1)
-        # # 使用日期表格进行选择
-        # time_form = self.driver.find_element_by_xpath('//*[@class="adui-input-right adui-input-right_icon"]')
-        # time_form.click()
-        # time.sleep(0.2)
-        # time_form_es = self.driver.find_elements_by_xpath('//*[@class="adui-date-day"]')
-        # for _ in time_form_es:
-        #     print(_.text)
-        # time_form_es[4].click()
-        # time.sleep(0.2)
+
 
         else:
             input_elements[0].click()
@@ -210,13 +199,6 @@ class CreateAdPlan():
         time.sleep(random.uniform(0.2, 0.3))
         bid_cost.send_keys(self.task['cost']['bid'])
         self.driver.find_element_by_css_selector('#target_next_step').click()
-        self.driver.save_screenshot('click-timely{}.png'.format(time.time()))
-
-        # show
-        title_element = self.driver.find_element_by_xpath('//*[@id="ad_name"]/input')
-        ActionChains(self.driver).move_to_element(title_element).perform()
-        time.sleep(1)
-        self.driver.save_screenshot('click{}.png'.format(time.time()))
 
     def set_ad_human(self):
         # TODO:检查人群是否正常
@@ -369,7 +351,6 @@ class CreateAdPlan():
             self.set_ad_age()
 
             self.set_ad_cost()
-
             self.set_ad_idea()
             self.push_ad()