1

I have tried this code in eclipse :

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class auto {
 public static void main(String[] args) {
 System.setProperty("webdriver.gecko.driver", "/root/Desktop/jarselenium/geckodriver.exe");
 WebDriver driver = new FirefoxDriver();
 driver.manage().window().maximize();
 driver.get("https://www.easybooking.lk/login");
 //driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS); 
 }
}

On execution I got this error :

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /root/Desktop/jarselenium/geckodriver.exe

How can i set geckodriver location in ubuntu?

undetected Selenium
194k44 gold badges304 silver badges385 bronze badges
asked Apr 19, 2018 at 12:10

1 Answer 1

2

As you are using Linux based System while specifying the absolute path of the GeckoDriver you have to trim the extension part i.e. .exe part as follows :

System.setProperty("webdriver.gecko.driver", "/root/Desktop/jarselenium/geckodriver");

Update

As you are still seeing the error ensure that :

  1. GeckoDriver is present in the specified location.
  2. GeckoDriver is having executable permission for non-root users. (chmod 777)
  3. Execute your @Test as a non-root user.
answered Apr 19, 2018 at 12:17
4
  • same error Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /root/Desktop/jarselenium/geckodrive. Commented Apr 19, 2018 at 12:20
  • @sanjan Checkout my answer update and let me know the status. Don't miss the e at the fag end of geckodriver. Commented Apr 19, 2018 at 12:25
  • thz its work but //driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS); if enble this line TimeUnit this is error Commented Apr 19, 2018 at 12:28
  • 1
    @sanjan Remove implicitlyWait totally from your @Tests as it is no more effective and in the long run you have to use only WebDriverWait Commented Apr 19, 2018 at 12:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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