Skip to content
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

Connect to multiple windows in parallel #31

Closed
MaestroJurko opened this issue May 30, 2016 · 9 comments
Closed

Connect to multiple windows in parallel #31

MaestroJurko opened this issue May 30, 2016 · 9 comments
Labels

Comments

@MaestroJurko
Copy link

Is it possible to connect to multiple chromium windows at the same time? Now we connect to a chromium browser through --remote-debugging-port, and we would like to run multiple evaluation tests on multiple windows at the same time.

Any suggestions?

@cyrus-and
Copy link
Owner

The port decides the Chrome instance while you can attach to a specific tab/window using the chooseTab option.

Now, in parallel means that you will have several instances of the client:

Chrome(options1, function (chrome) { /*...*/ });
Chrome(options2, function (chrome) { /*...*/ });
// ...

@MaestroJurko
Copy link
Author

Exactly, but how would you differentiate between windows? Can you specify to which window can Chrome connect to, and can multiple Chrome be connected to the same chromium browser?

@cyrus-and
Copy link
Owner

There's no such thing as windows for what concerns the remote debugging protocols, only tabs, be them part of the same window or not. You can obtain the list of the currently opened tabs for a given browser instance identified by a port with Chrome.List, after that you can select one tab object from the returned array and feed it to the chooseTab option.

@MaestroJurko
Copy link
Author

Ok thank you, will try. It is a bit of an issue, because as I understand, nw.js is build on chromium but it does not support tabs.

@cyrus-and
Copy link
Owner

Different windows of the same Chrome instance are considered tabs. Try this:

  1. start your nw.js application like nw --remote-debugging-port=9222 /the/app;
  2. manage to open multiple windows;
  3. visit http://localhost:9222/json and see if there is an entry for each open window.

If that's the case you can use the method I described above.

@MaestroJurko
Copy link
Author

Thx again.

@MaestroJurko
Copy link
Author

MaestroJurko commented Jun 8, 2016

I am having a little bit of trouble with never versions of nw.js - chromium and how to open my app inside of it.

Works with version 0.12.3:

Chrome.New({
    port: that.options.port,
    url: 'file:///' + config.launcher.def_officer_nwjs.appDir + '/index.html'
    }, function (err, tab) {
});

But with never versions ( > 0.12.3), url that is used for oppening app does not use file. First window that is successfully opened:

{
description: "",
devtoolsFrontendUrl: "/devtools/inspector.html?ws=localhost:12406/devtools/page/8573B029-FCF9-4EB2-B8BA-A5D2FFCD5EE4",
faviconUrl: "chrome://extension-icon/laeohklakmaeckjcebinbjcagklmbcnm/24/1",
id: "8573B029-FCF9-4EB2-B8BA-A5D2FFCD5EE4",
title: "nw-guardian-app",
type: "app",
url: "chrome-extension://laeohklakmaeckjcebinbjcagklmbcnm/index.html",
webSocketDebuggerUrl: "ws://localhost:12406/devtools/page/8573B029-FCF9-4EB2-B8BA-A5D2FFCD5EE4"
}

Version 0.12.3

url: 'file:///......'

Any suggestions on how to successfully open my app in new window?

@cyrus-and
Copy link
Owner

I don't know, I've never used NW.js but I think you can always start a new application with nw using a child process (if you really need to do that from Node.js).

You should post a message on the NW.js mailing list, this doesn't seem to concern chrome-remote-interface.

@MaestroJurko
Copy link
Author

Well I dont want to do that through nw, but with this library, because Chrome.New opens a new window. When ran with nw, it will open up a new browser.

Ok thank's for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants