I am getting error org.openqa.selenium.SessionNotCreatedException: once i execute the code
package SignUp;
import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.BeforeT
enter code hereest; import org.testng.annotations.Test;import io.appium.java_client.ios.IOSDriver;
public class SignUPBaseclass { public IOSDriver driver;
@BeforeTest public void SignUp1() throws Exception { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("appium-version", "1.0"); capabilities.setCapability("platformName", "iOS"); capabilities.setCapability("platformVersion", "9.3"); capabilities.setCapability("deviceName", "iPhone 5S Plus"); capabilities.setCapability("app", "/Users/sumit/Desktop/Project /FSFosh-1.ipa"); IOSDriver driver = new IOSDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);}@Test public void Flow(){ driver.findElement(By.name("JOIN US FREE!")).click(); //AppiumCapabilities App_Cap = new AppiumCapabilities(); //App_Cap.driver.findElement(By.name("JOIN US FREE!")).click();
} /*@AfterClass //public void tearDown() { AppiumCapabilities App_Cap = new AppiumCapabilities(); App_Cap.driver.quit(); }*/}
Error Message
[TestNG] Running:
/private/var/folders/6r/_2b4t0zj1tj95nkmxmj9c5n40000gp/T/testng-eclipse-2068198674/testng-customsuite.xmllog4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies). log4j:WARN Please initialize the log4j system properly. FAILED CONFIGURATION: @BeforeTest SignUp1 org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Requested a new session but one was in progress) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 469 milliseconds Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40' System info: host: 'Appster-Sumit-Nagar.local', ip: '172.16.17.71', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.3', java.version: '1.7.0_80' Driver info: io.appium.java_client.ios.IOSDriver 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:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:158) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:109) at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:23) at SignUp.SignUPBaseclass.SignUp1(SignUPBaseclass.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) at org.testng.TestRunner.beforeRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:616) at org.testng.SuiteRunner.runTest(SuiteRunner.java:359) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312) at org.testng.SuiteRunner.run(SuiteRunner.java:261) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215) at org.testng.TestNG.runSuitesLocally(TestNG.java:1140) at org.testng.TestNG.run(TestNG.java:1048) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:112) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:176)
SKIPPED: Flow
=============================================== 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
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 194 ms [TestNG] Time taken by org.testng.reporters.jq.Main@be71839: 322 ms [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@118e0f0f: 119 ms [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@1f80ce47: 21 ms [TestNG] Time taken by org.testng.reporters.XMLReporter@3f611531: 88 ms [TestNG] Time taken by org.testng.reporters.EmailableReporter2@582ed819: 8 msenter code here
-
Could you confirm that no other session is running when you try to run your test? Edit - Try restarting your Appium server, it is possible a previous session wasn't ended properly.Anand– Anand2016-05-19 10:52:42 +00:00Commented May 19, 2016 at 10:52
-
I have restarted my appium Server but no benefitsSumit– Sumit2016-05-19 14:01:25 +00:00Commented May 19, 2016 at 14:01
Add a comment
|
1 Answer
Issue has been resolved here , here i just created "RemoteWebDriver" object instead of IOSDriver ..
public class SignUPBaseclass extends Testbase {
public RemoteWebDriver driver;
@BeforeTest
public RemoteWebDriver SignUp1() throws Throwable {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.0");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion", "9.3");
capabilities.setCapability("deviceName", "iPhone 5S Plus");
capabilities.setCapability("app", "/Users/sumit/Desktop/Project /FSFosh-1.ipa");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
return driver;
}