def main(task_info, mode): msg = '' error = '' start = datetime.now() print("[Script " + task_info['docker_name'] + "] start at ", start, '\n', task_info) try: me = MySelenium(task_info=task_info, mode=mode) me.set_comment_to_pic({ "跳转APP": 'images/douyin/jump2app.png', "APP图标": 'images/douyin/app_icon.png', "评论": 'images/douyin/comments.png', "更新": 'images/douyin/update.png', "分享": 'images/douyin/share.png', "复制链接": 'images/douyin/copylink.png', "跳过软件升级": 'images/douyin/ignore_upgrade.png', }) me._DEBUG = True me.run() except Exception as e: msg = '<<error>>' error = e finally: if APPSIMULATOR_MODE == MODE_MULTI: # multi nox mode m = Manager() m.nox_run_task_finally(taskId) common_log( True, task['taskId'], 'Script ' + task['docker_name'] + 'end.', msg + 'total times:' + str( (datetime.now() - start).seconds) + 's', error) return
def main(task, mode): msg = '' error = '' start = datetime.now() common_log(True, task['taskId'], 'task-{}'.format(task['taskId']), 'start', task) try: me = MySelenium(task_info=task, mode=mode) me.set_comment_to_pic({ "APP图标": 'images/miaopai/app_icon.png', "更新": 'images/miaopai/update.png', "分享": 'images/miaopai/share.png', "复制链接": 'images/miaopai/copylink.png', "跳过软件升级": 'images/miaopai/ignore_upgrade.png', }) # me._DEBUG = True me.run() except Exception as e: msg = '<<error>>' error = e finally: if APPSIMULATOR_MODE == MODE_MULTI: # multi nox mode m = Manager() m.nox_run_task_finally(taskId) common_log( True, task['taskId'], 'task-{} end.'.format(task['taskId']), msg + 'total times:' + str( (datetime.now() - start).seconds) + 's', error) return
def main(task_info, mode): msg = '' error = '' start = datetime.now() common_log(True, task['taskId'], 'Script ' + task['docker_name'], 'start', task) try: me = MySelenium(task_info=task_info, mode=mode) me.set_comment_to_pic({ "jump2app": 'images/toutiao/jump2app.png', "writeComment": 'images/toutiao/writeComment.png', "publish": 'images/toutiao/publish.png', }) me._DEBUG = True # me.set_gps(39.984727, 116.310050) # 中关村 me.run() end = datetime.now() print("[Script " + task_info['docker_name'] + "] total times:", str((end - start).seconds) + "s") except Exception as e: msg = '<<error>>' error = e finally: if APPSIMULATOR_MODE == MODE_MULTI: # multi nox mode m = Manager() m.nox_run_task_finally(taskId) common_log(True, task['taskId'], 'Script ' + task['docker_name'] + 'end.', msg + 'total times:' + str((datetime.now() - start).seconds) + 's', error) return
def main(task, mode): msg = '' error = '' start = datetime.now() common_log(True, task['taskId'], 'Script ' + task['docker_name'], 'start', task) try: me = MySelenium(task_info=task, mode=mode) me.set_comment_to_pic({ "APP图标": 'images/kuaishou/app_icon.png', "点击一个视频": 'images/kuaishou/clickone.png', "分享": 'images/kuaishou/share.png', "复制链接": 'images/kuaishou/copylink.png', "跳过软件升级": 'images/kuaishou/ignore_upgrade.png', }) # me._DEBUG = True me.run() except Exception as e: msg = '<<error>>' error = e finally: if APPSIMULATOR_MODE == MODE_MULTI: # multi nox mode m = Manager() m.nox_run_task_finally(taskId) common_log( True, task['taskId'], 'Script ' + task['docker_name'] + 'end.', msg + 'total times:' + str( (datetime.now() - start).seconds) + 's', error) return
def main(task, mode): msg = '' error = '' start = datetime.now() common_log(True, task['taskId'], 'Script ' + task['docker_name'], 'start', task) try: me = MySelenium(task_info=task, mode=mode) me.set_comment_to_pic({ "web打开APP": 'images/dianping/webOpenApp.png', "APP打开结果OK": 'images/dianping/search_ready.png', "APP图标": 'images/dianping/app_icon.png', '附近热搜': 'images/dianping/search.png', '搜索': 'images/dianping/search_btn.png', "网友点评": 'images/dianping/wangyoudianping.png', "全部网友点评": 'images/dianping/wangyoudianping-all.png', "分享": 'images/dianping/share.png', "复制链接": 'images/dianping/copy_link.png', "打分": 'images/dianping/dafen.png', }) me._DEBUG = True me.run() except Exception as e: msg = '<<error>>' error = e finally: if APPSIMULATOR_MODE == MODE_MULTI: # multi nox mode m = Manager() m.nox_run_task_finally(taskId) common_log(True, task['taskId'], 'Script ' + task['docker_name'] + 'end.', msg + 'total times:' + str((datetime.now() - start).seconds) + 's', error) return
def vm_check_active(host_ip): _log('vm_check_active', 'start ...') manager = Manager() manager._DEBUG = True manager._mdb._DEBUG = True manager.vm_check_active(host_ip) _log('vm_check_active', 'end.')
def vm_draw_cardiogram(host_ip): _log('vm_draw_cardiogram', 'start ...') manager = Manager() manager._DEBUG = True manager._mdb._DEBUG = True manager.vm_draw_cardiogram(host_ip) _log('vm_draw_cardiogram', 'end.')
def emulators_test(vm): manager = Manager() manager._DEBUG = True manager._mdb._DEBUG = True # t = { # 'taskId': 2, # 'app_name': 'miaopai', # 'docker_name': 'nox-2', # 'timer_no': 2, # 'script': 'script_miaopai.py' # } # manager.run_script(task_info=t) # manager.start_tasks() # manager.vm_draw_cardiogram() # manager.vm_reset(vm_name='vm4') # host_ip = '172.16.253.37' return
def main(task, mode): msg = '' error = '' start = datetime.now() common_log(True, task['taskId'], 'Script ' + task['docker_name'], 'start', task) try: me = MySelenium(task_info=task, mode=mode) me.set_comment_to_pic({ "定位视频": 'images/{}/click_one.png'.format(task["app_name"]), "APP图标": 'images/{}/app_icon.png'.format(task["app_name"]), "忽略升级": 'images/{}/ignore_upgrade.png'.format(task["app_name"]), "放大镜": 'images/{}/search.png'.format(task["app_name"]), "综合排序": 'images/{}/rank.png'.format(task["app_name"]), "按时间排序": 'images/{}/rule.png'.format(task["app_name"]), "关闭详情页": 'images/{}/close_detail.png'.format(task["app_name"]), "视频+关注": 'images/{}/video_follow.png'.format(task["app_name"]), "文章+关注": 'images/{}/article_follow.png'.format(task["app_name"]), }) # me._DEBUG = True me._DEBUG = False me.run() except Exception as e: msg = '<<error>> Exception:' error = e finally: if APPSIMULATOR_MODE == MODE_MULTI: # multi nox mode m = Manager() m.nox_run_task_finally(taskId) common_log( True, task['taskId'], 'Script ' + task['docker_name'] + 'end.', msg + 'total times:' + str( (datetime.now() - start).seconds) + 's', error) return
def emulators_main(): manager = Manager() manager._DEBUG = True manager.nox_run_tasks()