Вы можете попробовать реализовать статический метод для получения имени пользователя / пароля (это просто pseudo code
)
public class CredentialHelper {
private static int counter = 0;
private static List<MyGmailCredential> myGmailCredentials = [5 credentials];
public static synchronized MyGmailCredential getCredential() {
MyGmailCredential currentCred = CredentialHelper.myGmailCredentials[counter%5];
CredentialHelper.counter++;
return currenCred;
}
}
Используйте в своем классе
public class Login {
public WebDriver driver ;
@Test(invocationCount = 20, threadPoolSize = 5)
public void GmailLogin() throws InterruptedException {
WebDriver driver = LoadTest.getInstance().getDriver();
driver.get("https://tst-oec-ebooking.azurewebsites.net/");
MyGmailCredential myGmailCredential = CredentialHelper.getCredential();
driver.findElement(By.xpath("//html/body/div/div/div[2]/div/form/div/input")).sendKeys(myGmailCredential.getUserName());
driver.manage().timeouts().implicitlyWait(6000, TimeUnit.SECONDS);
driver.findElement(By.xpath("//*[@id=\"Password\"]")).sendKeys(myGmailCredential.getPassword());
driver.findElement(By.xpath("//*[@id=\"login_submit\"]")).click();
Thread.sleep(1500);
driver.manage().timeouts().implicitlyWait(5000, TimeUnit.SECONDS);
}
@BeforeMethod
public void setup(){
System.setProperty("webdriver.gecko.driver", "D:\\CIPL0564\\D Drive\\Software\\geckodriver-v0.20.1-win64\\geckodriver.exe");
}
@AfterMethod
public void tearDown(){
LoadTest.getInstance().removeDriver();
}
}