// Sign in and go to addresses
WebResponse resp = Util.navToAddresses();
// Get the newly added address
WebTable table = resp.getTableWithID("address_TestAddress");
assertNotNull(table);
TableCell cell = table.getTableCell(0, 0);
assertNotNull(cell);
// Edit the address by clicking the edit link
resp = cell.getLinkWith(Util.getBundle("view", "buttonEdit")).click(); // "Edit"
// Enter the new data in the form
WebForm form = resp.getForms()[1];
// Make sure this is the right form
assertEquals(form.getParameterValue("{actionForm.name}"), "TestAddress");
// Set the new values
form.setParameter( "{actionForm.name}", "EditedTestAddress" );
form.setParameter( "{actionForm.addr1}", "543 Main Street" );
form.setParameter( "{actionForm.addr2}", "Unit 345" );
form.setParameter( "{actionForm.city}", "Portland" );
form.setParameter( "{actionForm.state}", "OR" );
form.setParameter( "{actionForm.zip}", "98799" );
form.setParameter( "{actionForm.country}", "USA2" );
form.setParameter( "{actionForm.phone}", "208-222-3456" );
// Submit
resp = form.submit();
// Make sure the address took
table = resp.getTableWithID("address_EditedTestAddress");
assertNotNull(table);
cell = table.getTableCell(0, 0);
assertNotNull(cell);
assertTrue(cell.getText().contains("EditedTestAddress"));
assertTrue(cell.getText().contains("543 Main Street"));
assertTrue(cell.getText().contains("Unit 345"));
assertTrue(cell.getText().contains("Portland"));