Titans selenium automation framework

Time:2021-11-23

Original design intention

This framework was created for automation at the beginning, because the company had the need for browser automation before. At first, the framework was very simple. Then, because the business has been stable, we dare not make too big changes. After leaving the company, I made a good summary and restructured the framework.

Titans selenium automation framework

What’s the usage?

High encapsulationSeleniumOperation, as long as the configurationjsonCan achieve the desired function. Provide background dynamic modification configuration to quickly solve the problem of changing page elements for the website. From now on, there is no need to modify the framework source code and upload itgitThen pull it to the online server. Save you more time for coffee.

Titans selenium automation framework

framework

  1. front endvue
  2. back-endflask
  3. automationtitans

directory structure

+---Abstracts / / abstract class

assembly

│ click.py click operation class

Overall process

Titans selenium automation framework

How to use?

Here, take automated 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
    }
  }
]

Used in configuration{}Call as a component,[]Use as a scope.{}There are three basic parameters:

  1. argsconfiguration parameter

  2. typeSpecific methods for component use

  3. componentComponent name used

[]Mainly scope, used forif, for, whileLoop these components with their own scope, and then call them inside{}Process control can be realized

The specific effects are as follows:

Titans selenium automation framework

Project address:

github.com/dmf-code/titans

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

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

Apache sqoop

Source: dark horse big data 1.png From the standpoint of Apache, data flow can be divided into data import and export: Import: data import. RDBMS—–>Hadoop Export: data export. Hadoop—->RDBMS 1.2 sqoop installation The prerequisite for installing sqoop is that you already have a Java and Hadoop environment. Latest stable version: 1.4.6 Download the sqoop installation […]