admin管理员组

文章数量:1225020

win7 环境,主要是一开始想在代码中先用exec.Command启动chrome,但始终不能成功监听9222端口,折腾了很长时间,

需要先手工启动chrome监听端口(具体写在代码注释中了)然后再运行代码,在开源代码基础上稍作修改,将访问不了的google换成sohu。

效果就是通过代码将浏览器导航到了sohu

// Command standalone is a chromedp example demonstrating how to use chromedp
// with a standalone (ie, a "pre-existing" / manually started) chrome instance.
package main

import (
    "context"
    "fmt"
    "io/ioutil"
    "log"

    "time"

    "

本文标签: 浏览器操作golangchromedpchrome