watir调用js

require 'watir'
ie = Watir::IE.new
ie.goto(" http://www.google.cn")
ie.document.parentWindow.execScript("alert(\"测试调用Javascript!\");")

or

ie.document.getElementById('txtUsername').readOnly = true

 

or

 

js = %{ie.document.getElementById('txtUsername').readOnly=true}

ie.document.parentWindow.execScript(js)

posted on 2011-03-23 16:51  张飞_  阅读(578)  评论(0编辑  收藏  举报

导航