Getting Null Pointer exception while ini

Hi All,
Anyone have faced issues in running multiple TC through testng with multiple methods with single class or and multiple class…

Actually if there are 2 methods in the same class, it run only 1 method and get stuck with error says
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)

I think you are trying to start another Appium session during running another one.

Can you double check in @BeforeTest, @BeforeMethod in you test script. And are you running in parallel or continuous?

Hi TyHuynh…
Thank you for your replay… that issue got resolved now… Do you have any idea how to run multiple Test cases in appium through testng… Iam getting session handling error while switching to another test class. Appreciate for your answer


You will need to look at creating a SeleniumGrid (with appium server nodes) to be able to handle parallel execution. There are also a lot of threads currently on the board discussion parallel test execution, but basically you need a different appium server instance to handle each test request. The Selenium Hub of the Selenium grid will handle the test execution request from TestNG and send them to the first open node.

Thanks Cauthon… Let me try it out

Happy when hearing you could continuing.


Iam not able to keep swiping in the spinner list in order to select the element which located at last in the list…iam using swipeUP method which swipe with first specified element as seen in the below code…
public boolean swipeUP() throws InterruptedException

	MobileElement elm = (MobileElement)driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@resource-id,'android:id/text1') and @index = '8']"));
	elm.swipe(SwipeElementDirection.UP, 6000);
	MobileElement elm1 = (MobileElement)driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@resource-id,'android:id/text1') and @index = '9']"));
	MobileElement elm2 = (MobileElement)driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@resource-id,'android:id/text1') and @index = '8']"));
	MobileElement elm3 = (MobileElement)driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@resource-id,'android:id/text1') and @index = '7']"));
	return true;

but its not swiping from second element defined with in same method above… not sure how i wrong here if it is… would be great if you suggest a solution to fix the same…
Thank you