I have recorded some functions using Selenium IDE and exported test into java file. I have used "wait for element visible" condition when performing action in order to assert a notification.

When I run the script through Selenium ide everything works perfectly but when I convert to java file it shows me an error for NaN.

Image of IDE

Here is the code

  WebDriverWait wait = new WebDriverWait(driver, NaN);
  wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("my xpath")));
assertThat(driver.findElement(By.xpath("my xpath")).getText(), is("Request for registration successfully submitted."));


How do I resolve this Nan issue?
Code image

1 Answer 1


According to the Selenium documentation, this constructor for WebDriverWait requires a long as second argument - the timeOutInSeconds.

In Java, when NaN is used in arithmetic operations, the behavior is undefined.

You simply need to use some timeout value instead of NaN when creating the WebDriverWait object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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