Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chromedp/examples

chromedp code examples.
https://github.com/chromedp/examples

Last synced: 7 days ago
JSON representation

chromedp code examples.

Awesome Lists containing this project

README

        

# About chromedp examples

This folder contains a variety of code examples for working with
[`chromedp`][1]. The package documentation contains a number of [simple
examples][2] which are self-contained, while this repository holds more complex
examples which tend to require internet access or external components.

Please note that these examples may break occassionally. Additionally, since
these examples are written for specific websites, there is a good chance that
the current selectors, etc. break after the website they are written against
changes.

While every effort is made to ensure that these examples are kept up-to-date,
it is expected that the examples made available here may occasionally break.

To file issues, use the [chromedp's issue tracker][3].

## Building and Running an Example

You can build and run these examples in the usual Go way:

```sh
# retrieve examples
$ go get -u -d github.com/chromedp/examples

# run example
$ go run $GOPATH/src/github.com/chromedp/examples//main.go

# build example
$ go build -o github.com/chromedp/examples/ && ./
```

### Available Examples

The following examples are currently available:

| Example | Description |
|-----------------------------------|-------------------------------------------------------------------------------------|
| [click](/click) | use a selector to click on an element |
| [cookie](/cookie) | set a HTTP cookie on requests |
| [download_file](/download_file) | do headless file downloads |
| [download_image](/download_image) | do headless image downloads |
| [emulate](/emulate) | emulate a specific device such as an iPhone |
| [eval](/eval) | evaluate javascript and retrieve the result |
| [fast](/fast) | extract and render data from a page |
| [forecast](/forecast) | extract and render data from a page |
| [geoip](/geoip) | extract and render data from a page |
| [headers](/headers) | add extra HTTP headers to browser requests |
| [keys](/keys) | send key events to an element |
| [latlon](/latlon) | retrieve the latitude/longitude from google maps, using the browser's target events |
| [logic](/logic) | more complex logic beyond simple actions |
| [multi](/multi) | use headless-shell and a container (Docker, Podman, other) |
| [pdf](/pdf) | capture a pdf of a page |
| [proxy](/proxy) | authenticate a proxy server which requires authentication |
| [remote](/remote) | connect to an existing Chrome DevTools instance using a remote WebSocket URL |
| [screenshot](/screenshot) | take a screenshot of a specific element and of the entire browser viewport |
| [submit](/submit) | fill out and submit a form |
| [subtree](/subtree) | populate and travel a subtree of the DOM |
| [text](/text) | extract text from a specific element |
| [upload](/upload) | upload a file on a form |
| [visible](/visible) | wait until an element is visible |

## Contributing

Pull Requests and contributions to this project are encouraged and greatly
welcomed! The `chromedp` project always needs new examples, and needs talented
developers (such as yourself!) to submit fixes for the existing examples when
they break (for example, when a website's layout/HTML changes).

[1]: https://github.com/chromedp/chromedp
[2]: https://pkg.go.dev/github.com/chromedp/chromedp#pkg-examples
[3]: https://github.com/chromedp/chromedp/issues