Issue
When I run the test case in Eclipse, everything works fine, but when I make executable .jar of it, it runs until the command
js.executeScript("arguments[0].scrollIntoView(true);", element);
It returns java.lang.NullPointerException at this line of code
If there is another way to scroll element into view?
Solution
When you run from Eclipse IDE, the Run Configuration automatically adds the library you depend on (defined in your Eclipse project if not using another dependency management technology) to the classpath. So in this case, it succeeds at instantiating properly the js
variable.
When not in Eclipse IDE, you have to specify the classpath to the command line in order to include dependencies. Otherwise, the dependencies are missing and you don't get a good way to instantiate the js
object.
Answered By - Mickael
Answer Checked By - Cary Denson (JavaFixing Admin)