Search code examples
javaseleniumjavafxautomationjxbrowser

Cant initialize remote JxBrowser using Chromedriver and Selenium


I am trying to automate a JavaFx application which has an integrated web page for loggin in. I am using the code found here: https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013135-jxbrowser-selenium and every thing is working great on my local machine. The issue is that I need to open the application on a remote machine and integrate with it as well. The above code will not work, I am getting

unknown error: cannot connect to chrome at 192.168.2.147:9222
from chrome not reachable

ERROR.

I have tried another method not using the chromeDriverService but using selenium grid and it looks like this:

DesiredCapabilities capabilities = new DesiredCapabilities();
ChromeOptions options = new ChromeOptions();

String remoteDebuggingAddress = add + ":9222";

options.setExperimentalOption("debuggerAddress", remoteDebuggingAddress);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);

LoggingPreferences logs = new LoggingPreferences();
logs.enable(LogType.BROWSER, Level.ALL);
capabilities.setCapability(CapabilityType.LOGGING_PREFS, logs);

jxDriver = new RemoteWebDriver(new URL("http://" + add + ":5555" + "/wd/hub"), capabilities);
return jxDriver;

I run the hub on port 5555 and the node on the machine machine. The chromeDriver is in the path envVar, and I see in the cmd window that a connection request is sent. The result is the same.

Can anyone please advise what am I doing wrong here? Can this remote jxbroswer automation possible?

EDIT: When I initialize a Chrome session on the remote machine it works as expected (using selenium grid) but when I add

options.setExperimentalOption("debuggerAddress", remoteDebuggingAddress);

it fails with same error.


Solution

  • So I was able to find the solution for this and the problem was the IP that I sent to "debuggerAddress". While I sent the remote machine IP I should have used "localhost" as the connection was already established using the selenium grid.