Skip to content

Commit b60ce56

Browse files
committed
v1.0
1 parent 2fab9b4 commit b60ce56

15 files changed

+1184
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Created by .ignore support plugin (hsz.mobi)

.idea/browsermobproxy-go.iml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

+177
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+59
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,61 @@
11
# browsermobproxy-go
22
browsermobproxy for go
3+
4+
How too use it?
5+
## Create new server?
6+
```
7+
//the path browsermob-proxy install
8+
Server =browsermobproxy.NewServer("/Users//bin/browsermob-proxy")
9+
Server.Start()
10+
```
11+
12+
## create proxy
13+
```
14+
proxy :=Server.CreateProxy(browsermobproxy.Params{"trustAllServers":"true"})
15+
```
16+
##
17+
```go
18+
chromeCaps := chrome.Capabilities{
19+
Prefs: imgCaps,
20+
Path: "",
21+
Args: []string{
22+
//"--headless",
23+
"--start-maximized",
24+
"--window-size=1200x600",
25+
"--no-sandbox",
26+
"--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36",
27+
"--disable-gpu",
28+
"--disable-impl-side-painting",
29+
"--disable-gpu-sandbox",
30+
"--disable-accelerated-2d-canvas",
31+
"--disable-accelerated-jpeg-decoding",
32+
"--test-type=ui",
33+
},
34+
}
35+
36+
```
37+
## add it to chrome
38+
```go
39+
var caps selenium.Capabilities
40+
chromeCaps.Args = append(spider.ChromeCaps.Args, fmt.Sprintf("--proxy-server=%s",p.Proxy))
41+
caps.AddChrome(chromeCaps)
42+
wd, err := selenium.NewRemote(caps, fmt.Sprintf("http://localhost:%d/wd/hub", 9515))
43+
```
44+
45+
## use newhar
46+
```go
47+
options :=make(map[string]string)
48+
options["captureHeaders"] = "true"
49+
options["captureContent"] = "true"
50+
proxy.NewHar("loginform",options)
51+
wd.get("url")
52+
result :=proxy.Har()
53+
```
54+
55+
v1.0 you can use
56+
1、proxy
57+
2、Har
58+
3、NewHar
59+
4、Blacklist
60+
5、ResponseInterceptor
61+
6、RequestInterceptor

0 commit comments

Comments
 (0)