Я работаю над селеном Chrome WebDriver и хочу передать ArrayList в функцию и использовать его для параллельного выполнения и различных сеансов. Например, SupportItems
класс содержит ArrayList прокси, и я хочу использовать каждый прокси в одном сеансе.
Это мой код:
public class ParallelExecution {
public static final int invocationCount = 5;
private static final String driverPath = ".\\drivers\\";
@Test(threadPoolSize = invocationCount, invocationCount = invocationCount)
public static void parallelExecution(ArrayList<SupportItems> items) throws InterruptedException {
GetExternalInfos getInfos = new GetExternalInfos();
items = new ArrayList<SupportItems>(getInfos.getInputs());
WebDriver chromeDriver = null;
ChromeOptions chromeOptions = null;
chromeOptions= new ChromeOptions();
// Set the pre defined capability – ACCEPT_SSL_CERTS value to true
chromeOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
chromeOptions.addArguments("start-maximized");
// Disable Automation Extention
chromeOptions.setExperimentalOption("useAutomationExtension", false);
chromeOptions.setExperimentalOption("excludeSwitches",Collections.singletonList("enable-automation"));
System.setProperty("webdriver.chrome.driver", driverPath + "chromedriver.exe");
chromeDriver = new ChromeDriver(chromeOptions);
chromeDriver.get("https://www.google.com");
}
}
И это мой testNG.xmlфайл
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods" thread-count="5">
<test name="SupportTest" >
<classes>
<class name="windowbuilder.view.ParallelExecution"/>
</classes>
</test> <!-- SupportTest -->
</suite> <!-- Suite -->