title: Unexpected error while reading and writing excel file Using Selenium Webdriver
body: <p>I am using this method to read</p>
  
  <pre><code>FileInputStream fi = new FileInputStream("C:\\Users\\GChaitanya.CHAINGANG\\Desktop\\2012_October_3PL_Unified_Template.xls");
  Workbook w = Workbook.getWorkbook(fi);
  s = w.getSheet(0);
  </code></pre>
  
  <p>And this to write </p>
  
  <pre><code>WritableWorkbook wb = Workbook.createWorkbook(new File("D:\\output_2.xls"));
  WritableSheet ws = wb.createSheet("customsheet", 1);
  </code></pre>
  
  <p>I get this error</p>
  
  <pre><code>org.openqa.selenium.StaleElementReferenceException: Element not found in the cache - perhaps the page has changed since it was looked up
  Command duration or timeout: 100.10 seconds
  For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
  Build info: version: '2.34.0', revision: '11cd0ef', time: '2013-08-06 17:11:28'
  System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_45'
  Session ID: 60c039f3-60bb-413f-aca5-0543e074b04e
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=24.0}]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
      at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
      at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
      at gmailTest.TestLink.RealTime(TestLink.java:100)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Element not found in the cache - perhaps the page has changed since it was looked up
  Build info: version: '2.34.0', revision: '11cd0ef', time: '2013-08-06 17:11:28'
  System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_45'
  Driver info: driver.version: unknown
      at &lt;anonymous class&gt;.fxdriver.cache.getElementAt(resource://fxdriver/modules/web_element_cache.js:7642)
      at &lt;anonymous class&gt;.Utils.getElementAt(file:///C:/Users/GCHAIT~1.CHA/AppData/Local/Temp/anonymous5288729173687770784webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:7231)
      at &lt;anonymous class&gt;.fxdriver.preconditions.visible(file:///C:/Users/GCHAIT~1.CHA/AppData/Local/Temp/anonymous5288729173687770784webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:8228)
      at &lt;anonymous class&gt;.DelayedCommand.prototype.checkPreconditions_(file:///C:/Users/GCHAIT~1.CHA/AppData/Local/Temp/anonymous5288729173687770784webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10799)
      at &lt;anonymous class&gt;.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/GCHAIT~1.CHA/AppData/Local/Temp/anonymous5288729173687770784webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10816)
      at &lt;anonymous class&gt;.fxdriver.Timer.prototype.setTimeout/&lt;.notify(file:///C:/Users/GCHAIT~1.CHA/AppData/Local/Temp/anonymous5288729173687770784webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:396)
  </code></pre>
  
  <p>and shows this in debug mode</p>
  
  <pre><code>&lt;terminated, exit value: 0&gt;C:\Program Files\Java\jre7\bin\javaw.exe (Oct 29, 2013 5:12:25 PM)   
  </code></pre>
  
  <p>The code was working fine but stopped working all of a sudden it hardly read 10 records and crashes. I was able to read at least 300 to 400 records</p>