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

How to hide chromium command prompt #1056

Open GosMachine opened 4 months ago

GosMachine commented 4 months ago

Rod Version: v0.115.0 I know this can be done with selenium, can I do this in rod?

The code to demonstrate your question

func (b *Browser) runBrowser(proxy, username, password, action string) error {
    u := launcher.New().
        // Delete("--headless").
        Set("--no-sandbox").
        Set("--no-first-run").
        Set("--new-window").
        Set("--window-size", "400,400").
        Set("--disable-blink-features", "AutomationControlled").
        Set("--disable-setuid-sandbox").
        Bin(b.binPath)
    launch, err := u.Launch()
    if err != nil {
        return err
    }
    browser := rod.New().ControlURL(launch)
    err = browser.Connect()
    if err != nil {
            return err
    }
    if username != "" && password != "" {
        go browser.MustHandleAuth(username, password)()
    }
    b.browser = browser
    return nil
}

What you got

screen

What have you tried to solve the question

I do not have this problem in linux with chromium. When i am using google chrome in windows i do not have it too, but i need fix it with chromium on windows 10

github-actions[bot] commented 4 months ago

Please fix the format of your markdown:

34 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## What you got"]

generated by check-issue

ysmood commented 4 months ago

Disable the leakless might do.