I am getting error whenever running java program via selenium.

my code :

package mTash;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Celebrity {
    public static void main(String[] args)  throws InterruptedException {
        WebDriver driver = new ChromeDriver();
        driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS) ;


SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.0.0-alpha-6', revision: '5f43a29cfc'
System info: host: 'SUFIYAAN', ip: '', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_251'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:207)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:582)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:136)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:75)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:163)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:105)
    at mTash.Celebrity.main(Celebrity.java:13)

CAN ANY1 help me out.

  • Your driver fails to start. Add two more properties before WebDriver driver = new ChromeDriver(); which are: webdriver.chrome.logfile with the value where driver will be posting its logs, webdriver.chrome.verboseLogging with the value true. Then check for a clue at the produced log file. – Alexey R. Jun 4 '20 at 15:13
  • This may be because of incorrect chromedriver version. Check your current chrome browser version (open chrome--> help--> about Google chrome-->check version) and then download the same chromedriver and provide path. – Bharat Mane Mar 1 at 13:23

Your code works fine,

  1. Check whether you have correct chrome version and chromedriver version
  2. Click on the top menu bar > project > clean
  3. Click windows>show view>others > problems , and see if there any problems in your code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.