Titans Selenium 自动化框架-百度搜索例子

首先我们要编写自动化操作命令:

[
  {
    "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": 5
    }
  }
]

上面配置翻译出来的意思就是

  1. 请求百度 url
  2. input 输入框填写 Python 文本
  3. 点击搜索按钮
  4. 睡眠等待5秒,防止执行完成后立刻退出浏览器无法观察效果

具体效果:
百度自动化搜索
Titans 框架 Github Page: https://dmf-code.github.io/titans/

Titans 框架 wiki 文档: https://github.com/dmf-code/titans/wiki

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章