tebeka / selenium

Selenium/Webdriver client for Go
MIT License
2.54k stars 410 forks source link

Service always runs in DEBUG #193

Open superbeeny opened 4 years ago

superbeeny commented 4 years ago

With this line the service always runs in debug https://github.com/tebeka/selenium/blob/master/service.go#L189 this is problematic for me as I'm using selenium to login and it's writing the credentials to the log.

Would you approve a PR to make it based on the/a SetDebug flag?

minusnine commented 4 years ago

Would you approve a PR to make it based on the/a SetDebug flag?

Yes. Thanks!

awlunsfo commented 3 years ago

In case someone sees this in the future, you can hide all selenium output by passing nil as the output in ServiceOption:

opts := []selenium.ServiceOption{
    selenium.Output(nil), // hides all output from the selenium server/webdriver
}

svc, err := selenium.NewSeleniumService("path/to/selenium", 8080, opts...)
bretterer commented 3 years ago

So, that does not work @awlunsfo, I'm still getting a lot of debug outputs. Am I doing something wrong here?

    sopts := []selenium.ServiceOption{
        selenium.ChromeDriver(chromeDriverPath), 
        selenium.Output(nil),          
    }

    th.service, err = selenium.NewSeleniumService(seleniumPath, port, sopts...)
    if err != nil {
        panic(err) // panic is used only as an example and is not otherwise recommended.
    }

    th.Capabilities.SetLogLevel(slog.Server, slog.Off)
    th.Capabilities.SetLogLevel(slog.Browser, slog.Off)
    th.Capabilities.SetLogLevel(slog.Client, slog.Off)
    th.Capabilities.SetLogLevel(slog.Driver, slog.Off)
    th.Capabilities.SetLogLevel(slog.Performance, slog.Off)
    th.Capabilities.SetLogLevel(slog.Profiler, slog.Off)
    th.wd, err = selenium.NewRemote(th.Capabilities, th.DefaultURL)