首先我們要編寫自動化操作命令:
[
{
"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
}
}
]
上面配置翻譯出來的意思就是
- 請求百度
url
- 在
input
輸入框填寫Python
文本 - 點擊搜索按鈕
- 睡眠等待5秒,防止執行完成後立刻退出瀏覽器無法觀察效果
具體效果:
Titans
框架 Github Page
: https://dmf-code.github.io/titans/
Titans
框架 wiki
文檔: https://github.com/dmf-code/titans/wiki