1
How to loop to scan an array and bring its data one by one and fill in the input?
The picture illustrates well the problem... I need For to pass several times through the method and take the data from there and fill in the input and follow the normal flow of automation.
Get popular input with method data:
driver.findElement(By.xpath("/html/body/center/table/tbody/tr[2]/td[2]/form/table[3]/tbody/tr[17]/td/input[1]")).sendKeys(offers());
I click to filter the data for it to popular the TextArea
:
driver.findElement(By.xpath("/html/body/center/table/tbody/tr[2]/td[2]/form/table[3]/tbody/tr[17]/td/input[2]")).click();
I select the data populated in textArea
:
Select selecionapermanenciamulta = new Select(driver.findElement(By.xpath("/html/body/center/table/tbody/tr[2]/td[2]/form/table[3]/tbody/tr[19]/td/table/tbody/tr/td[1]/select")));
selecionapermanenciamulta.selectByIndex(0);
I click the arrow to take him to the other side:
driver.findElement(By.xpath("/html/body/center/table/tbody/tr[2]/td[2]/form/table[3]/tbody/tr[19]/td/table/tbody/tr/td[2]/input[1]")).click();
Vector with the data:
public static String offers (){
List<String> offrers = new ArrayList<String>();
offrers.add ( "dados");
offrers.add ( "dados");
offrers.add ( "dados" );
Collections.shuffle ( offrers );
return offrers.get(0);
}
I didn’t quite understand your doubt, but it’s making a
for
to repeat these steps that you have placed?– Felipe Avelar
@Felipeavelar how do I do this for? I’m having this difficulty, I’m new in programming.
– Paulo Roberto
About which vector you want to iterate?
– Felipe Avelar
@Felipeavelar yes Elipe, the data are in offers(), I will edit the question and put it there.
– Paulo Roberto