Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nanitefactory/chromebot
Run headless Chrome using Go.
https://github.com/nanitefactory/chromebot
automation bot chrome-devtools chromebot crawler developer-tools golang headless-browser headless-chrome testing web
Last synced: about 1 month ago
JSON representation
Run headless Chrome using Go.
- Host: GitHub
- URL: https://github.com/nanitefactory/chromebot
- Owner: NaniteFactory
- License: mit
- Created: 2019-12-12T14:36:28.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-10T19:50:21.000Z (almost 5 years ago)
- Last Synced: 2024-06-21T00:17:24.363Z (8 months ago)
- Topics: automation, bot, chrome-devtools, chromebot, crawler, developer-tools, golang, headless-browser, headless-chrome, testing, web
- Language: Go
- Homepage:
- Size: 87.9 KB
- Stars: 15
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chromebot
[![GoDoc](https://godoc.org/github.com/nanitefactory/chromebot?status.svg)](https://godoc.org/github.com/nanitefactory/chromebot)
[![Build Status](https://travis-ci.org/NaniteFactory/chromebot.svg?branch=master)](https://travis-ci.org/NaniteFactory/chromebot)Package `chromebot` provides a high-level interface to automate tasks in Chrome or Chromium. Work based on [chromedp](https://github.com/chromedp/chromedp).
## Installation
```Cmd
go get -v github.com/nanitefactory/chromebot
```## Test
```Cmd
go test -v github.com/nanitefactory/chromebot
```## Quick start
```Go
// Start a browser
browser := chromebot.New(false)
defer browser.Close()// Navigate
browser.Tab(0).Run(
chromedp.Navigate("https://godoc.org"),
chromedp.WaitVisible("html"),
)// Another navigation method
// browser.Tab(0).Do().Page().Navigate("https://godoc.org", nil, nil, nil)// Get cookies
cookies, err := browser.Tab(0).Do().Network().GetAllCookies()
if err != nil {
panic(err)
}
for i, cookie := range cookies {
fmt.Println(i, cookie)
}// _Output:
// 0 &{__utma 58978491.1884756898.1576137201.1576137201.1576137201.1 .godoc.org / 1.639209201e+09 60 false false false }
// 1 &{__utmc 58978491 .godoc.org / -1 14 false false true }
// 2 &{__utmz 58978491.1576137201.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) .godoc.org / 1.591905201e+09 75 false false false }
// 3 &{__utmt 1 .godoc.org / 1.576137801e+09 7 false false false }
// 4 &{__utmb 58978491.1.10.1576137201 .godoc.org / 1.576139001e+09 30 false false false }
```