tags:

views:

345

answers:

2

I have an HTML-based data entry form that submits data to a server. Before submission, the form's row labeled 'RecordNumber' should be blank; after submission (to a server loaded with test data) that row should display the value '1'.

How can I use Selenium to verify this outcome? I have figured out how record the steps with Selenium, but can't figure out the verification bit.

Thank you.

+1  A: 

For Selenium IDE it would be something like

<tr>
    <td>verifyValue</td>
    <td>RecordNumber</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>submitButton</td>
    <td></td>
</tr>
<tr>
    <td>waitForValue</td>
    <td>RecordNumber</td>
    <td>1</td>
</tr>

and then for Selenium RC using Java that would be

    verifyEquals("", selenium.getValue("RecordNumber"));
    selenium.click("submitButton");
    for (int second = 0;; second++) {
        if (second >= 60) fail("timeout");
        try { if ("1".equals(selenium.getValue("RecordNumber"))) break; } catch (Exception e) {}
        Thread.sleep(1000);
    }
AutomatedTester
Thank you, but maybe I wrote the question badly. How do I do this while recording my actions? I enter the data in the form, but when I click 'verifyValue' in the Selenium IDE window I don't see any path (either before or after clicking "submit") to designating the row or the value.
chernevik
I think I figured it out: I recorded a test, used the right click button to add a 'verifyText' step, edited that to focus on the desired row and give it a value, and saved. Then I hand-edited the case to change 'verifyText' to 'waitForValue'. This seems to work. I'll try it again using Python, which I find a little more familiar. Thanks.
chernevik
A: 

You can use the TestPlan frontend to selenium in which case the code looks something like this:

Checkpoint eqString %Codes:EMPTYSTR% (getFormParam id:myForm RecordValue) 
SubmitForm with
  %Form% id:myForm
  %Params% with
    ...
  end
end
Checkpoint eqString 1 (getFormParam id:myForm RecordValue) 

That's assuming you have forms. If you have just have data in static tables the Check syntax is easier.

Check //td[@id='RecordValue'][text()='1']
edA-qa mort-ora-y