2

I am having some issues running some automated tests on a web page. The test case is simple: Navigate to login page, type username and password, click login and then do an assert on an element from the home page.

The problems start after i click the "log in" button. The project is setup as follow:

  • java language
  • maven project
  • cucumber
  • webdriver manager
  • serenity
  • spring
  • OS: Ubuntu 16.04 LTS

My test runner runs with @RunWith(CucumberWithSerenity.class)

I have a StepsContext with:

@ContextConfiguration(classes = SerenityPageConfiguration.class)
@SpringBootTest
public class StepsContext {
}

And the serenity page config looks like this:

@Configuration
@ComponentScan("com.automation")
public class SerenityPageConfiguration {

    @Bean
    LoginPage loginPage() {
        return new LoginPage();
    }

    @Bean
    HomePage homePage() {
        return new HomePage();
    }

And the config file for serenity:

webdriver {
  driver = chrome
  timeouts.implicitlywait = 5000
}

serenity {
  project.name = My Automation
  outputDirectory  = target/site/reports

  use.unique.browser = false

  browser.height = 1200
  browser.width = 1200
  dry.run = false

  test.root = com.automation

  take.screenshots = FOR_FAILURES
}

I use a generic page for the webdriver setup:

private WebDriver webDriver() {
        WebDriverManager.chromedriver().setup();
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.addArguments("disable-infobars");

        return new ChromeDriver(chromeOptions);
    }

The steps are organised using page object factory model.

Now for the issue at hand: with the above setup, after the test clicks on the "log in" button (so it already went through 4 steps) the console reads and fails to do anything on the page displayed after login:

INFO 7374 --- [ main] org.openqa.selenium.Capabilities : Using new ChromeOptions() is preferred to DesiredCapabilities.chrome()

ERROR 7374 --- [ main] n.t.core.webdriver.WebDriverFacade : FAILED TO CREATE NEW WEBDRIVER_DRIVER INSTANCE class org.openqa.selenium.chrome.ChromeDriver: Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (The path to the chromedriver driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://sites.google.com/a/chromium.org/chromedriver/downloads. The latest version can be downloaded from https://sites.google.com/a/chromium.org/chromedriver/downloads

...although i am using webdriver manager to get the binary.

If i comment out the following part from the serenity config file:

webdriver {
  driver = chrome
  timeouts.implicitlywait = 5000
}

after clicking "log in" it opens up Mozilla Firefox without doing anything in it and the console reads:

INFO 7886 --- [ main] org.openqa.selenium.Capabilities : Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()

INFO 7886 --- [ main] org.openqa.selenium.Capabilities : Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()

ERROR 7886 --- [ main] n.t.core.webdriver.WebDriverFacade : FAILED TO CREATE NEW WEBDRIVER_DRIVER INSTANCE class org.openqa.selenium.firefox.FirefoxDriver: Could not instantiate new WebDriver instance of type class org.openqa.selenium.firefox.FirefoxDriver (Timed out waiting 45 seconds for Firefox to start.

Firefox is nowhere mentioned within the project and it is not even marked as the default browser of the system. Let me know if any other info is needed about the web page itself or something else as i am out of ideas on this.

Thank you!

Community
  • 1
  • 1
Bogdan
  • 21
  • 2

0 Answers0