Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

antflux/browsermobproxy-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

4 Commits

Repository files navigation

browsermobproxy-go

browsermobproxy for go

How too use it?

Create new server?

 //the path browsermob-proxy install
 Server =browsermobproxy.NewServer("/Users//bin/browsermob-proxy")
 Server.Start()

create proxy

proxy :=Server.CreateProxy(browsermobproxy.Params{"trustAllServers":"true"})
chromeCaps := chrome.Capabilities{
		Prefs: imgCaps,
		Path: "",
		Args: []string{
			//"--headless",
			"--start-maximized",
			"--window-size=1200x600",
			"--no-sandbox",
			"--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",
			"--disable-gpu",
			"--disable-impl-side-painting",
			"--disable-gpu-sandbox",
			"--disable-accelerated-2d-canvas",
			"--disable-accelerated-jpeg-decoding",
			"--test-type=ui",
		},
	}

add it to chrome

var caps selenium.Capabilities
chromeCaps.Args = append(spider.ChromeCaps.Args, fmt.Sprintf("--proxy-server=%s",p.Proxy))
caps.AddChrome(chromeCaps)
wd, err := selenium.NewRemote(caps, fmt.Sprintf("http://localhost:%d/wd/hub", 9515))

use newhar

options :=make(map[string]string)
	options["captureHeaders"] = "true"
	options["captureContent"] = "true"
	proxy.NewHar("loginform",options)
	wd.get("url")
	result :=proxy.Har()

v1.0 you can use 1、proxy 2、Har 3、NewHar 4、Blacklist 5、ResponseInterceptor 6、RequestInterceptor

About

browsermobproxy for go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /