From your exception, it seems you are using Mozilla’s Gecko engine ( I don’t know how !!!). For this first you need to Marionette, which is nothing but the automation driver for Gecko engine.
Please try following steps for using this :
1. Download Marionette Driver from following link :
2. Save above file at some location and unzip same.
3. Now copy the path till the marionette executable file and use following code :
File path = new File(“E:\\driver\\geckodriver.exe”); // this is the path till executable file
WebDriver driver = new MarionetteDriver();
To learn about Marionette please refer following link :
Hope this will solve your problem.