Java selenium questions












0















What I'm wanting to do is read each line and make it input into email, it does that once, when I try to "refresh" the page to clear the text boxs I get an error.



    try (BufferedReader br = new BufferedReader(new FileReader("emails.txt"))) {
String line;
while ((line = br.readLine()) != null) {
driver.get("https://signup.live.com/signup?wa=wsignin1.0&rpsnv=12&ct=1465840004&rver=6.7.6643.0&wp=&wreply=https%3a%2f%2fwww.msn.com%2fen-us%2fhomepage%2fSecure%2fPassport%3fru%3dhttp%253a%252f%252fwww.msn.com%252f%253focid%253dmailsignout%2526pfr%253d1&id=1184&pcexp=True&bk=1465840005&uiflavor=web&uaid=dc151162984741948b8371ce3e0c865e&mkt=EN-US&lc=1033&lic=1");
Thread.sleep(650);
Email.sendKeys(line);
Refresher.click();
Thread.sleep(650);
if (TakenErrorMsg.isDisplayed()){
System.out.println(line + " is taken!");

}else{
System.out.println(line + " is not taken!");
}
}
} catch (IOException e) {
e.printStackTrace();
}


This is the error, i'm pretty new so if anyone could show me how to "read" this it would be very helpful.



Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
(Session info: chrome=51.0.2704.103)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'DESKTOP-VOA61U9', ip: '192.168.0.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_73'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:UsersSkidAppDataLocalTempscoped_dir20756_575}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=51.0.2704.103, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: b48d6cc33021d97d8a72976ad4d033b7
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:122)
at tuna.tuna(tuna.java:28)
at main$1.actionPerformed(main.java:37)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)









share|improve this question



























    0















    What I'm wanting to do is read each line and make it input into email, it does that once, when I try to "refresh" the page to clear the text boxs I get an error.



        try (BufferedReader br = new BufferedReader(new FileReader("emails.txt"))) {
    String line;
    while ((line = br.readLine()) != null) {
    driver.get("https://signup.live.com/signup?wa=wsignin1.0&rpsnv=12&ct=1465840004&rver=6.7.6643.0&wp=&wreply=https%3a%2f%2fwww.msn.com%2fen-us%2fhomepage%2fSecure%2fPassport%3fru%3dhttp%253a%252f%252fwww.msn.com%252f%253focid%253dmailsignout%2526pfr%253d1&id=1184&pcexp=True&bk=1465840005&uiflavor=web&uaid=dc151162984741948b8371ce3e0c865e&mkt=EN-US&lc=1033&lic=1");
    Thread.sleep(650);
    Email.sendKeys(line);
    Refresher.click();
    Thread.sleep(650);
    if (TakenErrorMsg.isDisplayed()){
    System.out.println(line + " is taken!");

    }else{
    System.out.println(line + " is not taken!");
    }
    }
    } catch (IOException e) {
    e.printStackTrace();
    }


    This is the error, i'm pretty new so if anyone could show me how to "read" this it would be very helpful.



    Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
    (Session info: chrome=51.0.2704.103)
    (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 9 milliseconds
    For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
    Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
    System info: host: 'DESKTOP-VOA61U9', ip: '192.168.0.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_73'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:UsersSkidAppDataLocalTempscoped_dir20756_575}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=51.0.2704.103, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
    Session ID: b48d6cc33021d97d8a72976ad4d033b7
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
    at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:122)
    at tuna.tuna(tuna.java:28)
    at main$1.actionPerformed(main.java:37)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6535)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6300)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4891)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4713)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)
    at java.awt.Component.dispatchEvent(Component.java:4713)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)









    share|improve this question

























      0












      0








      0








      What I'm wanting to do is read each line and make it input into email, it does that once, when I try to "refresh" the page to clear the text boxs I get an error.



          try (BufferedReader br = new BufferedReader(new FileReader("emails.txt"))) {
      String line;
      while ((line = br.readLine()) != null) {
      driver.get("https://signup.live.com/signup?wa=wsignin1.0&rpsnv=12&ct=1465840004&rver=6.7.6643.0&wp=&wreply=https%3a%2f%2fwww.msn.com%2fen-us%2fhomepage%2fSecure%2fPassport%3fru%3dhttp%253a%252f%252fwww.msn.com%252f%253focid%253dmailsignout%2526pfr%253d1&id=1184&pcexp=True&bk=1465840005&uiflavor=web&uaid=dc151162984741948b8371ce3e0c865e&mkt=EN-US&lc=1033&lic=1");
      Thread.sleep(650);
      Email.sendKeys(line);
      Refresher.click();
      Thread.sleep(650);
      if (TakenErrorMsg.isDisplayed()){
      System.out.println(line + " is taken!");

      }else{
      System.out.println(line + " is not taken!");
      }
      }
      } catch (IOException e) {
      e.printStackTrace();
      }


      This is the error, i'm pretty new so if anyone could show me how to "read" this it would be very helpful.



      Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
      (Session info: chrome=51.0.2704.103)
      (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
      Command duration or timeout: 9 milliseconds
      For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
      Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
      System info: host: 'DESKTOP-VOA61U9', ip: '192.168.0.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_73'
      Driver info: org.openqa.selenium.chrome.ChromeDriver
      Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:UsersSkidAppDataLocalTempscoped_dir20756_575}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=51.0.2704.103, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
      Session ID: b48d6cc33021d97d8a72976ad4d033b7
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
      at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
      at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:122)
      at tuna.tuna(tuna.java:28)
      at main$1.actionPerformed(main.java:37)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
      at java.awt.Component.processMouseEvent(Component.java:6535)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
      at java.awt.Component.processEvent(Component.java:6300)
      at java.awt.Container.processEvent(Container.java:2236)
      at java.awt.Component.dispatchEventImpl(Component.java:4891)
      at java.awt.Container.dispatchEventImpl(Container.java:2294)
      at java.awt.Component.dispatchEvent(Component.java:4713)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
      at java.awt.Container.dispatchEventImpl(Container.java:2280)
      at java.awt.Window.dispatchEventImpl(Window.java:2750)
      at java.awt.Component.dispatchEvent(Component.java:4713)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
      at java.awt.EventQueue.access$500(EventQueue.java:97)
      at java.awt.EventQueue$3.run(EventQueue.java:709)
      at java.awt.EventQueue$3.run(EventQueue.java:703)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
      at java.awt.EventQueue$4.run(EventQueue.java:731)
      at java.awt.EventQueue$4.run(EventQueue.java:729)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)









      share|improve this question














      What I'm wanting to do is read each line and make it input into email, it does that once, when I try to "refresh" the page to clear the text boxs I get an error.



          try (BufferedReader br = new BufferedReader(new FileReader("emails.txt"))) {
      String line;
      while ((line = br.readLine()) != null) {
      driver.get("https://signup.live.com/signup?wa=wsignin1.0&rpsnv=12&ct=1465840004&rver=6.7.6643.0&wp=&wreply=https%3a%2f%2fwww.msn.com%2fen-us%2fhomepage%2fSecure%2fPassport%3fru%3dhttp%253a%252f%252fwww.msn.com%252f%253focid%253dmailsignout%2526pfr%253d1&id=1184&pcexp=True&bk=1465840005&uiflavor=web&uaid=dc151162984741948b8371ce3e0c865e&mkt=EN-US&lc=1033&lic=1");
      Thread.sleep(650);
      Email.sendKeys(line);
      Refresher.click();
      Thread.sleep(650);
      if (TakenErrorMsg.isDisplayed()){
      System.out.println(line + " is taken!");

      }else{
      System.out.println(line + " is not taken!");
      }
      }
      } catch (IOException e) {
      e.printStackTrace();
      }


      This is the error, i'm pretty new so if anyone could show me how to "read" this it would be very helpful.



      Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
      (Session info: chrome=51.0.2704.103)
      (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
      Command duration or timeout: 9 milliseconds
      For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
      Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
      System info: host: 'DESKTOP-VOA61U9', ip: '192.168.0.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_73'
      Driver info: org.openqa.selenium.chrome.ChromeDriver
      Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:UsersSkidAppDataLocalTempscoped_dir20756_575}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=51.0.2704.103, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
      Session ID: b48d6cc33021d97d8a72976ad4d033b7
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
      at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327)
      at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:122)
      at tuna.tuna(tuna.java:28)
      at main$1.actionPerformed(main.java:37)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
      at java.awt.Component.processMouseEvent(Component.java:6535)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
      at java.awt.Component.processEvent(Component.java:6300)
      at java.awt.Container.processEvent(Container.java:2236)
      at java.awt.Component.dispatchEventImpl(Component.java:4891)
      at java.awt.Container.dispatchEventImpl(Container.java:2294)
      at java.awt.Component.dispatchEvent(Component.java:4713)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
      at java.awt.Container.dispatchEventImpl(Container.java:2280)
      at java.awt.Window.dispatchEventImpl(Window.java:2750)
      at java.awt.Component.dispatchEvent(Component.java:4713)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
      at java.awt.EventQueue.access$500(EventQueue.java:97)
      at java.awt.EventQueue$3.run(EventQueue.java:709)
      at java.awt.EventQueue$3.run(EventQueue.java:703)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
      at java.awt.EventQueue$4.run(EventQueue.java:731)
      at java.awt.EventQueue$4.run(EventQueue.java:729)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)






      java selenium






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 25 '16 at 18:15









      Macklin guyMacklin guy

      148




      148
























          2 Answers
          2






          active

          oldest

          votes


















          1














          If you read the exception log, the first line tells you what went wrong:



          Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document


          This is telling you that selenium threw a StaleElementReferenceException, if you google it, you will get to this selenium documentation page (link). Which basically it explains you that the element you are trying to reach through selenium is not longer in the DOM.



          This is happening because you are reloading the page several times, you would need to refresh the instances of your elements on each page load, the elements that you need to reload the reference is:




          • Email

          • Refresher

          • TakenErrorMsg






          share|improve this answer































            0














            Stale Element Reference error is coming because you are trying to access an element which is no longer present in the DOM.



            So If you want to access that element there are four ways to access it




            1. use wait method to wait for the element to present


            2. Check the element present or visibility by isDispayed() & isEnabled() before performing any action



            3. Create a Class which search the stale element if it is not available to search again it in DOM



              public class SearchStaleWebElement implements WebElement {
              private WebElement element;
              private final WebDriver driver;
              private final By foundBy;



              public NeverStaleWebElement(WebElement element, WebDriver driver, By foundBy) {
              this.element = element;
              this.driver = driver;
              this.foundBy = foundBy;
              }

              @Override
              public void click() {
              try {
              element.click();
              } catch (StaleElementReferenceException e) {
              // log exception

              // assumes implicit wait, use custom findElement() methods for custom behaviour
              element = driver.findElement(foundBy);

              // recursion, consider a conditioned loop instead
              click();
              }
              }

              // ... similar for other methods, too


              }




            You can create as more method as your requirement.






            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38031532%2fjava-selenium-questions%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              If you read the exception log, the first line tells you what went wrong:



              Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document


              This is telling you that selenium threw a StaleElementReferenceException, if you google it, you will get to this selenium documentation page (link). Which basically it explains you that the element you are trying to reach through selenium is not longer in the DOM.



              This is happening because you are reloading the page several times, you would need to refresh the instances of your elements on each page load, the elements that you need to reload the reference is:




              • Email

              • Refresher

              • TakenErrorMsg






              share|improve this answer




























                1














                If you read the exception log, the first line tells you what went wrong:



                Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document


                This is telling you that selenium threw a StaleElementReferenceException, if you google it, you will get to this selenium documentation page (link). Which basically it explains you that the element you are trying to reach through selenium is not longer in the DOM.



                This is happening because you are reloading the page several times, you would need to refresh the instances of your elements on each page load, the elements that you need to reload the reference is:




                • Email

                • Refresher

                • TakenErrorMsg






                share|improve this answer


























                  1












                  1








                  1







                  If you read the exception log, the first line tells you what went wrong:



                  Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document


                  This is telling you that selenium threw a StaleElementReferenceException, if you google it, you will get to this selenium documentation page (link). Which basically it explains you that the element you are trying to reach through selenium is not longer in the DOM.



                  This is happening because you are reloading the page several times, you would need to refresh the instances of your elements on each page load, the elements that you need to reload the reference is:




                  • Email

                  • Refresher

                  • TakenErrorMsg






                  share|improve this answer













                  If you read the exception log, the first line tells you what went wrong:



                  Exception in thread "AWT-EventQueue-0" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document


                  This is telling you that selenium threw a StaleElementReferenceException, if you google it, you will get to this selenium documentation page (link). Which basically it explains you that the element you are trying to reach through selenium is not longer in the DOM.



                  This is happening because you are reloading the page several times, you would need to refresh the instances of your elements on each page load, the elements that you need to reload the reference is:




                  • Email

                  • Refresher

                  • TakenErrorMsg







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 25 '16 at 18:28









                  daniel.brubeckdaniel.brubeck

                  63449




                  63449

























                      0














                      Stale Element Reference error is coming because you are trying to access an element which is no longer present in the DOM.



                      So If you want to access that element there are four ways to access it




                      1. use wait method to wait for the element to present


                      2. Check the element present or visibility by isDispayed() & isEnabled() before performing any action



                      3. Create a Class which search the stale element if it is not available to search again it in DOM



                        public class SearchStaleWebElement implements WebElement {
                        private WebElement element;
                        private final WebDriver driver;
                        private final By foundBy;



                        public NeverStaleWebElement(WebElement element, WebDriver driver, By foundBy) {
                        this.element = element;
                        this.driver = driver;
                        this.foundBy = foundBy;
                        }

                        @Override
                        public void click() {
                        try {
                        element.click();
                        } catch (StaleElementReferenceException e) {
                        // log exception

                        // assumes implicit wait, use custom findElement() methods for custom behaviour
                        element = driver.findElement(foundBy);

                        // recursion, consider a conditioned loop instead
                        click();
                        }
                        }

                        // ... similar for other methods, too


                        }




                      You can create as more method as your requirement.






                      share|improve this answer






























                        0














                        Stale Element Reference error is coming because you are trying to access an element which is no longer present in the DOM.



                        So If you want to access that element there are four ways to access it




                        1. use wait method to wait for the element to present


                        2. Check the element present or visibility by isDispayed() & isEnabled() before performing any action



                        3. Create a Class which search the stale element if it is not available to search again it in DOM



                          public class SearchStaleWebElement implements WebElement {
                          private WebElement element;
                          private final WebDriver driver;
                          private final By foundBy;



                          public NeverStaleWebElement(WebElement element, WebDriver driver, By foundBy) {
                          this.element = element;
                          this.driver = driver;
                          this.foundBy = foundBy;
                          }

                          @Override
                          public void click() {
                          try {
                          element.click();
                          } catch (StaleElementReferenceException e) {
                          // log exception

                          // assumes implicit wait, use custom findElement() methods for custom behaviour
                          element = driver.findElement(foundBy);

                          // recursion, consider a conditioned loop instead
                          click();
                          }
                          }

                          // ... similar for other methods, too


                          }




                        You can create as more method as your requirement.






                        share|improve this answer




























                          0












                          0








                          0







                          Stale Element Reference error is coming because you are trying to access an element which is no longer present in the DOM.



                          So If you want to access that element there are four ways to access it




                          1. use wait method to wait for the element to present


                          2. Check the element present or visibility by isDispayed() & isEnabled() before performing any action



                          3. Create a Class which search the stale element if it is not available to search again it in DOM



                            public class SearchStaleWebElement implements WebElement {
                            private WebElement element;
                            private final WebDriver driver;
                            private final By foundBy;



                            public NeverStaleWebElement(WebElement element, WebDriver driver, By foundBy) {
                            this.element = element;
                            this.driver = driver;
                            this.foundBy = foundBy;
                            }

                            @Override
                            public void click() {
                            try {
                            element.click();
                            } catch (StaleElementReferenceException e) {
                            // log exception

                            // assumes implicit wait, use custom findElement() methods for custom behaviour
                            element = driver.findElement(foundBy);

                            // recursion, consider a conditioned loop instead
                            click();
                            }
                            }

                            // ... similar for other methods, too


                            }




                          You can create as more method as your requirement.






                          share|improve this answer















                          Stale Element Reference error is coming because you are trying to access an element which is no longer present in the DOM.



                          So If you want to access that element there are four ways to access it




                          1. use wait method to wait for the element to present


                          2. Check the element present or visibility by isDispayed() & isEnabled() before performing any action



                          3. Create a Class which search the stale element if it is not available to search again it in DOM



                            public class SearchStaleWebElement implements WebElement {
                            private WebElement element;
                            private final WebDriver driver;
                            private final By foundBy;



                            public NeverStaleWebElement(WebElement element, WebDriver driver, By foundBy) {
                            this.element = element;
                            this.driver = driver;
                            this.foundBy = foundBy;
                            }

                            @Override
                            public void click() {
                            try {
                            element.click();
                            } catch (StaleElementReferenceException e) {
                            // log exception

                            // assumes implicit wait, use custom findElement() methods for custom behaviour
                            element = driver.findElement(foundBy);

                            // recursion, consider a conditioned loop instead
                            click();
                            }
                            }

                            // ... similar for other methods, too


                            }




                          You can create as more method as your requirement.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 15 '18 at 10:58









                          Iwo Kucharski

                          2,73123554




                          2,73123554










                          answered Nov 15 '18 at 10:41









                          shankul raishankul rai

                          1




                          1






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38031532%2fjava-selenium-questions%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Florida Star v. B. J. F.

                              Error while running script in elastic search , gateway timeout

                              Adding quotations to stringified JSON object values