zserge / lorca

Build cross-platform modern desktop apps in Go + HTML5
MIT License
8k stars 532 forks source link

Running with latest Chrome version #167

Open ReneJBosch opened 2 years ago

ReneJBosch commented 2 years ago

Latest Chrome version no longer supports the "--disable-infobars" argument, so lorca now runs with the text "Chrome is being controlled by automated test software" in the info-bar. To be fair ...It does not break the running of the program but it is annoying.
Argument should be replaced by an "enable-automation" Chrome option.

pierrejoye commented 2 years ago

While it should be added, in the meantime you can pass custom args to the New method:

func New(url, dir string, width, height int, customArgs ...string) (UI, error)
ReneJBosch commented 2 years ago

Yes, I have seen that, but how? It is not just a matter of specifying something like "--enable-automation" because no such argument exists.
It appears to be a Chrome option called "excludeSwitches" which must be followed by an array of such switches, so in this case - as there's only one - by "[enable-automation]". I don't know how to specify that as a (custom) argument (provided you can)

FrankFang commented 2 years ago

I could not find a method to set "excludeSwitches" via Chrome's command-line arguments.

pierrejoye commented 2 years ago

Ah, it seems to be a flag, experimental, the New method does not allow to pass flags. The chrome instance object must have the methods to enable/disable flags, I did not check yet.

FrankFang commented 2 years ago

Any ideas?

gg3083 commented 2 years ago

hi guys, Has good idea?

bin16 commented 2 years ago

Can you guys check this: https://peter.sh/experiments/chromium-command-line-switches/#enable-automation

--enable-automation | Enable indication that browser is controlled by automation.

It looks that the --enable-automation flag is used to show that message "Chrome is controlled by...", removing it from defaultChromeArgs in ui.go may help. https://github.com/zserge/lorca/blob/1006348e1931ab40106e97ceefa9514ebd9ac9e5/ui.go#L52

bin16 commented 2 years ago

Tiny demo, no message bar and no shadow:

image
package main

import (
    "os/exec"
)

func main() {
    browser := "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
    args := []string{
        "--no-first-run",
        // "--enable-automation",
        "--app=data:text/html, <h1>hello!</h1>",
        "--window-size=300,200",
        "--remote-debugging-port=0",
        "--user-data-dir=./a/",
    }
    cmd := exec.Command(browser, args...)
    cmd.Start()
}

May be you should clear the user data dir at first.

gg3083 commented 2 years ago

Can you guys check this: https://peter.sh/experiments/chromium-command-line-switches/#enable-automation

--enable-automation | Enable indication that browser is controlled by automation.

It looks that the --enable-automation flag is used to show that message "Chrome is controlled by...", removing it from defaultChromeArgs in ui.go may help.

https://github.com/zserge/lorca/blob/1006348e1931ab40106e97ceefa9514ebd9ac9e5/ui.go#L52

it`s work

cgostuff commented 2 years ago

Can you guys check this: https://peter.sh/experiments/chromium-command-line-switches/#enable-automation

--enable-automation | Enable indication that browser is controlled by automation.

It looks that the --enable-automation flag is used to show that message "Chrome is controlled by...", removing it from defaultChromeArgs in ui.go may help. https://github.com/zserge/lorca/blob/1006348e1931ab40106e97ceefa9514ebd9ac9e5/ui.go#L52

it`s work

Doesn't work for me. Did you have to delete some cached data? I pass an empty string to lorca.New dir parameter, so the user data should be deleted already in my case.

gg3083 commented 2 years ago

Can you guys check this: https://peter.sh/experiments/chromium-command-line-switches/#enable-automation

--enable-automation | Enable indication that browser is controlled by automation.

It looks that the --enable-automation flag is used to show that message "Chrome is controlled by...", removing it from defaultChromeArgs in ui.go may help. https://github.com/zserge/lorca/blob/1006348e1931ab40106e97ceefa9514ebd9ac9e5/ui.go#L52

it`s work

Doesn't work for me. Did you have to delete some cached data? I pass an empty string to lorca.New dir parameter, so the user data should be deleted already in my case.

I only modified the source code 'defaultChromeArgs' . (ui.go 52 line) // '--enable-automation'

cgostuff commented 2 years ago

Can you guys check this: https://peter.sh/experiments/chromium-command-line-switches/#enable-automation

--enable-automation | Enable indication that browser is controlled by automation.

It looks that the --enable-automation flag is used to show that message "Chrome is controlled by...", removing it from defaultChromeArgs in ui.go may help. https://github.com/zserge/lorca/blob/1006348e1931ab40106e97ceefa9514ebd9ac9e5/ui.go#L52

it`s work

Doesn't work for me. Did you have to delete some cached data? I pass an empty string to lorca.New dir parameter, so the user data should be deleted already in my case.

I only modified the source code 'defaultChromeArgs' . (ui.go 52 line) // '--enable-automation'

Strange, I do the same, and "Chrome is being controlled by automated test software" is still shown.

gg3083 commented 2 years ago

Can you guys check this: https://peter.sh/experiments/chromium-command-line-switches/#enable-automation

--enable-automation | Enable indication that browser is controlled by automation.

It looks that the --enable-automation flag is used to show that message "Chrome is controlled by...", removing it from defaultChromeArgs in ui.go may help. https://github.com/zserge/lorca/blob/1006348e1931ab40106e97ceefa9514ebd9ac9e5/ui.go#L52

it`s work

Doesn't work for me. Did you have to delete some cached data? I pass an empty string to lorca.New dir parameter, so the user data should be deleted already in my case.

I only modified the source code 'defaultChromeArgs' . (ui.go 52 line) // '--enable-automation'

Strange, I do the same, and "Chrome is being controlled by automated test software" is still shown.

my code

ui, err := lorca.New("", "", 1366, 768, []string{})
cgostuff commented 2 years ago

Can you guys check this: https://peter.sh/experiments/chromium-command-line-switches/#enable-automation

--enable-automation | Enable indication that browser is controlled by automation.

It looks that the --enable-automation flag is used to show that message "Chrome is controlled by...", removing it from defaultChromeArgs in ui.go may help. https://github.com/zserge/lorca/blob/1006348e1931ab40106e97ceefa9514ebd9ac9e5/ui.go#L52

it`s work

Doesn't work for me. Did you have to delete some cached data? I pass an empty string to lorca.New dir parameter, so the user data should be deleted already in my case.

I only modified the source code 'defaultChromeArgs' . (ui.go 52 line) // '--enable-automation'

Strange, I do the same, and "Chrome is being controlled by automated test software" is still shown.

my code

ui, err := lorca.New("", "", 1366, 768, []string{})

Thanks, now it does work for me too. The issue for me was that the source code was in read-only mode.

cgostuff commented 2 years ago

Actually, I've found that removing the "--enable-automation" flag alone is not a great fix. This causes the "save password" bubble to pop up whenever you use lorca to log in somewhere.

This comment explains the side effects of disabling automation: https://github.com/puppeteer/puppeteer/issues/2070#issuecomment-519126334

The flag "--disable-save-password-bubble" has apparently also been removed a while back. It seems they have made it very difficult to hide both the password bubble and the automation infobar at the same time.

aviscaerulea commented 2 years ago

I am also having the same problem. When I run the code from https://github.com/zserge/lorca/issues/167#issuecomment-1046050490 the info bar does not show up. However, removing --enable-automation from github.com/zserge/lorca/ui.go in vendor does not hide the info bar.

Deleting Chrome's cache and temporary files did not change the result.

Is there a temporary way to address this issue?

Environments : Chromium 98.0.4758.106 Built on Debian , running on Debian 11 (on Raspberry Pi 3 aarch64)

cgostuff commented 2 years ago

Has anyone had any luck removing both the infobar and the save password prompt at the same time?

On a somewhat related note, I have been able to disable the google translate UI by passing an experimental flag into New() like this: "--disable-features=Translate". Can we perhaps leverage the "--disable-features=x" argument to solve the issue?

Based on some additional research, it seems that the CommandLineFlagSecurityWarningsEnabled policy can actually control the infobar on newer chrome versions, like disable-infobars used to.

Bellisario commented 2 years ago

Any solution? I'm having the same problem...

buildnewapp commented 2 years ago

modify lorca/ui.go: remove "--enable-automation",

    "--no-default-browser-check",
    "--safebrowsing-disable-auto-update",
    //"--enable-automation",
    "--password-store=basic",
    "--use-mock-keychain",

it's ok for me, chrome v103 with mac

prospero78 commented 1 year ago

modify lorca/ui.go: remove "--enable-automation",

Two tea for this sir!

tooolbox commented 1 year ago

Removing the "--enable-automation" flag from ui.go did solve the problem for me, although I'm concerned about Lorca popping up Save Password dialogs. Ideally this gets a solution which doesn't break something else.

dcboy commented 1 year ago

use this args --disable-features=automation