This is my java code
package com.ej.zob.modules;
import org.openqa.selenium.By;
public class SetExchange {
public void Execute(String CountryName, String value)
{
LaunchApplication.driver.findElement(By.linkText("SET")).click();
LaunchApplication.driver.findElement(By.linkText("EXCHANGE RATE")).click();
//LaunchApplication.driver.findElement(By.id("new_Afghanistan_AFN")).sendKeys(value);
LaunchApplication.driver.findElement(By.xpath("//input[@maxlength='4']")).sendKeys(value);
LaunchApplication.driver.findElement(By.xpath("//input[@value='SET']")).click();
}
}
this is my html
<div style="display: table-cell;width:270px" name="cell">
<input id="new_Afghanistan_AFN" type="text" maxlength="4">
<input type="button" value="SET" onclick="setExchangeRate('Afghanistan','AFN')" name="save">
<div id="msg_Afghanistan_AFN"></div>
</div>
There are more than 100 textbox in my webpage and same number of button in front of textbox.I want to insert value in all the 100 textbox sequentially and similarly click on button.But from the above code I am able to insert the value in single text box and similarly click on single button. so my question is how to insert value into all text box and click on multiple button.Each text box is having different id but if I use findelement(By.id) then the code will be too much longer.