forked from browser-use/web-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_test.py
43 lines (37 loc) · 1.36 KB
/
api_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import requests
url = "http://127.0.0.1:8004/trigger_bt"
# payload = {
# "task": "Navigate to website http://159.65.235.197:32771/ and login with creds username test and password test",
# "add_infos": "In the final result, include the url of the page the task finished at",
# "url": "http://159.65.235.197:32771/",
# "gbc": True,
# }
#, "--ignore-certificate-errors"
payload = {
"task": "Naviagte to http://192.34.60.201/auth/login. Creds needed for login are: username - my@company.com, pasword - peter.",
"add_infos": "In the final result, include the url of the page the task finished at",
"url": "http://192.34.60.201/auth/login",
"gbc": True,
"upload_file_path:": None
}
response = requests.post(url, json=payload)
if response.status_code == 200:
result = response.json()
print("Final Result:")
print(result["final_result"])
print("\nErrors:")
print(result["errors"])
print("\nModel Actions:")
print(result["model_actions"])
print("Screenshot:")
print(len(result["sc"]))
with open("screenshot.txt", "w") as f:
f.write(result["sc"])
print("\nMITM Logfile:")
print(result["mitm_logfile"])
print("\nDOM file:")
print(result["dom_file"])
print("\nExternal DOM:")
print(result["external_js_dom_file"])
else:
print(f"Request failed with status code: {response.status_code}")