Java, Selenium, Selenium grid, Testing, TestNG, Web Automation

FAILED CONFIGURATION: @BeforeMethod setUp org.openqa.selenium. WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities


[TestNG] Running:
C:\Users\user\AppData\Local\Temp\testng-eclipse-2068414740\testng-customsuite.xml

FAILED CONFIGURATION: @BeforeMethod setUp
org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}]
Command duration or timeout: 200 milliseconds
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:17:32'
System info: host: 'ksehgal', ip: '192.168.0.162', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)


SKIPPED CONFIGURATION: @AfterMethod tearDown
SKIPPED: windowsTest

===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================

[TestNG] Time taken by org.testng.reporters.XMLReporter@6beb8639: 16 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 6 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@1a0c3b27: 44 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@21d195ca: 4 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@390f8c82: 23 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@6ba52c90: 7 ms

How I encountered this error

  • Step1 Start selenium grid hub
 java -jar selenium-server-standalone-2.41.0.jar -role hub

  • Step2 Start executing test scripts.
  • Step3 You will get the above error.

Solution

  • You does not have any node in the selenium grid whole set up.
  • Start command prompt from your local or some machine and execute this command
 java -jar selenium-server-standalone-2.41.0.jar -role node -hub http://<hub-ip>:<hub-port>/grid/register

  • Now run your tests again.
  • They should run fine.

Conclusion

  1. To run your test scripts on a selenium grid network, you require minimum 1 hub and 1 node. So as to run your test scripts.
  2. Hub is responsible to take care of navigating your test scripts to the desired environment combination. And node will actually run your test scripts.
Advertisements

6 thoughts on “FAILED CONFIGURATION: @BeforeMethod setUp org.openqa.selenium. WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities”

  1. I am very new to automation testing :

    package com.test;

    import org.testng.annotations.BeforeMethod;
    import org.testng.annotations.Test;

    import java.io.File;

    import io.appium.java_client.android.AndroidDriver;

    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.concurrent.TimeUnit;

    //import org.apache.commons.exec.CommandLine;
    //import org.apache.commons.exec.DefaultExecuteResultHandler;
    //import org.apache.commons.exec.DefaultExecutor;
    //import org.apache.commons.exec.ExecuteException;
    //import org.openqa.selenium.By;
    import org.openqa.selenium.remote.DesiredCapabilities;
    //import org.openqa.selenium.remote.RemoteWebDriver;
    //import org.testng.annotations.AfterMethod;
    import org.testng.annotations.BeforeMethod;
    //import org.testng.annotations.Test;
    //import org.openqa.selenium.WebDriver;

    public class AppiumTest {

    private AndroidDriver driver;

    //public class SetupAndroidAppium{

    //static DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
    // static DefaultExecutor executor = new DefaultExecutor();
    @BeforeMethod
    public void setUp() throws MalformedURLException {
    File classpathRoot = new File(System.getProperty(“user,dir “));

    File appDir = new File(classpathRoot, “Application”);

    File app = new File(appDir,”WestJet-qa-debug-unaligned__28_.apk”);

    DesiredCapabilities capabilities = new DesiredCapabilities();

    capabilities.setCapability(“platformName”,”Android”);

    capabilities.setCapability(“app”,app.getAbsoluteFile());

    capabilities.setCapability(“app-package”,”com.*****”);
    capabilities.setCapability(“platformVersion”,”5.1″);
    capabilities.setCapability(“deviceName”,”Nexus_5″);
    driver = new AndroidDriver(new URL(“0.0.0.0:4723”),capabilities);
    driver.close();
    }
    @Test
    public void launchEmulator() throws Exception{
    }
    //}
    }

    When I try to run this I get above Error message but I could not follow you in above example ?

    Please can you help me understand this ?

    Like

    1. HI Jig,
      As far as I understood you are trying to create an android test file in java, but I am doing it for selenium only, not for Appium. May be an updation of latest version in your jars might help.

      Like

  2. Hi,
    I am using TestNG in eclipse. I am getting below error.
    [RemoteTestNG] detected TestNG version 6.14.2
    FAILED CONFIGURATION: @BeforeMethod beforeMethod
    java.lang.ClassCastException: autosar40.util.Autosar40Factory cannot be cast to org.eclipse.emf.ecore.resource.Resource$Factory
    at org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl.convert(ResourceFactoryRegistryImpl.java:93)
    at org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl.getFactory(ResourceFactoryRegistryImpl.java:85)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:431)
    at org.eclipse.sphinx.emf.resource.ExtendedResourceSetImpl.demandCreateResource(ExtendedResourceSetImpl.java:291)
    at org.eclipse.sphinx.emf.resource.ExtendedResourceSetImpl.getResource(ExtendedResourceSetImpl.java:264)
    at firsttestngproject.FirstTestNGFile.beforeMethod(FirstTestNGFile.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:455)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:520)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:648)
    at org.testng.TestRunner.run(TestRunner.java:505)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
    at org.testng.TestNG.runSuites(TestNG.java:1049)
    at org.testng.TestNG.run(TestNG.java:1017)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

    SKIPPED: f
    java.lang.ClassCastException: autosar40.util.Autosar40Factory cannot be cast to org.eclipse.emf.ecore.resource.Resource$Factory
    at org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl.convert(ResourceFactoryRegistryImpl.java:93)
    at org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl.getFactory(ResourceFactoryRegistryImpl.java:85)
    at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:431)
    at org.eclipse.sphinx.emf.resource.ExtendedResourceSetImpl.demandCreateResource(ExtendedResourceSetImpl.java:291)
    at org.eclipse.sphinx.emf.resource.ExtendedResourceSetImpl.getResource(ExtendedResourceSetImpl.java:264)
    at firsttestngproject.FirstTestNGFile.beforeMethod(FirstTestNGFile.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:455)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:520)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:648)
    at org.testng.TestRunner.run(TestRunner.java:505)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
    at org.testng.TestNG.runSuites(TestNG.java:1049)
    at org.testng.TestNG.run(TestNG.java:1017)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

    ===============================================
    Default test
    Tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 0
    ===============================================

    ===============================================
    Default suite
    Total tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 0
    ===============================================

    Please find my code,
    var static EcucModuleConfigurationValues moduleConfigurationval = null
    @BeforeMethod def void beforeMethod() {
    var List ecuValueCollectionRefList = null;
    val resourceSet = new AutosarResourceSetImpl();
    var Resource resource
    val options = resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap();
    options.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new Autosar40Factory());
    val folderPath = “D:\\6_Tools”
    val file = new File(folderPath)
    val bswEcuDescriptionFilePath = file.listFiles

    for (bswEcuDescriptionFile : bswEcuDescriptionFilePath) {
    /* Load all the input files in the resource set */
    val uri = URI.createFileURI(bswEcuDescriptionFile.path);
    resource = resourceSet.getResource(uri, true);
    resourceSet.resources.add(resource);
    }
    ecuValueCollectionRefList = resourceSet.resources.map [it.contents.get(0).eAllContents.toList.filter[it instanceof EcucValueCollection].
    map [it as EcucValueCollection].toList].flatten.toList.map[ecucValues].flatten.toList
    val ecucModuleConfiguration = ecuValueCollectionRefList.filter[ecucModuleConfigurationValues !== null ].map[ecucModuleConfigurationValues].toList
    moduleConfigurationval = ecucModuleConfiguration.filter[shortName == “Com0”].get(0)

    I am reading input files from the folder.

    Please can any one help me to resolve this.
    }

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s