**********************现在已经知道怎么用tab键来定位文本框了******************************************** 现在已经知道怎么用tab键来定位文本框了 可输入内容又不行了 ie.send_keys('{TAB 70}') ie.send_keys("bbfghghghhghh") 是不是输入内容不能用这种格式写了 *********************Ruby/watir怎么捕获JS弹出窗口以取得警告信息的内容*********************************** 用AutoIT的实例,编写一个监听处理程序,参数为弹出的窗口的信息和要做的操作。 然后在每次触发事件前,通过新线程在操作系统级先启一个动监听程序的实例,等到窗口弹出后,监听处理程序自然就会获得窗口的控制权,并根据参数进行相应的操作。 关键在于,在获得弹出窗口的控制权后,需要窗口处于激活状态,使其可以接受鼠标键盘事件。 Autoit的以下3个方法可以解决问题: autoit.ControlGetHandle(title,texts,"") autoit.WinActivate(title,texts) autoit.Send("\{#{operation}\}") 调用新线程处理警告窗口倒已解决? 能不能教我啊? 下面有一段代码是线程解决弹出窗口的,但是我调用不通,你能改进,或者把你那个发给我么?谢谢 def check_for_popups autoit = WIN32OLE.new('AutoItX3.Control') # Do forever - assumes popups could occur anywhere/anytime in your application. loop do # Look for window with given title. Give up after 1 second. ret = autoit.WinWait("Microsoft Internet Explorer", '', 1) # # If window found, send appropriate keystroke (e.g. {enter}, {Y}, {N}). if (ret==1) then autoit.Send('{enter}') end # # Take a rest to avoid chewing up cycles and give another thread a go. # Then resume the loop. sleep(3) end end $popup = Thread.new { check_for_popups } # start popup handler at_exit { Thread.kill($popup) } ************************执行语句有错误,继续往后执行,******************************************************** 我发现在用watir做测试的时候,发现一个error以后,脚本就会自动退出来了,有没有办法避免?像QTP那样的,报个错,但是会继续执行? 解决 begin do rescue => error end ***************************************Watir 怎么访问