<suite name="RegSmokeAutomation" verbose="1">
<test name="SmokeAutomation" preserve-order="true">
<class name="com.optumhealth.ehp.reg.Test1" />
<class name="com.optumhealth.ehp.reg.Test2" />
</classes>
</test>
</suite>
org.openqa.selenium.WebDriverException: 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: 15 milliseconds
Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:09:00'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.2', java.version: '1.6.0_65'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:175)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:459)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:140)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:95)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:103)
at com.optumhealth.ehp.reg.Test2.setUp(Test2.java:43)
... Removed 30 stack frames
If i am override the existing session (Appium> Preferneces> Override existing session)then i am getting below exception -
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: Cleaning up appium session
info: Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:351:31)
at null.<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:294:12)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:797:12)
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
POST /wd/hub/session 500 37911ms - 210b
package com.optumhealth.ehp.reg;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
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 com.optumhealth.ehp.util.UIConstants;
public class Test1 implements UIConstants {
private static final String JavascriptExecutor = null;
public WebDriver wd = null;
@BeforeMethod
public void setUp() throws Exception {
// set up appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
capabilities.setCapability(CapabilityType.VERSION, "6.1");
capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
capabilities.setCapability("device", "iPhone Retina (4-inch 64-bit)");
capabilities.setCapability("app", "/Users/jitendrakumar/Desktop/Helath4MeApp_Prd/ConsumerTransparency.app");
wd = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@AfterMethod
public void tearDown() throws Exception {
}
@Test
public void testSecond() throws InterruptedException {
wd.findElement(By.xpath("//window[3]/alert[1]/tableview[1]/cell[1]")).click();
wd.findElement(By.xpath("//window[1]/scrollview[1]/button[2]")).click();
wd.findElement(By.name("Back")).click();
}
}
Script 2
package com.optumhealth.ehp.reg;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
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 com.optumhealth.ehp.util.UIConstants;
public class Test2 implements UIConstants {
private static final String JavascriptExecutor = null;
public WebDriver wd = null;
@BeforeMethod
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
capabilities.setCapability(CapabilityType.VERSION, "6.1");
capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
capabilities.setCapability("device", "iPhone Retina (4-inch 64-bit)");
capabilities.setCapability("app", "/Users/jitendrakumar/Desktop/Helath4MeApp_Prd/ConsumerTransparency.app");
wd = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@AfterMethod
public void tearDown() throws Exception {
}
//Guest
@Test
public void testHome() throws InterruptedException {
wd.findElement(By.xpath("//window[1]/scrollview[1]/button[5]")).click();
//wd.findElement(By.name("Skip Login")).click();
wd.findElement(By.xpath("//window[1]/button[2]")).click();
}
}
Suite.XMl
<?xml version="1.0" encoding="UTF-8"?>
<suite name="RegSmokeAutomation" verbose="1">
<test name="SmokeAutomation" preserve-order="true">
<classes>
<class name="com.optumhealth.ehp.reg.Test1" />
<class name="com.optumhealth.ehp.reg.Test2" />
</classes>
</test>
</suite>
Script1 -
...</blockquote
FAILED CONFIGURATION: @BeforeMethod setUp
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:09:00'
6)This time i have not started the server manual... if i am starting the server with launch button again then Test2 is also passed.
7) I have not changed the port coz appium is running on 0.0.0.0 and on 127.0.0..0 i am getting startup issue
Please let me know where i am doing mistake.
Thanks,
Jitendra
Thanks,
Script1 -
...<p
Thanks,
Script1 -
...<p style="line-height:normal;font-family:Courier;margin-bottom:0px"
Thanks,
Script1 -
...<p
debug: Appium request initiated at /wd/hub/session
warn: [DEPRECATED] The device capability has been deprecated and will be removed. Please use the platformName capability instead.
info: [INSTSERVER] Instruments exited with code 255
info: Attempting to retry launching instruments, this is retry #3
info: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 6.1
info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iPhone Retina (4-inch) - Simulator - iOS 6.1 /Users/jitendrakumar/Desktop/Helath4MeApp_Prd/ConsumerTransparency.app -e UIASCRIPT /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments
info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}
info: And launch timeout: 90000ms
debug: Appium request initiated at /wd/hub/status
info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.17.6","revision":"7b32947e166a4338047f31ac14457c2b0eb432aa"}},"sessionId":"4c0bb729-671e-4637-877a-2e8c5ba08c4c"}
debug: Request received with params: {}
GET /wd/hub/status 200 1ms - 199b
debug: Appium request initiated at /wd/hub/status
info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.17.6","revision":"7b32947e166a4338047f31ac14457c2b0eb432aa"}},"sessionId":"4c0bb729-671e-4637-877a-2e8c5ba08c4c"}
debug: Request received with params: {}
GET /wd/hub/status 200 1ms - 199b
info: [INST STDERR] Instruments Usage Error : Unknown hardware device specified: iPhone Retina (4-inch) - Simulator - iOS 6.1
info: [INST] Known Devices:
info: [INST] Jitendra Kumar’s MacBook Pro (com.apple.instruments.devices.local)
iPhone - Simulator - iOS 7.1
iPhone Retina (3.5-inch) - Simulator - iOS 7.1
iPhone Retina (4-inch) - Simulator - iOS 7.1
iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1
iPad - Simulator - iOS 7.1
iPad Retina - Simulator - iOS 7.1
iPad Retina (64-bit) - Simulator - iOS 7.1
error: Instruments crashed on startup
info: [INSTSERVER] Instruments exited with code 255
info: Killall instruments
info: Stopping iOS log capture
info: Killing the simulator process
debug: Sending command to instruments: au.bundleId()
info: Instruments launched. Starting poll loop for new commands.
info: Pushing command to appium work queue: "au.bundleId()"
info: Killing any other simulator daemons
info: Cleaning app state.
info: No folders found to remove
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: Cleaning up appium session
info: Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:351:31)
at null.<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:294:12)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:797:12)
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
POST /wd/hub/session 500 38034ms - 210b
debug: Appium request initiated at /wd/hub/status
info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.17.6","revision":"7b32947e166a4338047f31ac14457c2b0eb432aa"}}}
debug: Request received with params: {}
GET /wd/hub/status 200 1ms - 144b
debug: Appium request initiated at /wd/hub/status
info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.17.6","revision":"7b32947e166a4338047f31ac14457c2b0eb432aa"}}}
debug: Request received with params: {}
GET /wd/hub/status 200 1ms - 144b
...
Hi,
This is my testNG.xml file and i have totally 3 test cases in these two class files and i was able to run all test cases.
<?xml version="1.0" encoding="UTF-8"?>
<suite name="Testing" verbose="1">
<test name="Tetsing two Test case">
<classes>
<class name="com.test.testcripts.TestCase1" />
<class name="com.test.testcripts.TestCase2"/>
</classes>
</test>
</suite>
By looking at your XML file i can see u missed <classes> tag.
in @AfterMethod :
try to use driver.quit();
OutPut:
===============================================
Testing
Total tests run: 3, Failures: 0, Skips: 0
===============================================
Thanks,
Jeevan
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: Cleaning up appium session
info: Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:351:31)
at null.<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:294:12)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:797:12)
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
POST /wd/hub/session 500 38034ms - 210b
info: [INSTSERVER] Instruments exited with code 255
info: Attempting to retry launching instruments, this is retry #2
info: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 6.1
info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iPhone Retina (4-inch) - Simulator - iOS 6.1 /Users/jitendrakumar/Desktop/Helath4MeApp_Prd/ConsumerTransparency.app -e UIASCRIPT /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments
info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}
info: And launch timeout: 90000ms
wd.quit();
}
@Test
public void testSecond() throws InterruptedException {
wd.findElement(By.xpath("//window[3]/alert[1]/tableview[1]/cell[1]")).click();
wd.findElement(By.xpath("//window[1]/scrollview[1]/button[2]")).click();
wd.findElement(By.name("Back")).click();
}
}
//Optput of SOP
inside testSecond
Finish testSecond
inside testFirst
Finish testFirst
Finish After Method
public class Test_Mac_Skip_Login_iPhone_Multiple implements UIConstants {
public WebDriver wd = null;
@BeforeTest
public void setUp() throws Exception {
// set up appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
capabilities.setCapability(CapabilityType.VERSION, "6.1");
capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
capabilities.setCapability("device", "iPhone Retina (4-inch 64-bit)");
capabilities.setCapability("app", "/Users/jitendrakumar/Desktop/Helath4MeApp_Prd/ConsumerTransparency.app");
wd = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@BeforeMethod
@Test
public void testSecond() throws InterruptedException {
System.out.println("inside testSecond");
wd.findElement(By.xpath("//window[3]/alert[1]/tableview[1]/cell[1]")).click();
wd.findElement(By.xpath("//window[1]/scrollview[1]/button[5]")).click();
wd.findElement(By.xpath("//window[1]/button[2]")).click();
System.out.println("Finish testSecond");
Thread.sleep(10000);
}
@Test
public void testFirst() throws InterruptedException {
System.out.println("inside testFirst");
wd.findElement(By.xpath("//window[1]/scrollview[1]/button[2]")).click();
wd.findElement(By.name("Back")).click();
System.out.println("Finish testFirst");
Thread.sleep(10000);
}
@AfterMethod
public void finish(){
System.out.println("Finish After Method");
}
@AfterTest
public void tearDown() throws Exception {
System.out.println("inside tear down");
wd.close();
//wd.quit();
...System info: <a href="http://os.name" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fos.name\46sa\75D\46sntz\0751\46usg\75AFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fos.name\46sa\75D\46sntz\0751\46usg\75AFQjCNEBq5pahnbxzpNVLfaFe