个人笔记
2 分钟阅读
默认情况下会自动下载chromium浏览器
|
|
设置指定的本地浏览器
示例
|
|
通过自动查找本地浏览器
示例
|
|
launcher.LookPath函数的源码如下:
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 44 45 46 47 48 49
// LookPath searches for the browser executable from often used paths on current operating system. func LookPath() (found string, has bool) { list := map[string][]string{ "darwin": { "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "/Applications/Chromium.app/Contents/MacOS/Chromium", "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary", "/usr/bin/google-chrome-stable", "/usr/bin/google-chrome", "/usr/bin/chromium", "/usr/bin/chromium-browser", }, "linux": { "chrome", "google-chrome", "/usr/bin/google-chrome", "microsoft-edge", "/usr/bin/microsoft-edge", "chromium", "chromium-browser", "/usr/bin/google-chrome-stable", "/usr/bin/chromium", "/usr/bin/chromium-browser", "/snap/bin/chromium", "/data/data/com.termux/files/usr/bin/chromium-browser", }, "openbsd": { "chrome", "chromium", }, "windows": append([]string{"chrome", "edge"}, expandWindowsExePaths( `Google\Chrome\Application\chrome.exe`, `Chromium\Application\chrome.exe`, `Microsoft\Edge\Application\msedge.exe`, )...), }[runtime.GOOS] for _, path := range list { var err error found, err = exec.LookPath(path) has = err == nil if has { break } } return }
在遍历以上函数中路径切片时,若能找到浏览器,则不再进一步进行查找。也就是说,路径优先级有很大关系!
清除指定网站的Cookies
示例
|
|
劫持Js并替换其内容
|
|