Проблема
Когда я запускаю 2 узла Firefox с 1 экземпляром, каждый без проблем.Но если я выполняю с 3 или более 3 узлами, получаю ошибку ниже.Нет проблем, если я выполню 100 тестовых случаев в chrome, но, похоже, Firefox не в состоянии обработать так много тестовых случаев.У меня высокий сервер конфигурации с 64 ГБ оперативной памяти.Я также заметил, что с 3 узлами потребление памяти никогда не выходит за пределы 70%
HUB
java -jar selenium-server-standalone-3.14.0.jar -role hub -browserTimeout 30 -timeout 90
Узел
java -Dwebdriver.gecko.driver=./geckodriver.exe -jar selenium-server-standalone-3.14.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=firefox, -port 7771
Code Snap-1
private WebDriver firefoxDriver() {
WebDriver driver;
driver = null;
try{
System.setProperty("webdriver.gecko.driver",Constants.sFirefoxDriverPath);
FirefoxOptions opt= new FirefoxOptions();
opt.setAcceptInsecureCerts(true);
opt.setCapability("marionette", true);
driver = new RemoteWebDriver(new URL(Constants.sHubUrl), opt);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}catch(Exception ex){
logger.error("Error in Firefox Driver --> " , ex);
driver.close();
}
return driver;
}
Code Snap -2
private WebDriver firefoxDriver() {
WebDriver driver;
driver = null;
try{
System.setProperty("webdriver.gecko.driver",Constants.sFirefoxDriverPath);
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette",true);
cap.setVersion("ANY");
cap.setAcceptInsecureCerts(true);
driver = new RemoteWebDriver(new URL(Constants.sHubUrl), cap);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}catch(Exception ex){
logger.error("Error in Firefox Driver --> " , ex);
driver.close();
}
return driver;
}
Сообщение об ошибке
org.openqa.selenium.WebDriverException: Session [4c40e39b-ac68-459a-ac33-f77d5f7d57f8] not available and is not among the last 1000 terminated sessions.
Active sessions are[ext. key 6ee03f37-a595-4d82-a0e3-2aed3ff42df5, ext. key 6db69284-3582-4c6a-950b-7ca4e0bbc059, ext. key 5d3d5a41-101e-4bfc-858a-b20ae0e916fb]
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'XXXXXX', ip: 'XXX.XX.XXX.XXX', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_192'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 63.0.1, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 14432, moz:profile: C:\Users\XXXX\AppData\Local\..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, platformVersion: 6.3, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: 4c40e39b-ac68-459a-ac33-f77...}
Session ID: 4c40e39b-ac68-459a-ac33-f77d5f7d57f8
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteTimeouts.implicitlyWait(RemoteWebDriver.java:776)
at com.HCF_AutomationFramework_Selenium.keyWords.kDrivers.firefoxDriver(kDrivers.java:134)
at com.HCF_AutomationFramework_Selenium.keyWords.kDrivers.kSelectDriver(kDrivers.java:42)
at com.Modules.EmailQuote.TestCases.EmailQuote.EmailQuote_Referer_CustomiseCover(EmailQuote.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods (TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)