【发布时间】:2020-07-06 08:20:42
【问题描述】:
我正在尝试自动化具有用于登录的集成网页的 JavaFx 应用程序。 我正在使用此处找到的代码:https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013135-jxbrowser-selenium 一切都在我的本地机器上运行良好。 问题是我需要在远程机器上打开应用程序并与之集成。 上面的代码不起作用,我得到了
unknown error: cannot connect to chrome at 192.168.2.147:9222
from chrome not reachable
错误。
我尝试了另一种不使用 chromeDriverService 而是使用 selenium 网格的方法,它看起来像这样:
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;
我在端口 5555 上运行集线器,在机器机器上运行节点。 chromeDriver 在路径 envVar 中,我在 cmd 窗口中看到发送了连接请求。 结果是一样的。
谁能告诉我我在这里做错了什么? 这种远程 jxbroswer 自动化可以实现吗?
编辑: 当我在远程机器上初始化 Chrome 会话时,它按预期工作(使用 selenium 网格)但是当我添加时
options.setExperimentalOption("debuggerAddress", remoteDebuggingAddress);
它失败并出现同样的错误。
【问题讨论】:
-
你设置远程机器的chrome驱动位置了吗?
-
正如我所提到的,chrome 驱动程序位于远程机器上的 PATH 和网格节点输出中,我可以看到他正在启动 chromeDriver,但无法连接
标签: java selenium javafx automation jxbrowser