# How to handle javascript with watir

**URL:** <https://www.ruby-forum.com/t/how-to-handle-javascript-with-watir/168331>\
**Category:** Rails\
**Created:** [May 19, 2009, 5:50pm UTC](https://www.ruby-forum.com/t/how-to-handle-javascript-with-watir/168331 "2009-05-19T17:50:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@lucas](https://www.ruby-forum.com/u/lucas)\
**Post date:** [May 19, 2009, 5:50pm UTC](https://www.ruby-forum.com/t/how-to-handle-javascript-with-watir/168331/1 "2009-05-19T17:50:04Z")

</div>

html code:

my question:

```
how to locate the password field with watir?
```

---

<div class="post-metadata">

**Author:** ![lucas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@lucas](https://www.ruby-forum.com/u/lucas)\
**Post date:** [May 19, 2009, 6:10pm UTC](https://www.ruby-forum.com/t/how-to-handle-javascript-with-watir/168331/2 "2009-05-19T18:10:44Z")

</div>

Lucas wrote:

> html code:

Someone warned me yesterday that the language=“javascript” part is  
deprecated and should no longer be used. So I thot I’d pass that on.

But sorry, I’ve never used watir. A shot in the dark would be to say  
that 90% of this kind of thing involves the id=

---

<div class="post-metadata">

**Author:** ![lucas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba8739/32.png) [@lucas](https://www.ruby-forum.com/u/lucas)\
**Post date:** [May 20, 2009, 12:58pm UTC](https://www.ruby-forum.com/t/how-to-handle-javascript-with-watir/168331/3 "2009-05-20T12:58:14Z")

</div>

This should work:

browser.text\_field(:id, “TPL\_password”).set “not-the-real-one”

By the way, you will get more answers at  
[http://groups.google.com/group/watir-general/](http://groups.google.com/group/watir-general/)

Å½eljko
