selenium-webdriver之IEDriver issue
上一篇 /
下一篇 2012-04-24 17:16:39
环境:win7 64位,ruby1.9.3p194 IE8
代码如下:
#点击返回查看贷款按钮后当前窗口关闭,需要重新switch到主主窗口
#@browser.execute_script('redirct()')
@browser.find_element(:xpath => "//input[@value='返回查看贷款']").click
sleep 2
a = @browser.switch_to.alert
puts a.text
a.accept
hs = @browser.window_handles
@browser.switch_to.window(hs)
在FF10.0下正常,但是执行js的时候,没有confirmation 弹出窗口,直接关闭当前页面。可以switch到原来的主窗口继续操作。
在IE8下,如果执行js,有confirmation 弹出窗口,自动点不掉,手动点掉之后,报IEDriver issue;如果执行xpath,有confirmation 弹出窗口,自动点掉。报ruby interpreter(GUI)停止
工作。
如果用远程的InternetExploerDriver sever(64-bit)的话,报command line sever for IE Driver停止工作
---解决办法:
hs = @browser.window_handles
ch = @browser.window_handle
hs.each do |h|
unless h == ch
@browser.switch_to.window(h)
end
end
换成这种就pass了
收藏
举报
TAG: