We could go in at a lower level too, if you wanted. My synthesizing mouse events. But maybe what you have is enough for now.

On 2007-07-09, at 12:47 EDT, Frisco Del Rosario wrote:

  I said:

<button text="click" id="me" onclick="doSomething"/>

Rather than click the button, can I send the button an onclick event
through the debugger input field?

To which P T Withington replied:

me.onclick.sendEvent(me);

This means we can test the results of a buttonclick in Selenium. For
instance:

<canvas debug="true">
     <edittext id="myEdittext" width="300" x="20" y="20"
text="cartman"/>
     <button id="me" text="click" x="20" y="50"
onclick="myEdittext.setAttribute('text', 'kyle')"/>
</canvas>

To test the 'me' button -- does its click change 'cartman' to 'kyle' in
the edittext field? -- we have the Selenese script:

<tr>
        <td>type</td>
        <td>LaszloDebuggerInput</td>
        <td>myEdittext.text=='cartman'</td>
</tr>
<tr>
        <td>click</td>
        <td>//[EMAIL PROTECTED]'eval']</td>
        <td></td>
</tr>
<tr>
        <td>assertTextPresent</td> // does myEdittext.text == cartman?
        <td>true</td>
        <td></td>
</tr>
<tr>
        <td>click</td>
        <td>//[EMAIL PROTECTED]'clear']</td>
        <td></td>
</tr>
<tr>
        <td>type</td>
        <td>LaszloDebuggerInput</td>
<td>me.onclick.sendEvent(me)</td> // change myEdittext.text to kyle with the button
</tr>
<tr>
        <td>click</td>
        <td>//[EMAIL PROTECTED]'eval']</td>
        <td></td>
</tr>
<tr>
        <td>type</td>
        <td>LaszloDebuggerInput</td>
<td>myEdittext.text=='kyle'</td> // now test for whether myEdittext.text changed to kyle
</tr>
<tr>
        <td>click</td>
        <td>//[EMAIL PROTECTED]'eval']</td>
        <td></td>
</tr>
<tr>
        <td>assertTextPresent</td> // success!
        <td>true</td>
        <td></td>
</tr>





--
assertEquals(Frisco Del Rosario, OpenLaszlo tester)

Reply via email to