All Projects → dmf-code → titans

dmf-code / titans

Licence: Apache-2.0 license
Selenium automation framework - Selenium自动化框架

Programming Languages

python
139335 projects - #7 most used programming language
Vue
7211 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to titans

Seleniumbase
A Python framework that inspires developers to become better test automation engineers. 🧠💡
Stars: ✭ 2,520 (+15650%)
Mutual labels:  selenium-python
CampusDailyAutoSign
今日校园/体温签到/海南大学/QQ机器人
Stars: ✭ 15 (-6.25%)
Mutual labels:  selenium-python
python-appium-framework
Complete Python Appium framework in 360 degree
Stars: ✭ 43 (+168.75%)
Mutual labels:  selenium-python
food-and-grocery-automatization
Python application that automatizes your food and grocery orders using Selenium library.
Stars: ✭ 15 (-6.25%)
Mutual labels:  selenium-python
automato
🎉🎉 ( v2 ) Web Application to automate sending Whatsapp, SMS & Email* campaigns
Stars: ✭ 92 (+475%)
Mutual labels:  selenium-python
arjuna
Arjuna is a Python based test automation framework developed by Rahul Verma (www.rahulverma.net).
Stars: ✭ 20 (+25%)
Mutual labels:  selenium-python
impf-botpy
Impf Bot.py 🐍⚡ – Automatisierung für den Corona ImpfterminService Bot
Stars: ✭ 254 (+1487.5%)
Mutual labels:  selenium-python
screenpy
Screenplay pattern base for Python automated UI test suites.
Stars: ✭ 38 (+137.5%)
Mutual labels:  selenium-python
Python
Python
Stars: ✭ 22 (+37.5%)
Mutual labels:  selenium-python
scrape-youtube-channel-videos-url
This Python script is used to scrape all the video links from a youtube channel.
Stars: ✭ 34 (+112.5%)
Mutual labels:  selenium-python
Instagram-Like-Comment-Bot
📷 An Instagram bot written in Python using Selenium on Google Chrome. It will go through posts in hashtag(s) and like and comment on them.
Stars: ✭ 53 (+231.25%)
Mutual labels:  selenium-python
WeiboChaoHuaDaily
微博超话经验全收集:评论、打榜、签到
Stars: ✭ 26 (+62.5%)
Mutual labels:  selenium-python
WhatSoup
A web scraper that exports your entire WhatsApp chat history.
Stars: ✭ 86 (+437.5%)
Mutual labels:  selenium-python
Selenium Python Helium
Selenium-python but lighter: Helium is the best Python library for web automation.
Stars: ✭ 2,732 (+16975%)
Mutual labels:  selenium-python
ig-automatic-story-viewer
Python Program To Send Instagram Story Views
Stars: ✭ 17 (+6.25%)
Mutual labels:  selenium-python
schedule-tweet
Schedules tweets using TweetDeck
Stars: ✭ 14 (-12.5%)
Mutual labels:  selenium-python
google-meet-bot
Bot for scheduling and entering google meet sessions automatically
Stars: ✭ 33 (+106.25%)
Mutual labels:  selenium-python
python demo
一些简单有趣的Python小Demo
Stars: ✭ 109 (+581.25%)
Mutual labels:  selenium-python
tithiwa
Automate Web WhatsApp with selenium in python.
Stars: ✭ 17 (+6.25%)
Mutual labels:  selenium-python
fBrowser
Helpful Selenium functions to make web-scraping easier and faster
Stars: ✭ 16 (+0%)
Mutual labels:  selenium-python

titans

Selenium automation framework - Selenium自动化框架

前端

采用Element-UI进行前端布局设计,前后分离的模式

更新新版 vue 2.6.11 版本,之前旧版要使用 build 目录,导致旧版有问题

生成生产环境

npm run build

nginx 配置

server {
        listen       80;
        server_name  www.titans.com ;
        root   "F:/Python/titans/admin/frontend/dist";
        location /$ {
            index  index.html index.htm;
            try_files $uri $uri/;
        }
}

配置好后,就能够使用前端页面了

注意这里面要将frontend->config->index.js->build下的assetsPublicPath: '/' 改为assetsPublicPath: './' 才能找到静态文件 的路径

后端

flask 框架进行编写,数据表结构如下

CREATE TABLE `configs` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(32) NOT NULL COMMENT '任务类型',
  `name` varchar(32) DEFAULT NULL COMMENT '任务名称',
  `json_text` json DEFAULT NULL COMMENT '任务命令集',
  PRIMARY KEY (`id`),
  UNIQUE KEY `type` (`type`,`name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;


CREATE TABLE `tasks` (
  `id` int(11) NOT NULL,
  `uuid` varchar(36) NOT NULL COMMENT '分布式唯一id',
  `result` json DEFAULT NULL COMMENT '结果集',
  `type` varchar(32) DEFAULT NULL COMMENT '任务类型',
  `name` varchar(32) DEFAULT NULL COMMENT '任务名',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

nginx 反向代理配置

server {
        listen       80;
        server_name  www.titans.com ;
        root   "F:/Python/titans/admin/frontend/dist";
        location /$ {
			index  index.html index.htm;
            try_files $uri $uri/;
        }
		location /api/configs/ {
			proxy_set_header Host $host;
			proxy_set_header X-Forwarded-For $remote_addr; 
            proxy_pass   http://127.0.0.1:5000/configs/;
        }
}

执行命令

进入到 titans -> admin 目录下,执行以下命令启动 web 服务

python app.py

服务端

Selenium 自动化框架,采用 json 配置化的形式进行数据采集或自动化测试等

架构

目录结构

+---abstracts // 抽象类
+---bin // 二进制文件
+---components // 组件
+---configs // 配置文件
+---core // 核心逻辑
+---hooks // 钩子
+---logs // 日志
+---manages // 全局管理类
+---storages // 存储保存位置
|   \---cookies
+---utils // 通用工具

组件

│  click.py                 点击操作类                    
│  content.py               html标签内容获取类                    
│  cookie.py                cookie操作类                        
│  for.py                   for循环流程类                    
│  if.py                    if流程类                    
│  iframe.py                iframe操作类            
│  input.py                 输入操作类                    
│  javascript.py            javascript代码执行类                  
│  judge.py                 条件判断类                      
│  request.py               请求类                          
│  sleep.py                 睡眠延时类                        
│  wait.py                  等待事件类                       
│  while.py                 while循环类        
│  window.py                window标签页切换类                         

chromedirver下载(对应相应的版本)

https://npm.taobao.org/mirrors/chromedriver

配置使用

配置中使用{}作为一个组件的调用,[]作为一个作用域来使用。 {}有三个基本参数:

  1. args配置参数

  2. type组件使用具体方法

  3. component所使用的组件名称

[]主要是作用域,用于if, for, while循环这些有自己作用域的组件,然后在里面调用{}就可以 实现流程控制了

boss直聘数据拉取栗子:

[
  {
    "component": "request",
    "args": {
      "url": "https://www.zhipin.com/c101280100/?query=PHP&page=9"
    },
    "type": "browser"
  },
  [
    {
      "component": "for",
      "args": {
        "xpath": "//div[@class='job-list']//ul//li",
        "turn_on": false
      },
      "type": "start"
    },
    {
      "component": "for",
      "args": {
        "xpath": "./div[@class='job-primary']//div[@class='info-primary']//div[@class='job-title']",
        "is_text": true,
        "key": "language"
      },
      "type": "grab"
    },
    {
      "component": "for",
      "args": {
        "xpath": "./div[@class='job-primary']//div[@class='info-primary']//span[@class='red']",
        "is_text": true,
        "key": "salary_range"
      },
      "type": "grab"
    },
    {
      "component": "for",
      "args": {
        "xpath": "./div[@class='job-primary']//div[@class='info-primary']/h3/following-sibling::p",
        "is_text": true,
        "key": "address_workAge_education"
      },
      "type": "grab"
    },
    {
      "component": "for",
      "args": {
        "xpath": "./div[@class='job-primary']//div[@class='info-company']//a",
        "is_text": true,
        "key": "company"
      },
      "type": "grab"
    },
    {
      "component": "for",
      "args": {
        "xpath": "./div[@class='job-primary']//div[@class='info-company']//p",
        "is_text": true,
        "key": "tmt"
      },
      "type": "grab"
    },
    {
      "component": "for",
      "args": {
        "xpath": "./div[@class='job-primary']//div[@class='info-publis']/h3",
        "is_text": true,
        "key": "hr_name_position"
      },
      "type": "grab"
    },
    {
      "component": "for",
      "args": {
        "key": "job_list_custom_array"
      },
      "type": "end"
    },
    {
      "component": "judge",
      "args": {
        "xpath": "//div[@class='job-list']//div[@class='page']//a[last()]",
        "class": "disabled"
      },
      "type": "has_class_terminate"
    },
    {
      "component": "sleep",
      "type": "random"
    },
    {
      "component": "javascript",
      "args": {
        "code": "$('div.job-list > div.page > a.next').css('z-index', 100000000);document.getElementById('footer').scrollIntoView();"
      }
    },
    {
      "component": "click",
      "args": {
        "xpath": "//div[@class='job-list']//div[@class='page']//a[last()]"
      }
    }
  ]
]

优势

采用json配置化的方式进行浏览器自动化,现在已有10+组件强力驱动,可以应对绝大多数的自动化操作。这个 框架最大特点就是编写json就可以实现像写代码一样进行流程控制,为采集网站结构变动提供无需重启服务的 便利

QQ交流群

742398812

本项目仅供学习用途

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].