designed

The framework was originally developed for automation, as companies had a need for browser automation. The framework was very rudimentary at the beginning, and since the business was stable, I didn’t dare to change it too much. After leaving a good summary, re-frame.

What’s the use of

The operations of Selenium are highly encapsulated, and the desired functionality can be achieved simply by configuring JSON. Provides the background dynamic modification configuration, for the site to change the page elements quickly solve. There is no need to modify the framework source code, upload Git and pull it to the online server. Save you more time for coffee.

Architecture Front-end Vue back-end Flask automation Titans

The directory structure

+ - of / / abstract class + - bin / / binary + - components / / component + - configs / / configuration file + - core / / core logic + - + - logs hooks / / hook / / log + - manages / / global management class + - storages/save/store location | \ + -- -- -- -- - cookies utils / / universal toolCopy the code

component

│ click. Py class │ content.py HTML tag content fetch class │ cookie.py cookie operation class │ for.pyforCyclic flow class │ if.pyifPy iframe operation class │ input.py input operation class │ javascript. Py javascript code execution class │ judge.py condition judgment class │ request.py request class │ sleep │ sleep delay │ wait.py │ wait event │ while.pywhilePy window TAB switching classCopy the code

The whole process

How to use it?

Here to automate Baidu search as an example, first we need the following configuration

[{"component": "request"."args": {
      "url": "https://www.baidu.com"
    },
    "type": "browser"
  },
  {
    "component": "input"."args": {
      "xpath": "//input[@id='kw']"."text": "Python"
    },
    "type": "text"
  },
  {
    "component": "click"."args": {
      "xpath": "//input[@id='su']"}}, {"component": "sleep"."args": {
      "time": 3600}}]Copy the code

The configuration uses {} as a component call and [] as a scope. {} takes three basic arguments:

Args Configuration parameters

The Type component uses concrete methods

Component name used by Component

[] is mainly scope, used for the if, for, while loop components that have their own scope, and then call {} in it to achieve flow control

The specific effects are as follows:

Project address: github.com/dmf-code/titans

Wiki: github.com/dmf-code/titans/wiki