[英]Getting end of file reached (EOFError) using ruby webdriver
我的某些测试通过了一次,然后失败,并显示“文件已到达结尾(EOFError)”。 无法找出导致此一致性问题的原因。 有时在填写表格时会失败。 有时,单击按钮时失败。
使用以下命令:OSX 10.9.3 Watir-webdriver 0.6.10 Ruby 1.9.3 Chrome 35.0 Chromedriver ChromeDriver v2.10
不确定是什么问题,但是要解决此错误,一个简单的解决方法是在引起该错误的代码周围使用Begin / Rescue语句(检查终端输出说出的行号导致了该错误)。
例如:
browser.close #This is the line giving the EOFError
请执行下列操作:
begin
browser.close #if there is an error: jump to the rescue statement
rescue
#don't put any code in the rescue statement (ignore the error)
end
#rest of code
begin / rescue语句的工作方式是,如果begin语句中的代码导致错误,它将运行急救语句中的代码。 在这种情况下,由于救援语句中没有任何代码,因此它将仅忽略该错误并继续其余代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.