繁体   English   中英

无法连接到硒网格节点

[英]Unable to connect to selenium grid node

我正在尝试使用RemoteWebDriver连接到Linux机器上的“否”,但未成功。 这是代码:

public WebDriver googlechrome(){ /*Method to start Google Chrome.*/

    WebDriver driver = null;
    ChromeOptions options = new ChromeOptions(); /*ChromeOptions is for firing Chrome with additional settings.*/
    options.addArguments("--allow-file-access-from-files"); /*Allow Chrome to access files*/
    options.addArguments("user-data-dir="+System.getProperty("user.dir")+pathChrome);
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    capabilities.setBrowserName("chrome");
    capabilities.setPlatform(Platform.LINUX);
    try { //            driver = new RemoteWebDriver(new URL("http://localhost:9515"), capabilities);
         driver = new RemoteWebDriver(new URL("http://jenkins.bgr.ionidea.com:4444/grid/console"),capabilities);
         Chatterbox.chatterinfo("Connected to Chromedriver");
    } catch (Exception e) {
        Chatterbox.chattererror("Could not connect to Chromedriver. Here is the stacktrace:", e); //           
        e.printStackTrace();
    }
    return driver;
}

当我在本地计算机上运行此代码时,它可以正常工作。 但是,当我尝试通过Grid运行它时,遇到以下错误。

org.openqa.selenium.WebDriverException:无法解析远程响应:Grid Console.busy {opacity:0.4; filter:alpha(opacity = 40);}

网格控制台v.3.1.0

https://github.com/SeleniumHQ/selenium/wiki/Grid2'> HelpDefaultRemoteProxy (版本:3.4.0)id: http:// proxyhost:port ,操作系统:LINUX

    BrowsersConfiguration
的webdriver

五:

五:

browserTimeout:0

调试:错误

帮助:错误

端口:5555

角色:节点

超时时间:1800

cleanUpCycle:5000

主持人:10.91.3.204

maxSession:5

功能:功能[{seleniumProtocol = WebDriver,browserName = firefox,maxInstances = 5,platform = LINUX}]

功能:功能[{seleniumProtocol = WebDriver,browserName = chrome,maxInstances = 5,platform = LINUX}]

downPollingLimit:2

集线器: http:// jenkins主机:jenkins端口

id: http://节点 ip:节点端口

hubHost:jenkins.bgr.ionidea.com

hubPort:4444

nodePolling:5000

nodeStatusCheckTimeout:5000

代理:org.openqa.grid.selenium.proxy.DefaultRemoteProxy

注册:真实

注册周期:5000

remoteHost: http:// node ip:node端口

unregisterIfStillDownAfter:60000

    查看配置内部版本信息:版本:'3.4.0',版本:'未知',时间:'未知'系统信息:主机:'Brindalas-MacBook-Air-2.local',ip:'10 .91.17.123',os .name:'Mac OS X',os.arch:'x86_64',os.version:'10 .11.5',java.version:'1.8.0_121'驱动程序信息:driver.version:org.openqa.selenium上的RemoteWebDriver org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)上的.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:353)org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142 )的org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)处的org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)处的org.openqa.selenium.remote.RemoteWebDriver org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:137)处的org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:174)处的startSession(RemoteWebDriver.java:236)在core.drivers.Browsers处.googlechrome(Browsers.java :45)在core.drivers.Selenium.startBrowser(Selenium.java:18)在tryFireBrowser.fireBrowser(tryFireBrowser.java:13)在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)在sun.reflect.NativeMethodAccessorImpl.invoke(在org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper .java:108),位于org.testng.internal.Invoker.invokeMethod(Invoker.java:661),位于org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869),位于org.testng.internal.Invoker.invokeTestMethods( Inorger.java:1193)位于org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)位于org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)位于org.testng.TestRunner.privateRun(TestRunner) .java:744),位于org.testng.TestRunner.run(TestRunner.java:602),位于org.testng.SuiteRunner.runTest(SuiteRunner.jav a:380)在org.testng.SuiteRunner.run(SuiteRunner.java:375)在org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)在org.testng.SuiteRunner.run(SuiteRunner.java:289)在org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)的org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:86)org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)的org.testng.TestNG.org org.testng.TestNG.runSuitesLocally(TestNG.java:1226)org.testng.TestNG.run(TestNG.java:1115)org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG) java:72)位于org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127)位于sun.reflect.NativeMethodAccessorImpl.invoke0(本地方法)位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)位于sun.reflect .com.intellij.rt.execution.application.AppMain.main(AppMain.j)上的java.lang.reflect.Method.invoke(Method.java:498)上的.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) AVA:147)

    异常的第一行说它无法解析某些内容,但是我不明白是什么?

    我想念什么吗? 我是第一次进行网格设置。

    问题出在下面一行

    driver = new RemoteWebDriver(new URL("http://jenkins.bgr.ionidea.com:4444/grid/console"),capabilities);

    您正在连接到控制台servlet,而不是连接到负责执行新会话的servlet。

    请将以上行更改为

    driver = new RemoteWebDriver(new URL("http://jenkins.bgr.ionidea.com:4444/wd/hub"),capabilities);

    然后再试一次。 你应该没事的。

    暂无
    暂无

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM