Addition of chromedp-proxy, fixing SendKeys, more
- Adding chromedp-proxy command to help record chrome sessions - Changing the headless writeup to point to the knq chrome-headless docker image - Fixing issues with SendKeys action (should correctly work for all well known keys) - Updated to latest Chrome protocol.json and re-generated API - Other minor fixes
This commit is contained in:
1
examples/headless/.gitignore
vendored
1
examples/headless/.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
headless
|
||||
headless.exe
|
||||
*.png
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# About headless
|
||||
|
||||
This is a version of the simple example but with the chromedp settings changed
|
||||
to use the docker [yukinying/chrome-headless](yukinying/chrome-headless) image.
|
||||
to use the docker [knqz/chrome-headless](https://hub.docker.com/r/knqz/chrome-headless/) image.
|
||||
|
||||
## Running
|
||||
|
||||
```sh
|
||||
# retrieve docker image
|
||||
docker pull yukinying/chrome-headless
|
||||
docker pull knqz/chrome-headless
|
||||
|
||||
# start docker headless
|
||||
docker run -i -t --shm-size=256m --rm --name=chrome-headless -p=127.0.0.1:9222:9222 yukinying/chrome-headless about:blank
|
||||
# start chrome-headless
|
||||
docker run -d -p 9222:9222 --rm --name chrome-headless knqz/chrome-headless
|
||||
|
||||
# run chromedp headless example
|
||||
go build && ./headless
|
||||
|
||||
@@ -42,9 +42,8 @@ func googleSearch(q, text string, site, res *string) cdp.Tasks {
|
||||
cdp.Navigate(`https://www.google.com`),
|
||||
cdp.Sleep(2 * time.Second),
|
||||
cdp.WaitVisible(`#hplogo`, cdp.ByID),
|
||||
cdp.SendKeys(`#lst-ib`, q, cdp.ByID),
|
||||
cdp.Click(`input[name="btnK"]`, cdp.ByQuery),
|
||||
cdp.WaitNotVisible(`input[name="btnI"]`, cdp.ByQuery),
|
||||
cdp.SendKeys(`#lst-ib`, q+"\n", cdp.ByID),
|
||||
cdp.WaitVisible(`#res`, cdp.ByID),
|
||||
cdp.Text(sel, res),
|
||||
cdp.Click(sel),
|
||||
cdp.Sleep(2 * time.Second),
|
||||
|
||||
Reference in New Issue
Block a user