1

I have written a simple code in java which will open the chrome browser and verify its title. Here I have used Jbehave(BDD) concept to achieve it.

The problem which I'm facing is that I'm not able to run my config file.

This is my .story file

narrative:
In order to communicate effectively to the business some functionality
As a development team
I want to use Behaviour-Driven Development

Scenario:  A Scenario to open google.com
Given I open a browser
When I enter the https://www.google.com
Then google is displayed

This is my java code for the storyline

     import java.util.concurrent.TimeUnit;

    import org.jbehave.core.annotations.Given;
    import org.jbehave.core.annotations.Then;
    import org.jbehave.core.annotations.When;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.chrome.ChromeDriver;

    public class DebugPluginSteps {
        WebDriver driver = new ChromeDriver();
    @Given("I open a browser")
    public void openTheBrowser() {
        System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
    }

    @When("I enter $url")
    public void typeTheUrl(String url) {
        driver.get(url);
    }

    @Then("$title is displayed")
    public void debugStepForThenTest(String title) {
        if (driver.getTitle() == title) {
            System.out.println("Title matched");
        } else {
            System.out.println("Title is not matching");
        }
    }
}
}

And this is my config file.

import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.configuration.MostUsefulConfiguration;
import org.jbehave.core.junit.JUnitStory;
import org.jbehave.core.steps.InjectableStepsFactory;
import org.jbehave.core.steps.InstanceStepsFactory;
public class MyLinkedListStory extends JUnitStory {
    @Override
    public Configuration configuration() {
        return new MostUsefulConfiguration();
    }

    @Override
    public InjectableStepsFactory stepsFactory() {
        return new InstanceStepsFactory(configuration(), new DebugPluginSteps());
    }
}

Console output :

Starting ChromeDriver 2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a) on port 29264
Only local connections are allowed.
[1578918833.831][WARNING]: Timed out connecting to Chrome, retrying...
Jan 13, 2020 6:03:55 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Processing system properties {}
Using controls EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=false,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeouts=300,threads=1,failOnStoryTimeout=false]
Generating reports view to 'C:\Users\Desktop\Selenium 201\SimpleJbehave\target\jbehave' using formats '[]' and view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
Reports view generated with 0 stories (of which 0 pending) containing 0 scenarios (of which 0 pending)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

1

This error message...

Starting ChromeDriver 2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a) on port 29264
Only local connections are allowed.
[1578918833.831][WARNING]: Timed out connecting to Chrome, retrying...
Jan 13, 2020 6:03:55 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=2.43
  • Release Notes of chromedriver=2.43 clearly mentions the following :

Supports Chrome v69-71

  • Presumably you are using the updated chrome= 79.0
  • Release Notes of ChromeDriver v79.0 clearly mentions the following :

Supports Chrome version 79

  • Your Selenium Client version is unknown to us.

So there is a clear mismatch between the ChromeDriver v2.43 and the Chrome Browser v79.0


Solution

Ensure that:

  • JDK is upgraded to current levels JDK 8u222.
  • Selenium is upgraded to current levels Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
  • Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v79.0 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Hello sir even though I have updated the chrome version, chrome driver and JDK to 8 but still I'm facing the same issue. following error occurred Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 8182 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. [1578983646.230][WARNING]: Timed out connecting to Chrome, retrying... Jan 14, 2020 12:04:08 PM org.openqa.selenium.remote.ProtocolHandshake createSession. – kishan kulkarni Jan 14 '20 at 06:37
  • @kishankulkarni You are closer now. See the change from `INFO: Detected dialect: OSS` to `INFO: Detected dialect: W3C`. Can you add the current logs within the question? – undetected Selenium Jan 14 '20 at 06:41
  • Where can I find the logs? I'm bit new to this concept can you please guide me. – kishan kulkarni Jan 14 '20 at 06:45
  • @kishankulkarni The same start-up and error logs `Starting ChromeDriver 2.43.600210.....` – undetected Selenium Jan 14 '20 at 06:46
  • Comment line 1 : Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 8182 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. [1578983646.230][WARNING]: Timed out connecting to Chrome, retrying... Jan 14, 2020 12:04:08 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C – kishan kulkarni Jan 14 '20 at 06:51