Caused by: org.openqa.selenium.WebDriverException: document.getElementById(...) is null
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'


package TestngPackage;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class datepicker {

    public static void main (String[] args){

        System.setProperty("webdriver.firefox.marionette", "E:\\selenium-2.53.1\\geckodriver.exe");
        FirefoxDriver driver = new FirefoxDriver();
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);  
         JavascriptExecutor js = (JavascriptExecutor)driver;

  • it would be helpful to see the source code-snippet for the app you are testing – g0rd Feb 1 '17 at 19:51
  • You should make sure the element is in the page first, wait for element with a regular wait and after execute your script, so the issue would be that you are not waiting at all for the element to be present in the page. – lauda Feb 4 '17 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.