While automating, sometimes code is executing perfectly but at other times, the same code is not executing.

I have given specific time Thread.sleep and sometimes i have given implicit wait and webDriverWait also given. I have worked on 3 types but sometimes code is not executing. error; sometimes element is not found and sometimes error is element not visible

Element info: {Using=xpath, value=//*[text()='Send']} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ‌​e Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknow‌​n Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Un‌​known Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(Erro‌​rHandler.java:215)

what could be the solution for it.

closed as unclear what you're asking by IAmMilinPatel, João Farias, FDM, NarendraC, Bharat Mane May 16 '17 at 8:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Could you paste in some of your error code into your question ... it would help diagnose the problem. – Marcus D May 15 '17 at 12:59
  • *** Element info: {Using=xpath, value=//*[text()='Send']} 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:215) – anusha raju May 15 '17 at 15:03

Do you know what the page looks liken you are getting failures? Its possible that you are not even on the page you thought you were if trying to log in and it failed or something. If an element is not visible then you need to figure out why. Do you need to scroll or click on something? Try manually walking through what you think the automation is doing and see if you can locate a slow page load or element not being visible.

Not the answer you're looking for? Browse other questions tagged or ask your own question.