Browse Source

MOD:修改函数名

cxyu 3 years ago
parent
commit
6101357a57

+ 86 - 27
web_module/user_action.py

@@ -1,6 +1,7 @@
 from wechat_action.sql_tools import save_wechat_cookies, save_human_info, delete_wechat_info, save_wechat_info
 from wechat_action.sql_tools import save_wechat_cookies, save_human_info, delete_wechat_info, save_wechat_info
 from wechat_api.get_wechat_info import WechatApi
 from wechat_api.get_wechat_info import WechatApi
-from wechat_action.create_ad import CreateAd
+from wechat_action.create_ad_layout import CreateAd
+from wechat_action.create_ad_plan import CreateAdPlan
 from wechat_action import sql_tools
 from wechat_action import sql_tools
 from sqlalchemy import Table
 from sqlalchemy import Table
 import json
 import json
@@ -134,6 +135,7 @@ def create_layout(user_id, layout_name, wechat_json, log_ad, db, cookie_canuse):
         return
         return
     print(typesetting_json)
     print(typesetting_json)
     typesetting_dict = json.loads(typesetting_json)
     typesetting_dict = json.loads(typesetting_json)
+    typesetting_dict[-4] = {'layout_name': layout_name}
     # action 进行对应记录
     # action 进行对应记录
     wechat_json = json.loads(wechat_json)
     wechat_json = json.loads(wechat_json)
     for _ in wechat_json:
     for _ in wechat_json:
@@ -148,45 +150,102 @@ def create_layout(user_id, layout_name, wechat_json, log_ad, db, cookie_canuse):
     for _ in wechat_json:
     for _ in wechat_json:
         service_name = _['service_name']
         service_name = _['service_name']
         wechat_name = _['wechat_name']
         wechat_name = _['wechat_name']
+        # 检查落地页之前有无创建过
+        layout_num = sql_tools.check_layout_alive(sql_session, service_name, wechat_name, layout_name)
+        if layout_num:
+            continue
         log_ad.select_ad_master(service_name, wechat_name)
         log_ad.select_ad_master(service_name, wechat_name)
-        res = CreateAd(login_ad=log_ad, user_id=user_id).create_layout(typesetting_dict)
+        res = CreateAd(login_ad=log_ad, service_name=service_name, wechat_name=wechat_name).create_layout(
+            typesetting_dict)
         print(res)
         print(res)
         if not res['sucess']:
         if not res['sucess']:
             now_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
             now_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
             try:
             try:
-                log_ad.driver.save_screenshot('{layout_name}-{now_time}-{service_name}-{wechat_name}.png'.format(
-                    layout_name=layout_name,
-                    now_time=now_time,
-                    service_name=service_name,
-                    wechat_name=wechat_name))
+                log_ad.driver.save_screenshot(
+                    'create_ad_layout-{layout_name}-{now_time}-{service_name}-{wechat_name}.png'.format(
+                        layout_name=layout_name,
+                        now_time=now_time,
+                        service_name=service_name,
+                        wechat_name=wechat_name))
             except:
             except:
                 pass
                 pass
-            # 截图,传回错误信息
+            # TODO:截图,传回错误信息
 
 
-        status = 'done' if res['sucess'] else 'error'
-        action_type = json.dumps({'action_type': 'layout_create', 'object_name': layout_name})
-        # TODO:线上落地页名字进行设置
-        update_res = action_record_table.update() \
-            .where(action_record_table.c.service_name == service_name) \
-            .where(action_record_table.c.wechat_name == wechat_name) \
-            .where(action_record_table.c.user_id == user_id) \
-            .where(action_record_table.c.action_type == action_type) \
-            .values({
-            action_record_table.c.status: status,
-            action_record_table.c.result: res['result_info']
-            })
-        # values 添加两个列
-        sql_session.execute(update_res)
-        sql_session.commit()
+        sql_tools.action_record(res, sql_session, user_id, layout_name, action_record_table, service_name, wechat_name)
         log_ad.refresh_driver()
         log_ad.refresh_driver()
 
 
-
     # 成功一个record,更新一个record
     # 成功一个record,更新一个record
-    log_ad.refresh_driver()
+    log_ad.driver.quite()
 
 
 
 
-def create_ad_plan():
-    pass
+def create_ad_plan(user_id, ad_plan_name, wechat_json, log_ad, db, cookie_canuse):
+    # TODO:
+    #  1.任务有不断中途新增,该如何操作.------只管
+    #  2.落地页创建一半失败了怎么办
+    #  4.cookie记录每次刷新都会失效,需要改进
+
+    action_record_table = Table('action_record', db.metadata,
+                                autoload=True, autoload_with=db.engine)
+    sql_session = db.DBSession()
+    # 等待页面加载完成
+
+    # 1.cookies保存
+    cookie_acion(db, log_ad, cookie_canuse, user_id)
+
+    # 获取到对应layout
+    typesetting_json = sql_tools.get_ad_plan_typesetting(sql_session=sql_session, user_id=user_id,
+                                                         typesetting_name=ad_plan_name)
+    if not typesetting_json:
+        return
+    print(typesetting_json)
+    typesetting_dict = json.loads(typesetting_json)
+    typesetting_dict['title'] = ad_plan_name
+    # action 进行对应记录
+    wechat_json = json.loads(wechat_json)
+    for _ in wechat_json:
+        # TODO:有时间看看 create_layout与create_ad_plan是否需要合并
+        # TODO:action_type 名字设置
+        action_info = {'user_id': user_id, 'service_name': _['service_name'], 'wechat_name': _['wechat_name'],
+                       'action_type': json.dumps({'action_type': 'ad_plan_create', 'object_name': ad_plan_name}),
+                       'status': 'todo'}
+        record_insert = sql_tools.save_action_record(action_record_info=action_info,
+                                                     table_action_record=action_record_table)
+        sql_session.execute(record_insert)
+        sql_session.commit()
+
+    for _ in wechat_json:
+        service_name = _['service_name']
+        wechat_name = _['wechat_name']
+        # 检查这个名字是否已经创建过
+        layout_name = typesetting_dict['idea']['jump_type-page_type']
+        if not sql_tools.check_layout_alive(sql_session, service_name, wechat_name, layout_name):
+            res = {'sucess': False, 'result_info': '公众号对应落地页未创建'}
+            sql_tools.action_record(res, sql_session, user_id, ad_plan_name, action_record_table, service_name,
+                                    wechat_name)
+            continue
+        if sql_tools.check_plan_alive(sql_session, service_name, wechat_name, ad_plan_name):
+            continue
+        log_ad.select_ad_master(service_name, wechat_name)
+        res = CreateAdPlan(login_ad=log_ad, task=typesetting_dict).run()
+        print(res)
+        if not res['sucess']:
+            now_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+            try:
+                log_ad.driver.save_screenshot(
+                    'create_ad_plan-{plan_name}-{now_time}-{service_name}-{wechat_name}.png'.format(
+                        plan_name=ad_plan_name,
+                        now_time=now_time,
+                        service_name=service_name,
+                        wechat_name=wechat_name))
+            except:
+                pass
+            # 截图,传回错误信息
+
+        sql_tools.action_record(res, sql_session, user_id, ad_plan_name, action_record_table, service_name, wechat_name)
+        log_ad.refresh_driver()
+
+    # 成功一个record,更新一个record
+    log_ad.driver.quit()
 
 
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":

+ 10 - 9
wechat_action/create_ad_layout.py

@@ -10,8 +10,10 @@ import os
 
 
 
 
 class CreateAd:
 class CreateAd:
-    def __init__(self, login_ad, user_id):
-        self.user_id = user_id
+    def __init__(self, login_ad, service_name, wechat_name):
+        self.log_ad = login_ad
+        self.service_name = service_name
+        self.wechat_name = wechat_name
         self.driver = login_ad.get_driver_loged()
         self.driver = login_ad.get_driver_loged()
         self.get_into_create_page()
         self.get_into_create_page()
         self.send_file_limit_num = 8
         self.send_file_limit_num = 8
@@ -31,14 +33,12 @@ class CreateAd:
         self.driver.find_element_by_class_name('addContent-8pexaaAGYy').click()
         self.driver.find_element_by_class_name('addContent-8pexaaAGYy').click()
         WebDriverWait(self.driver, 100).until(lambda driver: driver.find_element_by_class_name('topArea-qOwEAeNuIn'))
         WebDriverWait(self.driver, 100).until(lambda driver: driver.find_element_by_class_name('topArea-qOwEAeNuIn'))
 
 
-    def set_advertisement_sign(self):
+    def set_advertisement_sign(self, layout_name):
         # 设置广告标记
         # 设置广告标记
-        now_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
         self.driver.find_element_by_xpath('//*[@class="icon-edQB0KK2VG"]').click()
         self.driver.find_element_by_xpath('//*[@class="icon-edQB0KK2VG"]').click()
         input_element = self.driver.find_element_by_xpath('//input[@class="input-2lFnByGCRh"]')
         input_element = self.driver.find_element_by_xpath('//input[@class="input-2lFnByGCRh"]')
         input_element.send_keys(Keys.BACKSPACE)
         input_element.send_keys(Keys.BACKSPACE)
-        input_element.send_keys(now_time)
-        return now_time
+        input_element.send_keys(layout_name)
 
 
     def set_background_color(self):
     def set_background_color(self):
         color_buttons = self.driver.find_elements_by_class_name('adui-cp-picker')
         color_buttons = self.driver.find_elements_by_class_name('adui-cp-picker')
@@ -687,7 +687,7 @@ class CreateAd:
         #
         #
         try:
         try:
             self.send_file_alone(layout)
             self.send_file_alone(layout)
-            advertisement_sign = self.set_advertisement_sign()
+            self.set_advertisement_sign(layout_name=layout[-4]['layout_name'])
             self.set_head_assemb(layout[str(-1)])
             self.set_head_assemb(layout[str(-1)])
             if -2 in layout.keys():
             if -2 in layout.keys():
                 self.set_background_color()
                 self.set_background_color()
@@ -708,8 +708,9 @@ class CreateAd:
             # 切回到前一页
             # 切回到前一页
             self.driver.switch_to.window(self.driver.window_handles[-1])
             self.driver.switch_to.window(self.driver.window_handles[-1])
 
 
-            return {'sucess': True, 'result_info': advertisement_sign}
+            return {'sucess': True, 'result_info': ''}
         except Exception as e:
         except Exception as e:
+            raise
             # TODO:有空时讲 e 内容设置为原始内容
             # TODO:有空时讲 e 内容设置为原始内容
             if err_num > 3:
             if err_num > 3:
                 return {'sucess': False, 'result_info': str(e)}
                 return {'sucess': False, 'result_info': str(e)}
@@ -724,7 +725,7 @@ class CreateAd:
 if __name__ == '__main__':
 if __name__ == '__main__':
     logging.basicConfig(
     logging.basicConfig(
         handlers=[
         handlers=[
-            logging.handlers.RotatingFileHandler('./create_ad.log',
+            logging.handlers.RotatingFileHandler('./create_ad_layout.log',
                                                  maxBytes=10 * 1024 * 1024,
                                                  maxBytes=10 * 1024 * 1024,
                                                  backupCount=5,
                                                  backupCount=5,
                                                  encoding='utf-8')
                                                  encoding='utf-8')

+ 46 - 18
wechat_action/create_ad_plan.py

@@ -3,22 +3,23 @@ from selenium.webdriver import ActionChains
 from selenium.webdriver.common.by import By
 from selenium.webdriver.common.by import By
 from selenium.webdriver.support import expected_conditions as EC
 from selenium.webdriver.support import expected_conditions as EC
 from selenium.webdriver.support.wait import WebDriverWait
 from selenium.webdriver.support.wait import WebDriverWait
-from wechat_action.send_ad_idea import IdeaAction
+from wechat_action.create_ad_plan_idea import IdeaAction
 from wechat_action.human_ad import HumanAd
 from wechat_action.human_ad import HumanAd
 from selenium.webdriver.common.keys import Keys
 from selenium.webdriver.common.keys import Keys
 from wechat_action.login_ad import LogIn
 from wechat_action.login_ad import LogIn
 from selenium.webdriver import ChromeOptions
 from selenium.webdriver import ChromeOptions
-
+import re
 import time
 import time
 import random
 import random
 
 
 
 
-class SendAd():
+class CreateAdPlan():
     # TODO:一旦登录之后,driver就不要关闭,然后错误就部分不断重试
     # TODO:一旦登录之后,driver就不要关闭,然后错误就部分不断重试
 
 
     def __init__(self, task, login_ad):
     def __init__(self, task, login_ad):
         self.task = task
         self.task = task
         # self.task_check()
         # self.task_check()
+        self.login_ad=login_ad
         self.driver = login_ad.get_driver_loged()
         self.driver = login_ad.get_driver_loged()
         self.ad_idea_action = IdeaAction(self.driver, task)
         self.ad_idea_action = IdeaAction(self.driver, task)
         self.ad_human_action = HumanAd(self.driver)
         self.ad_human_action = HumanAd(self.driver)
@@ -178,20 +179,47 @@ class SendAd():
         self.driver.find_element_by_class_name('icon-3cAquX1RLZ').click()
         self.driver.find_element_by_class_name('icon-3cAquX1RLZ').click()
         time.sleep(random.uniform(0.5, 1))
         time.sleep(random.uniform(0.5, 1))
         self.driver.find_element_by_class_name('adui-button-primary').click()
         self.driver.find_element_by_class_name('adui-button-primary').click()
+        WebDriverWait(self.driver, 10).until(
+            lambda driver: True if len(
+                re.findall('广告已提交审核', self.driver.page_source)) else False)
 
 
     def task_check(self):
     def task_check(self):
-        # TODO:检查任务有无输入问题,
-        #   需要重点确认输入金额,时间是否正确.从最后页面内容进行再次确认
-        if 'master' not in self.task.keys() or 'localtion' not in self.task.keys():
-            exit()
-
-    def run(self):
-        # self.ad_human_action.check_human_info()
-        self.set_ad_locations()
-        self.set_ad_time()
-        self.set_ad_title()
-        self.set_ad_human_location()
-        self.set_ad_human()
-        self.set_ad_cost()
-        self.set_ad_idea()
-        self.push_ad()
+        # TODO:
+        #   1.检查任务有无输入问题,
+        #   2.需要重点确认输入金额,时间是否正确.从最后页面内容进行再次确认
+        # if 'master' not in self.task.keys() or 'localtion' not in self.task.keys():
+        #     exit()
+        pass
+
+    def check_ad_plan_alive(self):
+        # TODO:通过宿舍检查ad_plan是否已经存在
+        pass
+
+    def check_is_sucess(self):
+        # TODO: 检查是否创建成功
+        pass
+
+    def run(self, err_num=0):
+        try:
+            # self.ad_human_action.check_human_info()
+            self.set_ad_locations()
+            self.set_ad_time()
+            self.set_ad_title()
+            self.set_ad_human_location()
+            self.set_ad_human()
+            self.set_ad_cost()
+            self.set_ad_idea()
+            self.push_ad()
+
+            # 切回到前一页
+            self.driver.switch_to.window(self.driver.window_handles[-1])
+
+            return {'sucess': True, 'result_info': ''}
+        except Exception as e:
+            # TODO:有空时讲 e 内容设置为原始内容
+            if err_num > 3:
+                return {'sucess': False, 'result_info': str(e)}
+            else:
+                return self.run(err_num=err_num + 1)
+            pass
+

+ 23 - 14
wechat_action/login_ad.py

@@ -3,7 +3,7 @@ from selenium.webdriver import ActionChains
 from selenium.webdriver.common.by import By
 from selenium.webdriver.common.by import By
 from selenium.webdriver.support import expected_conditions as EC
 from selenium.webdriver.support import expected_conditions as EC
 from selenium.webdriver.support.wait import WebDriverWait
 from selenium.webdriver.support.wait import WebDriverWait
-from wechat_action.send_ad_idea import IdeaAction
+from wechat_action.create_ad_plan_idea import IdeaAction
 from wechat_action.human_ad import HumanAd
 from wechat_action.human_ad import HumanAd
 from selenium.webdriver import ChromeOptions
 from selenium.webdriver import ChromeOptions
 from selenium.webdriver.common.keys import Keys
 from selenium.webdriver.common.keys import Keys
@@ -29,13 +29,13 @@ class LogIn:
     def get_driver(self):
     def get_driver(self):
         options = ChromeOptions()
         options = ChromeOptions()
         # 防止selenium快速崩坏
         # 防止selenium快速崩坏
-        options.add_argument("--disable-dev-shm-usage")
-        # options.add_experimental_option('excludeSwitches', ['enable-automation'])
+        # options.add_argument("--disable-dev-shm-usage")
+        options.add_experimental_option('excludeSwitches', ['enable-automation'])
         # prefs = {"profile.managed_default_content_settings.images": 2, 'permissions.default.stylesheet': 2}
         # prefs = {"profile.managed_default_content_settings.images": 2, 'permissions.default.stylesheet': 2}
         # options.add_experimental_option("prefs", prefs)
         # options.add_experimental_option("prefs", prefs)
-
+        # #
         # driver = webdriver.Remote(
         # driver = webdriver.Remote(
-        #     command_executor='http://47.114.6.178:4444/wd/hub',
+        #     command_executor='http://118.31.53.105:4444/wd/hub',
         #     options=options)
         #     options=options)
         driver = webdriver.Chrome(options=options)
         driver = webdriver.Chrome(options=options)
         driver.maximize_window()
         driver.maximize_window()
@@ -57,7 +57,7 @@ class LogIn:
 
 
     def log_in_wait(self):
     def log_in_wait(self):
         # 默认等待6分钟
         # 默认等待6分钟
-        WebDriverWait(self.driver, 6 * 60).until(lambda driver: driver.find_elements_by_link_text('广告投放'))
+        WebDriverWait(self.driver, 6 * 60).until(lambda driver: self.driver.find_elements_by_link_text('广告投放'))
 
 
     def select_ad_master(self, service_name, wechat_name):
     def select_ad_master(self, service_name, wechat_name):
         time.sleep(5)
         time.sleep(5)
@@ -149,12 +149,21 @@ class LogIn:
         return self.driver
         return self.driver
 
 
     def refresh_driver(self):
     def refresh_driver(self):
+        err_num = 0
         while True:
         while True:
-            if len(self.driver.window_handles) > 1:
-                self.driver.switch_to.window(self.driver.window_handles[-1])
-                self.driver.execute_script('window.close();')
-                time.sleep(0.1)
-            else:
-                self.driver.switch_to.window(self.driver.window_handles[-1])
-                self.driver.get('https://a.weixin.qq.com/client')
-                break
+            try:
+                if len(self.driver.window_handles) > 1:
+                    self.driver.switch_to.window(self.driver.window_handles[-1])
+                    self.driver.execute_script('window.close();')
+                    time.sleep(1)
+                    # 规避有弹窗的情况
+                    self.driver.switch_to.alert.accept()
+                else:
+                    self.driver.switch_to.window(self.driver.window_handles[-1])
+                    self.driver.get('https://a.weixin.qq.com/client')
+                    break
+            except Exception as e:
+                print(e)
+                err_num = err_num + 1
+                if err_num > 3:
+                    break

+ 72 - 1
wechat_action/sql_tools.py

@@ -1,3 +1,6 @@
+import json
+
+
 # def save_ad_layout_result(layout_info, table_layout):
 # def save_ad_layout_result(layout_info, table_layout):
 #     insert_layout = table_layout.insert()
 #     insert_layout = table_layout.insert()
 #     insert_layout = insert_layout.values \
 #     insert_layout = insert_layout.values \
@@ -37,6 +40,17 @@ def save_layout_typesetting_info(layout_typesetting_info, table_layout_typesetti
     return insert_layout_typesetting
     return insert_layout_typesetting
 
 
 
 
+def save_ad_plan_typesetting_info(ad_plan_typesetting_info, table_ad_plan_typesetting):
+    #TODO:正常action_record  返回plan_name layout_name有问题
+    insert_ad_plan_typesetting = table_ad_plan_typesetting.insert()
+    insert_ad_plan_typesetting = insert_ad_plan_typesetting.values \
+        (typesetting=ad_plan_typesetting_info['typesetting'],
+         user_id=ad_plan_typesetting_info['user_id'],
+         name=ad_plan_typesetting_info['name']
+         )
+    return insert_ad_plan_typesetting
+
+
 def save_wechat_info(wechat_info, table_wechat):
 def save_wechat_info(wechat_info, table_wechat):
     insert_wechat = table_wechat.insert()
     insert_wechat = table_wechat.insert()
     insert_wechat = insert_wechat.values \
     insert_wechat = insert_wechat.values \
@@ -48,6 +62,7 @@ def save_wechat_info(wechat_info, table_wechat):
 
 
 
 
 def save_action_record(action_record_info, table_action_record):
 def save_action_record(action_record_info, table_action_record):
+    # TODO:service_name ,wechat_name,action_type 设置全局唯一
     insert_action_record = table_action_record.insert()
     insert_action_record = table_action_record.insert()
     insert_action_record = insert_action_record.values \
     insert_action_record = insert_action_record.values \
         (service_name=action_record_info['service_name'],
         (service_name=action_record_info['service_name'],
@@ -83,7 +98,19 @@ def get_human_info(sql_session, user_id):
 
 
 def get_layout_typesetting(sql_session, user_id, typesetting_name):
 def get_layout_typesetting(sql_session, user_id, typesetting_name):
     sql = '''
     sql = '''
-            select * from layout_typesetting lt 
+            select typesetting from layout_typesetting lt 
+            where user_id ='{}' and name='{}';
+    '''.format(user_id, typesetting_name)
+    cursor = sql_session.execute(sql)
+    lines = cursor.fetchall()
+    if lines:
+        result_list = lines[0][0]
+        return result_list
+
+
+def get_ad_plan_typesetting(sql_session, user_id, typesetting_name):
+    sql = '''
+            select typesetting from ad_plan_typesetting lt 
             where user_id ='{}' and name='{}';
             where user_id ='{}' and name='{}';
     '''.format(user_id, typesetting_name)
     '''.format(user_id, typesetting_name)
     cursor = sql_session.execute(sql)
     cursor = sql_session.execute(sql)
@@ -118,6 +145,50 @@ def get_action_status(sql_session, user_id):
     result = lines[0][0]
     result = lines[0][0]
     return result
     return result
 
 
+def action_record(res, sql_session, user_id, object_name, action_table, service_name, wechat_name):
+    status = 'done' if res['sucess'] else 'error'
+    action_type = json.dumps({'action_type': 'ad_plan_create', 'object_name': object_name})
+    update_res = action_table.update() \
+        .where(action_table.c.service_name == service_name) \
+        .where(action_table.c.wechat_name == wechat_name) \
+        .where(action_table.c.user_id == user_id) \
+        .where(action_table.c.action_type == action_type) \
+        .values({
+        action_table.c.status: status,
+        action_table.c.result: res['result_info']
+    })
+    # values 添加两个列
+    sql_session.execute(update_res)
+    sql_session.commit()
+
+def check_layout_alive(sql_session, service_name, wechat_name, layout_name):
+    sql = '''
+            select count(*) from action_record ar 
+        where service_name='{service_name}'
+        and wechat_name='{wechat_name}'
+        and action_type like '%layout_create%'
+        and action_type like '%{layout_name}%'
+        and status='done'
+    '''.format(service_name=service_name, wechat_name=wechat_name, layout_name=layout_name)
+    print(sql)
+    cursor = sql_session.execute(sql)
+    num = cursor.fetchall()[0][0]
+    return num
+
+
+def check_plan_alive(sql_session, service_name, wechat_name, plan_name):
+    sql = '''
+               select count(*) from action_record ar 
+           where service_name='{service_name}'
+           and wechat_name='{wechat_name}'
+           and action_type like '%ad_plan_create%'
+           and action_type like '%{plan_name}%'
+           and status='done'
+       '''.format(service_name=service_name, wechat_name=wechat_name, plan_name=plan_name)
+    cursor = sql_session.execute(sql)
+    num = cursor.fetchall()[0][0]
+    return num
+
 
 
 def get_wechat_info(sql_session, user_id):
 def get_wechat_info(sql_session, user_id):
     sql = '''
     sql = '''

+ 1 - 1
wechat_api/get_wechat_info.py

@@ -3,7 +3,7 @@ from selenium.webdriver import ActionChains
 from selenium.webdriver.common.by import By
 from selenium.webdriver.common.by import By
 from selenium.webdriver.support import expected_conditions as EC
 from selenium.webdriver.support import expected_conditions as EC
 from selenium.webdriver.support.wait import WebDriverWait
 from selenium.webdriver.support.wait import WebDriverWait
-from wechat_action.send_ad_idea import IdeaAction
+from wechat_action.create_ad_plan_idea import IdeaAction
 from wechat_action.human_ad import HumanAd
 from wechat_action.human_ad import HumanAd
 from selenium.webdriver import ChromeOptions
 from selenium.webdriver import ChromeOptions
 from selenium.webdriver.common.keys import Keys
 from selenium.webdriver.common.keys import Keys