我在物理机器(Windows 10,RAM 16Gb,x64)上启动了一个hub:
java -jar selenium-server-standalone-2.53.0.jar -role hub port 4444
同时,我在虚拟机上注册了一个node(我使用VirtualBox:Linux,Ubuntu 16.04.2;i386。基础内存:2048 Mb):
java -jar selenium-server-standalone-2.53.0.jar -role webdriver port 9999 -hub http://172.xx.xxx.248:4444/grid/register
IDE配置:WebDriver driver = new RemoteWebDriver(new URL("http://10.0.2.15:9999/wd/hub"), capabilities);
运行测试时出现错误:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 10.0.2.15:9999 [/10.0.2.15] failed: Connection timed out: connect
物理机地址:172.xx.xxx.248
虚拟机地址:10.0.2.15