我们使用selenium创建了许多测试套件。当我们单独执行它们时,它们都成功运行。但是当我们尝试运行整个套件时,浏览器会在随机时间死亡,并且我们收到以下错误消息。
org.openqa.selenium.WebDriverException: Error communicating with the remote browser. It may have died.
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'XXX-XXXX102', ip: 'XX.XX.XX.XXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Driver info: driver.version: EventFiringWebDriver
Command duration or timeout: 22.04 seconds
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'XXX-XXXX102', ip: 'XX.XX.XX.XXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
*** Element info: {Using=xpath, value=.//div[contains(@class,'dijitDialog') and @role='dialog' and contains(@style,'opacity: 1')]//input[@name='uploadedfiles[]' and @type='file']}
Session ID: e536c0bb-57a3-4d20-84e4-d3760ff9ddd3
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, acceptSslCerts=false, browserName=firefox, rotatable=false, locationContextEnabled=true, webdriver.remote.sessionid=e536c0bb-57a3-4d20-84e4-d3760ff9ddd3, version=38.0.1, databaseEnabled=true, cssSelectorsEnabled=true, handlesAlerts=true, webStorageEnabled=true, nativeEvents=false, applicationCacheEnabled=true, takesScreenshot=true}]
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'XXX-XXXX102', ip: 'XX.XX.XX.XXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Driver info: driver.version: EventFiringWebDriver
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'XXX-XXXX102', ip: 'XX.XX.XX.XXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Driver info: driver.version: unknown
据我所知,代码中没有错误。因此,请告诉我,在什么条件下,selenium网格会自动杀死浏览器。
答案 0 :(得分:3)
sudo
此错误是由于某些原因造成的。
1)意外的浏览器会在一段时间后关闭,否则你的网格机会做同样的事情。
2)Error communicating with the remote browser. It may have died.
在完成执行之前调用。
driver.close();
。 3)driver.close();
也有与第2点相同的问题。
4)请同时检查您的驱动程序实例是否完美无处不在。