I am trying to launch Serenity Selenium tests on firefox and safari. The tests works with Chrrome however, when launched using firefox I notice error - net.thucydides.core.webdriver.DriverConfigurationError: WebDriver was unable to create a new instance of type class org.openqa.selenium.firefox.FirefoxDriver.
Sample code:
@Test
public void shouldDisplayHighlightedProductsOnTheWelcomePage() {
login.as(User.STANDARD_USER);
List<String> productsOnDisplay = productList.titles();
assertThat(productsOnDisplay).hasSize(6)
.contains("Sauce Labs Backpack");
}
serenity.conf looks like this:
serenity.test.root=serenityswag
webdriver.driver=firefox
serenity.take.screenshots=BEFORE_AND_AFTER_EACH_STEP
serenity.browser.maximized = true
Loginactions.java looks like this:
public class LoginActions extends UIInteractionSteps {
@Step("Log in as {0}")
public void as(User user) {
openUrl("https://www.saucedemo.com/");
// Login as a standard user
$("[data-test='username']").sendKeys(user.getUsername());
$("[data-test='password']").sendKeys(user.getPassword());
$("[data-test='login-button']").click();
}
The error I see is following:
net.thucydides.core.webdriver.DriverConfigurationError: WebDriver was unable to create a new instance of type class org.openqa.selenium.firefox.FirefoxDriver
WebDriver reported the following message: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
See below for more details.
at serenityswag.authentication.actions.LoginActions.as(LoginActions.java:10)
at serenityswag.inventory.WhenViewingHighlightedProducts.shouldDisplayHighlightedProductsOnTheWelcomePage(WhenViewingHighlightedProducts.java:32)
07:39:39.688 [main] ERROR -
_____ ___ ___ _____ ___ ___ ___ ___ ___
|_ _| | __| / __| |_ _| | __| | _ \ | _ \ / _ \ | _ \
| | | _| \__ \ | | | _| | / | / | (_) | | /
|_| |___| |___/ |_| |___| |_|_\ |_|_\ \___/ |_|_\
Should display highlighted products on the welcome page
---------------------------------------------------------------
07:39:39.691 [main] DEBUG - RELATED ISSUES:
07:39:39.760 [main] ERROR - Test failed at step: Log in as a standard user
07:39:39.760 [main] ERROR - Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver
The issue with the firefox browser resolved by removing the geckodriver from /usr/local/bin/geckodriver.
The issue with safari browser resolved once Allow Remote Automation enabled from the develop menu