Monday, July 18, 2005

When I enter text in a text field, or interact with something on a page, there is a JavaScript?

Wiki: FrequentQuestions: "Q. When I enter text in a text field, or interact with something on a page, there is a JavaScript? event that is triggered by mouse movements. How do I get Watir to trigger these events?

A. If the tag contains a JavaScript? call, you can use the 'fire_event' method to trigger it. ex. onchange=doThis() or onmouseup=clearForm()
To trigger a text field named 'my_field' with an onchange event we would do this with Watir:
ie.text_field(:name, 'my_field').fire_event('onchange')"
Post a Comment