go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.25k stars 345 forks source link

be able to access chrome:// or chrome-extension:// urls #821

Open jojorb opened 1 year ago

jojorb commented 1 year ago

Rod Version: v0.112.6

The code to demonstrate your question

i'm lauching chrome with docker version

ghcr.io/go-rod/rod      arm-dev      034e0cd4b9cc   5 days ago      1.66GB

command to launch docker

chrome --headless --no-sandbox --disable-gpu --remote-debugging-port=9222 --remote-debugging-address=0.0.0.0 -allow-all

i do allow all because i also mount local dir of a google chrome extension to /root/.config/chromium/Default/Extensions after creating the dir to prevent the deletion of that dir at run start.

u := launcher.MustResolveURL("")
browser = rod.New().ControlURL(u).MustConnect()
page := browser.MustPage("chrome://policy")
page.MustWaitLoad().MustScreenshot("2.png")

i need to be able to access the chrome://policy chrome://version and chrome-extension://extesionID/home.html"

What you got

panic: navigation failed: net::ERR_INVALID_URL

What you expected to see

i expect a screenshot of the chrome:// or chrome-extension:// pages content but it panic as soon as the url contain this kinds of urls.

What have you tried to solve the question

running fine if i run not with the docker but with my local Chrome Beta with

chrome-canary --headless=new --disable-gpu --remote-debugging-port=9222

but at some point i will need to run with your docker. thanks for any help for the config or feedback.

rod-robot commented 1 year ago

Please fix the format of your markdown:

6 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]
11 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"]
22 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]
23:116 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
25 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
36 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]

generated by check-issue

ysmood commented 1 year ago

I think it's not allowed by cdp

jojorb commented 1 year ago

at i first i think it was due to the new tag --headless=new that make it possible with a local chrome, and just need a proper update on the docker image. because yes this works outside the docker with go-rod lib, is it cdp related if so?

ysmood commented 1 year ago

I think it's not allowed by cdp in headless mode.