serenity-core 2.0.46 (and newer) + BrowserStack throws net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver

Created on 28 Oct 2019  路  14Comments  路  Source: serenity-bdd/serenity-core

Hello there,

I've setup a small project to run tests on BrowserStack.
Up to serenity-core v2.0.45 it's been working fine. But once I update to v2.0.46 or higher I get: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver

Here's the stacktrace:

     _______. _______ .______       _______ .__   __.  __  .___________.____    ____
    /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   /
   |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /
    \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|

 News and tutorials at http://www.serenity-bdd.info
 Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/
 Join the Serenity Community on Rocket Chat at https://serenity-bdd.rocket.chat
 Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport
 Learn Serenity BDD online at http://serenity-dojo.com
-------------------------------------------------------------------------------------

900 [main] INFO net.thucydides.core.steps.ConsoleLoggingListener - Test Suite Started: Acceptance test
971 [main] INFO net.thucydides.core.steps.ConsoleLoggingListener -
 _____ _____ ____ _____   ____ _____  _    ____ _____ _____ ____
|_   _| ____/ ___|_   _| / ___|_   _|/ \  |  _ \_   _| ____|  _ \
  | | |  _| \___ \ | |   \___ \ | | / _ \ | |_) || | |  _| | | | |
  | | | |___ ___) || |    ___) || |/ ___ \|  _ < | | | |___| |_| |
  |_| |_____|____/ |_|   |____/ |_/_/   \_\_| \_\|_| |_____|____/


TEST STARTED: should_see_a_list_of_search_results_after_searching_for_a_valid_search_term
-------------------------------------------------------------------
971 [main] INFO net.serenitybdd.core.Serenity - TEST NUMBER: 1
Oct 28, 2019 1:31:12 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
1650 [main] ERROR net.thucydides.core.steps.ConsoleLoggingListener -
           __  _____ _____ ____ _____   _____ _    ___ _     _____ ____
  _       / / |_   _| ____/ ___|_   _| |  ___/ \  |_ _| |   | ____|  _ \
 (_)_____| |    | | |  _| \___ \ | |   | |_ / _ \  | || |   |  _| | | | |
  _|_____| |    | | | |___ ___) || |   |  _/ ___ \ | || |___| |___| |_| |
 (_)     | |    |_| |_____|____/ |_|   |_|/_/   \_\___|_____|_____|____/
          \_\

TEST FAILED WITH ERROR: Should see a list of search results after searching for a valid search term
---------------------------------------------------------------------
1738 [main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - TEST FAILED AT STEP Opens etsy home page
1738 [main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.232 s <<< FAILURE! - in com.namics.nta.demo.etsy.testcases.AcceptanceTest
[ERROR] should_see_a_list_of_search_results_after_searching_for_a_valid_search_term(com.namics.nta.demo.etsy.testcases.AcceptanceTest)  Time elapsed: 0.627 s  <<< ERROR!
net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class org.openqa.selenium.firefox.FirefoxDriver (null). See below for more details.
        at com.namics.nta.demo.etsy.testcases.AcceptanceTest.should_see_a_list_of_search_results_after_searching_for_a_valid_search_term(AcceptanceTest.java:18)

I've added a minimal version of our project for you to reproduce the error.
minimal-BS-project.zip

Once unpacked you'll need to add valid BrowserStack credentials to src/test/resources/serenity.properties. Afterwards you should be able to run the AcceptanceTest with mvn verify. But when you change <serenity.maven.version> in the pom.xml from 2.0.45 to 2.0.46 (or higher) it's going to fail with the error I've mentioned.

Any help will be very much appreciated. :-)

Cheers,
Johannes

waiting for feedback

Most helpful comment

Did anyone find a solution? walk around?
2.0.46 is working fine for me.

2.0.47 says:
[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - net.thucydides.core.webdriver.DriverConfigurationError-->Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver

2.2.9 has the same error as in issue description

Hi, yes, I updated to the latest serenity version and I used the model provided here: https://github.com/browserstack/serenity-browserstack/blob/master/src/test/java/com/browserstack/BrowserStackSerenityDriver.java
You can check also the serenity.property file in that repo to see how to specify the properties.
I hope it helps.

All 14 comments

You need to make sure you are using the appropriate version of Firefox and geckodriver for whatever version of Selenium Serenity is using.

Hi John,

thank you for the fast response.

To be honest I'm unsure how to make sure I'm using the correct versions of Firefox and Geckodriver.

I can run the tests fine on a local Selenium Standalone Server v3.141.59 with Geckodriver v0.24.0 and Firefox v.70 by changing serenity.properties to:

webdriver.remote.url=http://localhost:4444/wd/hub
webdriver.remote.os=WINDOWS
webdriver.remote.driver=firefox
serenity.browser.maximized=true

I'm on Windows 10 Enterprise v10.0.18362 Build 18362.

But when I try to run them on BrowserStack they always fail. I've tried all combinations of:
browserstack.browser_version=67.0 to 70.0
browserstack.geckodriver=0.23.0 to 0.25.0
(and also browserstack.firefox.driver=0.23.0 to 0.25.0; I'm not sure which one is correct)
with
browserstack.selenium_version=3.141.59

According to BrowserStack's Capabilities Generator Firefox 70 and Geckodriver 24 should be compatible with Selenium 3.141.59. And they are on my local Selenium server.

As I said, it also works with serenity-core v2.0.45 but breaks when I update to v2.0.46 (or higher). So I strongly suspect there is some change in 2.0.46 that BrowserStack has a problem with.

Please also note I can reproduce the same behaviour when running the tests with Chrome.
I use:

browserstack.browser=Chrome
browserstack.browser_version=77.0

With serenity-core v2.0.46 I get the same error referring to FirefoxDriver. Whereas it works with v2.0.45.

If you suspect it is a change then it would be worth investigating the git changes for that version. I won鈥檛 have time to look into this for a while but I鈥檓 happy to point you in the right direction if you see anything odd.

Those versions are relatively old now - have you tried with more recent versions?

I've just tried setting serenity-core's version to 2.0.87 in the sources I uploaded in the first post. (minimal-BS-project.zip)
I get the very same error.

If it runs locally but not on BrowserStack, I suspect there is some property you need to provide to BrowserStack. Have a look at the changes in git between those versions of you think it is related. I doubt I can reproduce the issue or take a look any time soon though.

Hi, I have the exact same issue. It seems that 2.0.46 was a major update and since then properties like
browserstack.browser=Chrome browserstack.browser_version=77.0 are not working anymore.

See above. If you can tell me the properties needed for recent chrome versions, it should be easy to pass them to browserstack.

Did anyone find a solution? walk around?
2.0.46 is working fine for me.

2.0.47 says:
[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - net.thucydides.core.webdriver.DriverConfigurationError-->Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver

2.2.9 has the same error as in issue description

Did anyone find a solution? walk around?
2.0.46 is working fine for me.

2.0.47 says:
[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - net.thucydides.core.webdriver.DriverConfigurationError-->Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver

2.2.9 has the same error as in issue description

Hi, yes, I updated to the latest serenity version and I used the model provided here: https://github.com/browserstack/serenity-browserstack/blob/master/src/test/java/com/browserstack/BrowserStackSerenityDriver.java
You can check also the serenity.property file in that repo to see how to specify the properties.
I hope it helps.

It's working. Thank you so much!

I added https://github.com/browserstack/serenity-browserstack/blob/master/src/test/java/com/browserstack/BrowserStackSerenityDriver.java class to my projects and set serenity properties like:
browserstack.user=cleared
browserstack.key=cleared
browserstack.server=hub-cloud.browserstack.com

webdriver.driver = provided
webdriver.provided.type = mydriver
webdriver.provided.mydriver = com.browserstack.BrowserStackSerenityDriver
serenity.driver.capabilities = mydriver

webdriver.timeouts.implicitlywait = 5000
serenity.use.unique.browser = false
serenity.dry.run=false

environment.single.browser=chrome

Amalia, another question: did you manage to launch tests in any other browser except Chrome?)

Yes, It works on other browsers as well, I do not use cross-browsing on a daily basis but I was able to start the tests on various browsers and devices.
To do so you have to specify something like this in serenity.properties :
bstack_browser = Firefox
bstack_os = Windows
bstack_os_version = 10
bstack_browser_version = 77.0

bstack_browser = Firefox
It's working.
I wish you all the best! You helped me so much!

Hello again. I just updated to Serenity 2.2.9 and retried with remote driver and it seems to work.
What I provided in the properties file is this:

webdriver.remote.url=http://{browserstack.user}:{browserstack.key}@{browserstack.server}
browserstack.browser = Chrome
browserstack.os = Windows
browserstack.os_version = 10
browserstack.resolution = 1920x1080
browserstack.browser_version = 77.0
browserstack.local=true
browserstack.localIdentifier=YourLocalIdentifier
bstack.acceptSslCert = false
bstack.forceLocal=true

Notice that some properties must be specified as bstack. and not browserstack. and this is a bit confusing. For example, browserstack.acceptSslCert = false would return an error.
But at least now the error is clear :net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class org.openqa.selenium.firefox.FirefoxDriver (The property '#/firstMatch/0/bstack:options' contains additional properties ["forceLocal"] outside of the schema when none are allowed in the payload.
In this case there is no need to add BrowserStackSerenityDriver.java class as mentioned above

Was this page helpful?
0 / 5 - 0 ratings