TestProject Forum

Unable to Create a Chrome driver using Driverbuilder

Hi,

I followed the documentation and created BDD test case as below

Feature File
Feature: Check Login Functionality

Scenario: Check login is successfull with valid credentials

Given user is on login page
When user enters valid username and password
And Clicks on login button
Then user is navigated to the home page

Runner File:
package runner;

import org.junit.runner.RunWith;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(features = “src/test/resources/feature”, glue=“Stepdefinition”,
plugin = “io.testproject.sdk.internal.reporting.extensions.cucumber.CucumberReporter”)
public class CucumberRunner {

}

Step definition:
package Stepdefinition;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeOptions;

import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import io.testproject.sdk.DriverBuilder;
import io.testproject.sdk.drivers.web.ChromeDriver;

public class Login {

ChromeDriver driver = null;
//ChromeDriver driver = new ChromeDriver();

@Given("user is on login page")
public void user_is_on_login_page() throws MalformedURLException {
	System.out.println("I am in one");
	driver = new DriverBuilder<ChromeDriver>(new ChromeOptions())
			.withRemoteAddress(new URL("http://localhost:8585"))
			.withToken("******").build(ChromeDriver.class);
	
	driver.navigate().to("https://example.testproject.io/web/");
}

@When("user enters valid username and password")
public void user_enters_valid_username_and_password() {
	System.out.println("Hi Step 2");
	//driver.findElement(By.id("name")).sendKeys("John walker");
	//driver.findElement(By.id("password")).sendKeys("1234");
}

@When("Clicks on login button")
public void clicks_on_login_button() {
	System.out.println("Hi Step 3");
	//driver.findElement(By.id("Login")).click();
}

@Then("user is navigated to the home page")
public void user_is_navigated_to_the_home_page() {
	//System.out.println("Hi Step 4 ");
}

}

Console Logs:

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.
I am in one
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.gson.internal.reflect.UnsafeReflectionAccessor (file:/C:/Users/Ramesh/.m2/repository/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar) to field java.io.File.path
WARNING: Please consider reporting this to the maintainers of com.google.gson.internal.reflect.UnsafeReflectionAccessor
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Can somone please please let me know what i am missing here?

After reinstalling Java 16 i was able to get rid of the warnings, Also the i tried printing the expection and looks like “Failed to create an instance of io.testproject.sdk.drivers.web.ChromeDriver”

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.
I am in one
org.openqa.selenium.WebDriverException: Failed to create an instance of io.testproject.sdk.drivers.web.ChromeDriver
Driver info: driver.version: unknown

Hello,

Can you please send your Agent logs to our support email?

support@testproject.io

You can download the zip file from the Agents section:

{10BE7CF5-8595-47B2-9228-B6A6D7BE2B1E}

If your Agent is not registered, you can find the logs in the following directories:

  1. Windows: C:\Users{your_user}\AppData\Roaming\TestProject\Agent\logs
  2. MacOS: ~/Library/Application Support/TestProject/Agent/logs
  3. Linux: .testproject directory under home (default installation directory).

The error message in itself means that the correct driver for your browser version is missing.

The Agent usually downloads them automatically, but in case your Agent is either offline or unregistered, it will not be able to do so.

We added a clear message for this in Agent version 2.3.3 and it should be visible in the IDE’s console.
Which Agent version are you using?

If you are working offline, you can follow the details here to fix the problem, there is a section about placing drivers manually:

Meanwhile, I’ll attempt to reproduce the issue locally with a Cucumber Chrome test.

Thanks, I was able to check the issue. The Agent was in disconnected status. After fixing it all started working