Not sure how strXPath = "//div[@id='"+strGridId+"']/table/tbody/tr[2]/td/div/div/table."+(nRowIndex + 1)+"."+(nCellIndex)
will retrieve cell. Add some HTML or
You can following method, this will update the cell value
public String updateCell(By identifier, int romNumber, int columnNumber, String value)
{
WebElement table = driver.findElement(identifier);
List<WebElement> rows = table.findElements(By.xpath("tbody/tr"));
List<WebElement> cells = rows.get(romNumber).findElements(By.tagName("td"));
WebElement desiredCell = cells.get(columnNumber);
desiredCell.setText(value);
}
EDIT :
By Looking at your imports com.thoughtworks.selenium.
I can say that you are using Selenium RC. My solution is webdriver based