失败:chrome org.openqa.selenium.WebDriverException:**Selenoid*



尝试在我的aws ec2服务器中运行selenoid

java代码:-

@Test
public void chrome() throws MalformedURLException{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("chrome");
capabilities.setVersion("80.0");
capabilities.setCapability("enableVNC", true);
capabilities.setCapability("enableVideo", false);
RemoteWebDriver   driver = new RemoteWebDriver(new 
URL("http://x2.66.24x.xxx:4444/wd/hub"),capabilities);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
driver.get("https://www.google.com");
WebElement hello = driver.findElement(By.name("q"));
hello.sendKeys("hello");
hello.sendKeys(Keys.ENTER);
try {
Thread.sleep(100000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

driver.close();
}

当运行上面的代码时,我可以看到为chrome浏览器创建了一个新的会话,所有操作都将获得执行,但在最后,它将通过exception&我在firefox上也遇到了同样的错误

2020年4月1日下午10:59:15 org.openqa.selenium.remote.DesiredCapabilities chrome信息:使用new ChromeOptions()比使用DesiredCapabilities.chrome()更可取2020年4月1日下午10:59:18组织。penqa.selenium.remote.ProtocolHandshake createSession信息:检测到的方言:W3C2020年4月1日下午11:01:01 org.openqa.selenium.remote.ErrorCodes to Status信息:HTTP状态:"404"->"未知错误"的JSON状态映射不正确(应为500(失败:铬org.openqa.selenium.WebDriverException:发生未知错误内部版本信息:版本:3.141.59,修订:e82be7d358,时间:2018-11-14T08:17:03系统信息:主机:"LAPTOP-B5FT9H4U",ip:"xx.1xx.x9.1",os.name:"Windows 10",os.arch:"amd64",os.version:"10.0",java.version:"1.8.0_181"驱动程序信息:org.openqa.selenium.remote.RemoteWebDriver功能{acceptInsecureCerts:false,browserName:chrome,browserVersion:80.0.3987.132,chrome:{chromedriverVersion:80.0.30987.106(f68069574609…,userDataDir:/tmp/.google.chrome.7xE3Rs(,goog:chromeOptions:{debuggerAddress:localhost:40995},javascriptEnabled:true,networkConnectionEnabled:false,pageLoadStrategy:normal,platform:LINUX,platformName:LINUX,proxy:proxy((,setWindowRect:true,strictFileInteractibility:false,超时:{隐式:0,页面加载:300000,脚本:30000},unhandledPromptBehavior:解除并通知}会话ID:2936e2a690849c764a8e0dd5f7001da

我遇到了类似的问题,并设法通过增加会话超时来解决(至少目前(:

capabilities.setCapability("sessionTimeout", "5m");

最新更新