Why am I getting "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure." error

huangapple go评论78阅读模式
英文:

Why am I getting "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure." error

问题

使用Selenium Grid,我有一个注册了一个节点的Hub。Hub和Node位于不同的网络上。以下是HubNode的配置:

Why am I getting "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure." error
Why am I getting "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure." error

如果我理解错误,请纠正我,但在我看来,这一切都是正确的。但问题在于,当我运行我的Java代码(在与Hub和Node不同网络的不同计算机上)时,我会收到此错误消息:

构建信息:版本:'3.141.59',修订版本:'e82be7d358',时间:'2018-11-14T08:25:53'
系统信息:主机:'NROLL97',IP:'192.168.86.31',操作系统名称:'Windows 10',操作系统架构:'amd64',操作系统版本:'10.0',Java版本:'1.8.0_261'
驱动程序信息:驱动程序版本:RemoteWebDriver

系统信息对于我从其运行Java项目的计算机是正确的,但我觉得它应该显示具有远程Web驱动程序(即将实际运行测试的AWS Linux 2计算机)的计算机的系统信息。由于它显示具有远程Web驱动程序的版本,我认为它也应该向我提供具有远程Web驱动程序的计算机的系统信息。

这个错误消息几乎没有用;在Stack Overflow上已经有很多关于这个问题的回答,大多数回答都会告诉我确保我有正确的版本。我可以确定这不是问题,因为当我在本地测试时,这些相同的版本是可行的。

这是我的DriverInit类:

public class DriverInit {

    public WebDriver driver;
    public ChromeOptions chromeOptions;
    public DesiredCapabilities caps;
     
    public static final String URL = "http://3.128.83.181/:4444/wd/hub";

    DriverInit(int row) throws MalformedURLException {
        // 用于本地自动化测试
        // this.chromeOptions = new ChromeOptions();
        // this.chromeOptions.addArguments("--headless");
        // String chromeDriverPath = "resources/chromedriver.exe";
        // System.setProperty("webdriver.chrome.driver", chromeDriverPath);
        // this.driver = new ChromeDriver();
        // this.driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

        // 用于AWS
        ChromeOptions options = new ChromeOptions();
        options.setCapability(CapabilityType.BROWSER_NAME, "chrome");
        options.addArguments("--headless");
        options.setCapability(CapabilityType.PLATFORM_NAME, Platform.LINUX);
        driver = new RemoteWebDriver(new URL(URL), options);
        driver.manage().window().maximize();
    }

    public WebDriver getDriver() {
        return this.driver;
    }
}
英文:

Using Selenium Grid, I have a hub that has one node registered to it. The Hub and Node are on different networks. These are the configurations for the Hub and the Node:
Why am I getting "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure." error
Why am I getting "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure." error

Please correct me if I am wrong, but this all looks correct to me. But the problem is that when I run my Java code (on a different computer and in a different network from the hub and node), I get this error:

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'NROLL97', ip: '192.168.86.31', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261'
Driver info: driver.version: RemoteWebDriver

The system info is correct for the machine that I am running my java project from, but I feel like it should be showing the System Info of the machine that has the remote web driver (which is an AWS Linux 2 machine) where the test will actually be ran. Since it is showing that it has a version for the remote web driver, I would think it would also tell me the System Info of the machine with the remote web driver.

The error message is almost useless; the majority of answers to this question already on SO will tell me to be sure I have the correct versions. I am certain that is not the issue, because these same versions work when I test locally.

And this is my DriverInit class:

public class DriverInit{

	   public WebDriver driver;
	   public ChromeOptions chromeOptions;
	   public DesiredCapabilities caps;
	     
	   public static final String URL = "http://3.128.83.181/:4444/wd/hub";


	    DriverInit(int row) throws MalformedURLException {
	    	// for local automated testing
//	    	this.chromeOptions = new ChromeOptions();
//	    	this.chromeOptions.addArguments("--headless");
//	    	String chromeDriverPath = "resources/chromedriver.exe";
//	    	System.setProperty("webdriver.chrome.driver", chromeDriverPath);
//	        this.driver = new ChromeDriver();
//	        this.driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	    	
	    	
	    	// FOR AWS
	    	ChromeOptions options = new ChromeOptions();
	    	 options.setCapability(CapabilityType.BROWSER_NAME, "chrome");
	    	options.addArguments("--headless");
	    	options.setCapability(CapabilityType.PLATFORM_NAME, Platform.LINUX);
	    	driver = new RemoteWebDriver(new URL(URL), options);
	    	driver.manage().window().maximize();


	    }
	    


	    public WebDriver getDriver() {
	        return this.driver;
	    }
	    
	   
}

答案1

得分: 0

错误出在URL中。"http://3.128.83.181/:4444/wd/hub"; 需要修改为 "http://3.128.83.181:4444/wd/hub";

英文:

The error is in the URL. "http://3.128.83.181/:4444/wd/hub"; needed to be changed to "http://3.128.83.181:4444/wd/hub";

huangapple
  • 本文由 发表于 2020年9月16日 02:13:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/63907637.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定