appium / appium/java-client

Unable to run the test parallelly on 2 devices through testng (appium java) > code runs individually << failed due to unable to locate the element

Open
#1,761 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

testng XML :

Test :
package tests;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

//import Practice.BluesecureTC.Base1;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import pages.GetVerificationCodePage;
import pages.InviteUserPage;
import pages.OTPVerificationPage;
import pages.SplashPage;
import utils.Base;
import utils.Base2;

public class Muti_LoginTC2 extends Base2{

@BeforeTest()
public void killAllnodes() throws IOException, InterruptedException {  
	Runtime.getRuntime().exec("taskkill /F /IM node.exe");
	Thread.sleep(3000);
}

// @AfterTest
// public void stop()
// {
// stop_service();
// }
//

@Test 
public void login1() throws IOException, InterruptedException
{
	
	
	AndroidDriver<AndroidElement> driver1 = startServer("8244","Bluesecure","RZ8R915W2KW");
	driver1.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	System.out.println("Thread one is" +Thread.currentThread().getId());
	
	SplashPage s1=new SplashPage(driver1);
	
	GetVerificationCodePage verify = new GetVerificationCodePage(driver1);
	OTPVerificationPage otp = new OTPVerificationPage(driver1);
	
	s1.naviagte();

// String expected="android.widget.ScrollView";
// String actual =

	verify.allow_permissions();
	verify.login("8755875532");
	otp.verifyOtp();
	
}

@Test
public void login2() throws IOException, InterruptedException
{
	AndroidDriver<AndroidElement> driver2 = startServer("8241","Bluesecure","HA4L6TGQGET4CMDI");
	//AndroidDriver<AndroidElement> driver = capabilities("Bluesecure");
	driver2.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	System.out.println("Thread two  is" +Thread.currentThread().getId());
	
	SplashPage s2=new SplashPage(driver2);
	
	
	GetVerificationCodePage verify2 = new GetVerificationCodePage(driver2);
	OTPVerificationPage otp2 = new OTPVerificationPage(driver2);
	
	s2.naviagte();

// String expected="android.widget.ScrollView";
// String actual =

	verify2.allow_permissions();
	verify2.login("9544696100");
	otp2.verifyOtp();

//
}

// @Test
// public void login3() throws IOException, InterruptedException
// {
// AndroidDriver driver = startServer("8997","Bluesecure","RZ8R915W2KW");
// //AndroidDriver driver = capabilities("Bluesecure");
// driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//
//
// SplashPage s1=new SplashPage(driver);
//
// GetVerificationCodePage verify = new GetVerificationCodePage(driver);
// OTPVerificationPage otp = new OTPVerificationPage(driver);
//
// s1.naviagte();
//// String expected="android.widget.ScrollView";
//// String actual =
//
// verify.allow_permissions();
// verify.login("9544696100");
// otp.verifyOtp();
////
// }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TestNG XML and tests.Muti_LoginTC2, then inspect Base2.startServer and the SplashPage, GetVerificationCodePage, and OTPVerificationPage entry points. Reproduce login1 and login2 in parallel on the two listed devices and capture the failing element lookup; done means both flows locate their elements and complete without interference.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.