1. 启动接口添加参数 notifications=2 可以禁止网站通知提示框。
http://127.0.0.1:35000/api/v1/profile/start?profileId=xxxxxxxxxxx&skiplock=true¬ifications=2
2. 鼠标点击:GET传参x,y坐标为鼠标点击的坐标,页面可视的左上角为0,0基点。
http://127.0.0.1:35000/api/v1/profile/page/mouseclick?x=400&y=500&profileId=xxxx
返回例:
{"status":"OK","success":true,"value":"{}"}
如果 success = true 表示执行成功
3. 鼠标滚轮:GET传参x,y坐标为鼠标所在的坐标,deltaY为滚轮上下滚动值,负数是上向滚动,正数是向下滚动。
http://127.0.0.1:35000/api/v1/profile/page/mousewheel?x=400&y=500&deltaX=0&deltaY=50&profileId=xxxx
返回例:
{"status":"OK","success":true,"value":"{}"}
如果 success = true 表示执行成功
4. 页面信息查询:GET传参profileId配置文件ID,可以读取当前页的网址,标题,是否加载完成信息。
http://127.0.0.1:35000/api/v1/profile/page/pagestate?profileId=xxxx
返回例1
{"status":"OK","value":"","success":true,"baseURI":"https://cn.bing.com/","readyState":"interactive","title":"必应"}
返回例2
{"status":"OK","value":"","success":true,"baseURI":"https://cn.bing.com/","readyState":"complete","title":"必应"}
如果success=true表示执行成功,baseURI为当前页网址,readyState为complete页面加载完成。title为标题
5. 前进
http://127.0.0.1:35000/api/v1/profile/historyforward?profileId=xxxx
6. 后退
http://127.0.0.1:35000/api/v1/profile/historyback?profileId=xxxx
7. 优化代理检测接口(添加主动超时参数 timeout 毫秒,超时自动返回)
http://127.0.0.1:35000/api/v1/proxy/test?proxytype=socks5&proxyserver=127.0.0.1&proxyport=1080&proxyusername=&proxypassword=&timeout=8000
表示如果测试代理8秒没结果就不等了,失败返回。
8. 刷新页面
http://127.0.0.1:35000/api/v1/profile/refresh?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
9.当前标签打开指定网址
http://127.0.0.1:35000/api/v1/profile/openurl?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&url=www.vmlogin.com.cn
10. 获取网页源代码
http://127.0.0.1:35000/api/v1/profile/source?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
11. 寻找网页中的元素
http://127.0.0.1:35000/api/v1/profile/findElement?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&function=findElementByID&args=kw&click=false&index=-1
function参数支持:
findElementByID
findElementByTag
findElementByClassName
findElementByLinkText
findElementByXPath
findElementsByID
findElementsByTag
findElementsByClassName
findElementsByLinkText
findElementsByXPath
args参数为function函数的传参,如:findElementByID(args)
click为true时,找到指定元素后进行点击操作。为false时不进行点击
index是元素有多个时,指定点击第几个元素,从0开始,-1为随机元素其中一个,这个参数是配合click=true时使用的。
12. 取指定元素属性值
http://127.0.0.1:35000/api/v1/profile/getAttribute?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&args=[{"ELEMENT": "95365abe-6746-4703-8cfd-6316580f5289", "element-6066-11e4-a52e-4f735466cecf": "95365abe-6746-4703-8cfd-6316580f5289"}, "style"]
args参数,一般是通过findElement查找元素后得到的Element_ID结合成的JSON串。
如:
[{"ELEMENT": "95365abe-6746-4703-8cfd-6316580f5289", "element-6066-11e4-a52e-4f735466cecf": "95365abe-6746-4703-8cfd-6316580f5289"}, "value"]
这个就是取 95365abe-6746-4703-8cfd-6316580f5289 元素的 value 值。
13. 通过选择器执行元素点击
http://127.0.0.1:35000/api/v1/profile/findElement?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&function=findElementByID&args=kw&click=true&index=-1
14. 发送文字到网页中
首先可以先使用 findElementByID 找元素的 elementId ,例如:
http://127.0.0.1:35000/api/v1/profile/findElement?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&function=findElementByID&args=kw&click=false&index=-1
也可以使用:findElementByXPath 方工找元素的 elementId ,例如:
http://127.0.0.1:35000/api/v1/profile/findElement?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&function=findElementByXPath&args=Ly8qW0BpZD0ia3ciXQ==&click=false&index=-1
上面 args 参数使用 base64 编码传输,解码后是://*[@id=”kw”]
上面GET请求会返回:
{"status":"OK","value":"{\"element-6066-11e4-a52e-4f735466cecf\":\"49e49e71-2a55-4e79-a41b-86840ffd18c8\"}"}
其中 49e49e71-2a55-4e79-a41b-86840ffd18c8 就是要用到的elementId 。
http://127.0.0.1:35000/api/v1/profile/sendKeys?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&elementId=49e49e71-2a55-4e79-a41b-86840ffd18c8&value=5Lit5paHYWJjMTIz
上面 value 也使用了 base64 编码传输,防止GET传输失败。
value=5Lit5paHYWJjMTIz,就是换这个网页控件中发送 中文abc123 字符串。注意网页要加载
完毕才能进行这些自动化操作,不然有可能动作会被阻塞。
这里的35000端口,是VMLogin 客户端软件中我的帐号里设置的端口,注意开启和变化。
15. 客户端重启接口
http://127.0.0.1:35000/api/v1/client/restart
16. 测试代理的接口
http://127.0.0.1:35000/api/v1/proxy/test?proxytype=socks5&proxyserver=127.0.0.1&proxyport=1080&proxyusername=&proxypassword=
proxytype可用参数:socks5/socks4/http/https
{"status":"ERROR","value":"Failed to test the proxy server."}
{"status":"OK","value":"country:HK\r\ncity:Central\r\nregion:HCW\r\ntz:Asia\/Hong_Kong\r\n
http://127.0.0.1:35000/api/v1/proxy/test?proxytype=socks5&proxyserver=127.0.0.1&proxyport=1080&proxyusername=&proxypassword=&urlindex=0
url_index = 0 lumtest (Lumi的检测IP地址)
url_index = 1 VMLogin (VMLogin自己库,支持IPV6检测)
url_index = 2 ip-api.com (ip-api库)
17. 设置:若密码遭遇了数据泄露,发出警告 enable=false 关闭警告
http://127.0.0.1:35000/api/v1/profile/browser/password_manager_leak_detection?profileId=xxxxxx&enable=false
18. 导入地址API:
① http://127.0.0.1:35000/api/v1/profile/addresses/import
② POST
③ profileId
④ body (JSON need base64 encode):
⑤ [{"name_on_card":"vmlogin","nickname":"vmlogin","card_number":"1111123456789","expiration_month":8,"expiration_year":2023}]
19. 导入付款方式API:
① http://127.0.0.1:35000/api/v1/profile/credit_cards/import
② POST
③ profileId
④ body (JSON need base64 encode):
⑤ [{"organization":"vmlogin ltd","street_address":"vmlogin 100","district":"Shushan","city":"hefei","province":"Anhui","zipcode":"230088","country_code":"CN","number":"13988888","full_name":"dawang",
"email":"cs@vmlogin.us"}]