简体   繁体   中英

Getting end of file reached (EOFError) using ruby webdriver

Some of my tests pass one time then fail with "end of file reached(EOFError)". Can't figure out what causes this consistency issue. Sometimes it fails when filling out a form. Other times it fails when clicking a button.

Using the following: OSX 10.9.3 Watir-webdriver 0.6.10 Ruby 1.9.3 Chrome 35.0 Chromedriver ChromeDriver v2.10

Not sure what the issue is but a simple work around to get rid of this error is to use a Begin/Rescue statement around the code that is causing this error (check what line number the terminal output says is causing the error).

For example:

browser.close #This is the line giving the EOFError

Do the following:

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

The way the begin/rescue statement works is if the code in the begin statement causes an error, it will run the code in the rescue statement. In this case, since there isn't any code in the rescue statement, it will merely ignore the error and continue with the rest of the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM