如何用watir定位定位到javascript里面的元素

下面是一段html里面的js代码

[code="html"]<br> document.write(&quot;<label>密 码:&quot;);<br> document.write(&quot;</label>&quot;);<br> document.write(&#39;<input name="TPL_password" id="TPL_password" type="password" maxlength="20" size="32" tabindex="2"/>;<br>
[/code]

请问如何使用watir操作html里面的javascript呢,如何定位到里面的 ?

该问题源于用watir 模拟登陆 淘宝。 在模拟输入密码时出错。

require 'rubygems'
require 'watir'

ie = Watir::IE.start("http://mail.163.com")
ie.text_field(:name, "username").clear
ie.text_field(:name, "username").set("你的用户")
ie.text_field(:name, "password").clear
ie.text_field(:name, "password").set("你的密码")
ie.button(:name, "登录邮箱").click

还是不懂的话参看下面
http://blog.csdn.net/zhuzhao/archive/2007/11/10/1877721.aspx

//感觉用watir不如直接win32ole,watir效果有点慢。。