How to export selenium WebDriver to runnable jar file in Eclipse

569 views Asked by At

I try to make an exe file or something that could just open and work on my desktop. It works in Eclipse when I click run. I try to export it as a runnable jar file in Eclipse but it does not work. I guess it maybe the library or chromedriver path problem. Has someone successfully done this before?

package webdriver;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;

public class test {
    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver","chromedriver" );
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.google.com");
    }
}

screenshot-eclipse-project

1

There are 1 answers

2
YourHelper On

Here are the download link that will give you the jar file : https://www.selenium.dev/downloads/

download them and then in the project create a folder with name : lib and add the jar files inside