how to handle org.openqa.selenium.NoSuchElementException

Can any one provide me a solution for handling org.openqa.selenium.NoSuchElementException

Default Asked on January 24, 2015 in Selenium WebDriver.
Add Comment
  • 2 Answer(s)

    Hi,

    1. Sometimes it happens that you need to wait for the element to appear on the page – Try using Thread.sleep(time in ms).

    2. Else give the correct id or the xpath of the element.

    Thanks,
    Vishal S

    Doctor Answered on January 26, 2015.
    Add Comment

    Hi Vishal

    I tried to include Thread.sleep(time in ms) it works fine only for few executions of test but fails sometimes. Overall if I tried to execute the tests again and again selenium throws an error for few executions and passes for other execution.

    Default Answered on January 26, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.