Error: Could not instantiate class org.openqa.selenium.chrome.ChromeDriver

Andrés Felipe Contreras Muñoz picture Andrés Felipe Contreras Muñoz · Mar 16, 2018 · Viewed 7.7k times · Source

This error comes out when running the test. I do not know how to solve it. they do not run in browser

Could not instantiate new WebDriver instance of type class 
org.openqa.selenium.chrome.ChromeDriver

The code itself:

package com.automation.correo;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import net.serenitybdd.junit.runners.SerenityRunner;
import net.thucydides.core.annotations.Managed;
import net.thucydides.core.annotations.Steps;
import pasos.pasoscorreo;

@RunWith(SerenityRunner.class)
public class testcorreo {

@Managed(driver = "chrome", uniqueSession = true)
WebDriver driver;

@Steps
pasoscorreo buyer;

@Test 
public void Ingresar_Gmail_Valida_Correo_NoLeido() throws InterruptedException {

    buyer.Abrir_Gmail();
    buyer.Ingresar_usairio("Ingsisacontreras");
    buyer.Ingresar_password("fdfdfd;");
    buyer.Buscar_correo("Alejandro Rendon ");
    buyer.UsuarioCon_correo();
    buyer.Ultimo_correo();
    buyer.Descripcion_Correo();
    driver.close();

}

Answer

gelo3000 picture gelo3000 · Mar 9, 2020

I had same issue during the first run of serenity-cucumber4-smoketests. The problem was in the chromedriver.exe version located in the skeleton. After I replaced it to a new one supported by my company, the test had passed. But same issue might happen if the path to the driver is not selected correctly.