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
user8305604user8305604
1 Answer 1
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 :
- GeckoDriver is present in the specified location.
- GeckoDriver is having executable permission for non-root users. (chmod 777)
- Execute your
@Test
as a non-root user.
answered Apr 19, 2018 at 12:17
-
same error Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /root/Desktop/jarselenium/geckodrive.user8305604– user83056042018年04月19日 12:20:45 +00:00Commented 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 ofgeckodriver
.undetected Selenium– undetected Selenium2018年04月19日 12:25:25 +00:00Commented Apr 19, 2018 at 12:25 -
thz its work but //driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS); if enble this line TimeUnit this is erroruser8305604– user83056042018年04月19日 12:28:59 +00:00Commented 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 WebDriverWaitundetected Selenium– undetected Selenium2018年04月19日 12:31:13 +00:00Commented Apr 19, 2018 at 12:31
lang-java