Comments (6)
from rod.
The following code uses os.StartProcess
as go-rod and succeeds in starting an independent instance.
// From https://gist.github.com/lee8oi/ec404fa99ea0f6efd9d1
func Start(args ...string) (p *os.Process, err error) {
if args[0], err = exec.LookPath(args[0]); err == nil {
var procAttr os.ProcAttr
procAttr.Files = []*os.File{os.Stdin,
os.Stdout, os.Stderr}
p, err := os.StartProcess(args[0], args, &procAttr)
if err == nil {
return p, nil
}
}
return nil, err
}
func startFirefox2() {
p, err := Start("firefox", "--profile", "/home/.../Data/nz5ijj7z.profile", "--new-instance")
if err != nil {
panic(err)
}
p.Wait()
}
Trying to start firefox with go-rod and Leakless(false)
fails. I still get the error that firefox is already running. But getting the debug port given in the parameters succeeds.
from rod.
https://go-rod.github.io/#/compatibility?id=supported-browsers
from rod.
I finally identified the cause.
Firefox ignores the argument --profile
if its value is attached with =
. Surprisingly, it doesn’t ignore the --remote-debugging-port=9333
argument. It does open the port 9333.
This is a limitation of firefox with the --profile
parameter. There may be other parameters like that.
The following code does nearly everything like go-rod except that the profile parameter is properly separated. It then works and port 9333 is opened.
func Start(bin string, args ...string) (p *os.Process, err error) {
cmd := exec.Command(bin, args...)
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
cmd.Stdout = io.MultiWriter(io.Discard, launcher.NewURLParser())
cmd.Stderr = io.MultiWriter(io.Discard, launcher.NewURLParser())
err = cmd.Start()
if err != nil {
return
}
return cmd.Process, err
}
func startFirefox2() {
p, err := Start("/usr/bin/firefox", "--new-instance", "--profile", profileDir, "--remote-debugging-port=9333")
if err != nil {
panic(err)
}
p.Wait()
}
I don’t know if there can be a quick fix to use go-rod with firefox. As I can’t test the code beyond that I don’t know.
from rod.
So apparently, firefox is not supported by go-rod because of another problem. Sorry to hear that.
from rod.
I’m in the process to fix the firefox command line limitation myself so that it will support "--option=param" arguments as needed for go-rod. The code fix is written and going through the review process.
from rod.
Related Issues (20)
- Click Button Eval Js Not Working HOT 4
- 获取点击后的response失败 HOT 2
- How to hide chromium command prompt HOT 2
- Element存在,但Element.MustHas却为false,检测不到Element HOT 2
- How to open a new Chrome window while using remote control HOT 4
- How to disable the dialog when open External protocols HOT 2
- How to Set or replace response headers HOT 2
- Proxy and Hijack HOT 3
- Just a recipe to run a go-rod program as systemd service HOT 1
- How to Log CDP Logs to a File or Use slog HOT 2
- Failed to deserialize params.body - BINDINGS: binary value expected at position 61 HOT 5
- failed page screenshot in defer HOT 2
- launcher docker 是否支持常驻且直接连接 HOT 4
- Examples fail on Ubuntu 24.04 with "No usable sandbox!" HOT 8
- Open the webpage, the page size is changed HOT 1
- Limit the number of redirects and store all accessed URLs HOT 1
- NewUserMode 无法关闭浏览器 HOT 1
- NewUserMode 和 NewManaged 可以同时使用吗 HOT 1
- How do I get Ifram without using--disable-site-isolation-trials? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rod.