Go to file
Daniel Martí 120628a01c fix data race when spawning tabs concurrently
This fixes the data race uncovered by the recent refactor to run all
tests as tabs under the same browser.

The problem was that a write on the pages map could be done from the
goroutine calling NewContext to create a new map, while other goroutines
could similarly read or write the same map.

Instead of adding a lock around the map, make one of the Browser's
goroutines be the sole user of the map. To make that extra obvious and
avoid potential races in the future, declare the map inside the
goroutine's scope.

For some reason, this makes the Attributes tests flakier than before.
For now, add short sleeps; we can investigate that separately, now that
the data races are gone.
2019-04-01 19:31:05 +01:00
.github add a simple issue template 2019-02-22 00:13:27 +01:00
kb start the chromedp v2 refactor 2019-04-01 12:17:28 +01:00
testdata don't crash when loading pages with iframes 2019-04-01 12:18:16 +01:00
.gitignore Changing chromedp-gen => cdproto-gen 2018-02-16 07:23:02 +07:00
.travis.yml start running the tests on CI again 2019-04-01 12:18:16 +01:00
actions.go use time.NewTimer instead of time.After in Sleep 2019-04-01 17:03:35 +01:00
allocate_test.go change Run to allow many actions 2019-04-01 16:59:23 +01:00
allocate.go clean up various pieces of the API 2019-04-01 12:18:16 +01:00
browser.go fix data race when spawning tabs concurrently 2019-04-01 19:31:05 +01:00
chromedp_test.go various minor cleanups 2019-04-01 17:12:17 +01:00
conn.go clean up various pieces of the API 2019-04-01 12:18:16 +01:00
context.go various minor cleanups 2019-04-01 17:12:17 +01:00
errors.go start the chromedp v2 refactor 2019-04-01 12:17:28 +01:00
eval.go use consistent context.Context var names 2019-04-01 12:18:16 +01:00
example_test.go change Run to allow many actions 2019-04-01 16:59:23 +01:00
go.mod fix build breakage with newer cdproto versions 2019-03-28 21:45:27 +00:00
go.sum fix build breakage with newer cdproto versions 2019-03-28 21:45:27 +00:00
handler.go store a Target pointer directly in Context 2019-04-01 14:31:11 +01:00
input_test.go fix data races in table-driven parallel subtests 2019-04-01 16:48:49 +01:00
input.go get rid of all sleeps in tests 2019-04-01 12:18:16 +01:00
js.go Splitting repositories 2017-12-28 11:17:14 +07:00
LICENSE Minor code cleanup 2018-03-27 04:31:09 +07:00
nav_test.go change Run to allow many actions 2019-04-01 16:59:23 +01:00
nav.go use consistent context.Context var names 2019-04-01 12:18:16 +01:00
query_test.go fix data race when spawning tabs concurrently 2019-04-01 19:31:05 +01:00
query.go use consistent context.Context var names 2019-04-01 12:18:16 +01:00
README.md Changing Debugging => DevTools 2018-07-13 12:46:30 +07:00
sel_test.go make gofumpt happy 2019-04-01 16:43:03 +01:00
sel.go use consistent context.Context var names 2019-04-01 12:18:16 +01:00
util.go don't crash when loading pages with iframes 2019-04-01 12:18:16 +01:00

About chromedp Build Status Coverage Status

Package chromedp is a faster, simpler way to drive browsers supporting the Chrome DevTools Protocol in Go using the without external dependencies (ie, Selenium, PhantomJS, etc).

Installing

Install in the usual Go way:

go get -u github.com/chromedp/chromedp

Examples

Please see the examples project for more examples. Please refer to the GoDoc API listing for a summary of the API and Actions.

Resources

TODO

  • Move timeouts to context (defaults)
  • Implement more query selector options (allow over riding context timeouts)
  • Contextual actions for "dry run" (or via an accumulator?)
  • Network loader / manager
  • Profiler