chrome_headless.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:ChromeHeadlessInterface 作者: wilson9x1 项目源码 文件源码
def __init__(self, url, ip="127.0.0.1", port="9222", cookie="", post="", auth=""):
        """
        ???
        :param url: ??url
        :param ip: ChromeHeadless?server ip
        :param port: ChromeHeadless?server ??
        :param cookie: ??cookie
        :param post:  ??post Chrome?api???
        :param auth:  ?? authorization
        """
        self.url = url
        self.cookie = cookie
        self.post = post
        self.auth = auth
        self.ip = ip
        self.port = port
        self.tab_id = ""
        self.ws_url = ""
        self.hook_urls = []
        self.error = ""
        self.soc = None
        self.javascript_dialog_events = []
        chrome_web = "http://%s:%s/json/new" % (ip, port)
        try:
            response = requests.get(chrome_web)
            self.ws_url = response.json().get("webSocketDebuggerUrl")
            self.tab_id = response.json().get("id")
            self.soc = websocket.create_connection(self.ws_url)
            # print(self.ws_url, self.tab_id)
        except Exception, e:
            # print "ERROR:%s" % e
            self.error = str(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号