Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to connect into an Electron compiled app instead of a Chromium based browser? #423

Closed
Bolado opened this issue May 25, 2021 · 1 comment
Labels
question Questions related to rod

Comments

@Bolado
Copy link

Bolado commented May 25, 2021

Rod Version: v0.99.0

The code to demonstrate your question

browser := rod.New()
launcher := launcher.New().Bin(execPath + "\\bin\\electronapp\\App.exe")

What have you tried to solve the question

I have seen it being done in some other libs, but I would like to know if it's possible on Rod, it's good to know because the motivation of it being supported is quite nice.

In comparison with the full-featured Chromium browser (~108MB Mac, ~113MB Linux, ~141MB Win for ZIP package), A portable alternative ------ Electron is able to handle most daily tasks but has half of Chromium's size (~55MB Mac, ~63MB Linux, ~58MB Win for ZIP package)

@Bolado Bolado added the question Questions related to rod label May 25, 2021
@ysmood
Copy link
Member

ysmood commented May 25, 2021

According to here: https://www.electronjs.org/docs/api/command-line-switches#--remote-debugging-portport

const { app } = require('electron')
app.commandLine.appendSwitch('remote-debugging-port', '8315')

app.whenReady().then(() => {
  // Your code here
})

Use rod to connect to the port:

u := launcher.MustResolveURL("8315")
browser := rod.New().ControlURL(u).MustConnect()

For more info: https://github.com/go-rod/rod/blob/master/lib/examples/connect-browser/main.go

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

3 participants