Commit Graph

18 Commits

Author SHA1 Message Date
Daniel Martí
c109f6ebfd use consistent context.Context var names 2019-04-01 12:18:16 +01:00
Daniel Martí
61f0a8da68 make some linters a bit happier 2019-04-01 12:18:16 +01:00
Daniel Martí
81a48280ef route all communication via the browser
Use a single websocket connection per browser, removing the need for an
extra websocket connection per target.

This is thanks to the Target.sendMessageToTarget command to send
messages to each target, and the Target.receivedMessageFromTarget event
to receive messages back.

The browser handles activity via a single worker goroutine, and the same
technique is used for each target. This means that commands and events
are dealt with in order, and we can do away with some complexity like
mutexes and extra go statements.
2019-04-01 12:18:16 +01:00
Daniel Martí
3d3bf22ccc start the chromedp v2 refactor
First, we want all of the functionality in a single package; this means
collapsing whatever is useful into the root chromedp package.

The runner package is being replaced by the Allocator interface, with a
default implementation which starts browser processes.

The client package doesn't really have a place in the new design. The
context, allocator, and browser types will handle the connection with
each browser.

Finally, the new API is context-based, hence the addition of context.go.
The tests have been modified to build and run against the new API.
2019-04-01 12:17:28 +01:00
Daniel Martí
26c9acb5b1 avoid ctx.Done() goroutine leak in Selector.run
As spotted in #162 by a contributor, if the context is done before the
Selector.run caller has received from the channel, the spawned goroutine
may leak if blocked on a send.
2019-02-21 17:58:08 +01:00
Kenneth Shaw
b0c2445e67 Splitting repositories 2017-12-28 11:17:14 +07:00
Daniel Martí
335d22d376 all: simplify some error variables
There's no need to put the error variables in a larger scope, nor define
them earlier than necessary. If anything, it makes the code harder to
follow, such as figuring out when nil errors are returned.
2017-12-18 10:51:37 +07:00
Ben Davies
10a6f7bd20 Fixes infinite loop (and consequentially spiked CPU usage) on ctx timeout 2017-08-01 13:15:36 +07:00
Kenneth Shaw
2d46c88024 Updating to latest protocol.json 2017-07-14 10:35:11 +07:00
Kenneth Shaw
1a35cceeae Adding OuterHTML and InnerHTML actions 2017-07-01 11:53:22 +07:00
Kenneth Shaw
4c16faa34d Minor code cleanup/maintenance on generated cdp protocol 2017-02-18 15:36:24 +07:00
Kenneth Shaw
3673164aef Code cleanup
- Refactored API calls to be cleaner
- Changed types that shoudn't be exported to not-exported
- Updated examples with API changes
- Added unit test for Title action
2017-02-12 14:08:40 +07:00
Kenneth Shaw
f73c429109 Renaming FrameHandler, updating to latest protocol.json, and code fixes 2017-02-12 12:50:46 +07:00
Kenneth Shaw
6eec61e7df Adding ElementNotPresent/WaitNotPresent query option/action 2017-02-08 23:16:28 +07:00
Kenneth Shaw
6769aefc5e Fixing Visible/NotVisible issues; adding new actions
- Fixed issues with ElementVisible/ElementNotVisible
- Added a few extra Javascript based actions
2017-02-08 23:01:35 +07:00
Kenneth Shaw
5bef7dce13 Changes to ElementVisible/ElementNotVisible
Changed implementation of ElementVisible/ElementNotVisible to use a
javascript evaluation instead of the previous, cumbersome
implementation. As this may not work correctly in all scenarios, the old
versions will remain as ElementVisibleOld and ElementNotVisibleOld until
the new implementations can be vetted for correctness/performance.
2017-02-08 15:40:22 +07:00
Kenneth Shaw
58283934b9 Fixing issues with code generation 2017-01-26 14:28:34 +07:00
Kenneth Shaw
20d575fece Initial import 2017-01-24 22:09:23 +07:00