Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not instantiate new WebDriver instance of type class (gecko on Windows 10) #2729

Closed
aybartsch opened this issue Feb 24, 2022 · 9 comments
Labels

Comments

@aybartsch
Copy link

aybartsch commented Feb 24, 2022

Dear Serenity Team,

in the last days I've updated our serenity cucumber test framework to latest version 3.2.0 which also supports selenium 4.1.2 version. I'm using a custom driver which loads the corresponding webdriver via webdriver manager. Chrome and edge are working well but gecko driver is only starting on MacOS but not on Windows:

MacOS:

[main] INFO  WebDriverManager: Using geckodriver 0.30.0 (resolved driver for Firefox 97)
[main] INFO  WebDriverManager: Exporting webdriver.gecko.driver as /Users/abartsch/.cache/selenium/geckodriver/mac64/0.30.0/geckodriver
[main] INFO  CustomDriver: WebDriver URL is not defined. Assuming local execution. Using driver type: FIREFOX

Windows:

[main] INFO  WebDriverManager: Using geckodriver 0.30.0 (resolved driver for Firefox 97)
[main] INFO  WebDriverManager: Exporting webdriver.gecko.driver as C:\Users\andre.bartsch\.cache\selenium\geckodriver\win64\0.30.0\geckodriver.exe
[main] INFO  CustomDriver: WebDriver URL is not defined. Assuming local execution. Using driver type: FIREFOX
[main] INFO  : STEP ERROR: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class net.thucydides.core.webdriver.ProvidedDriver (Could not instantiate the custom webdriver provider of type custom-driver). See below for more details.

Unfortunately, I don't have further details so far even when running in debug mode. Do you have any idea what could be the reason for this exception on Windows system?

Best regards, André.

@wakaleo
Copy link
Member

wakaleo commented Feb 25, 2022

If you are using a custom driver you have total control - debug and see what it is doing. But why do you need a custom driver for that?

@aybartsch
Copy link
Author

aybartsch commented Feb 28, 2022

Hi @wakaleo, I'm using the custom driver to set some important parameters for chrome and edge like:

  • window-size
  • disable-gpu
  • log-level
  • headless
  • silent

Plus some experimental settings for chrome and edge like:

  • credentials_enable_service
  • profile.password_manager_enabled
  • excludeSwitches: enable-automation

For the gecko driver I'm mainly interested to control the size.

If there is a better serenity way with @Managed please tell me.

But I have heard that gecko driver could have an issue on windows platforms with the driver path.

@wakaleo
Copy link
Member

wakaleo commented Feb 28, 2022

You almost never need to use a custom driver, and it prevents a number of Serenity optimisations. You can configure most chrome options via chrome.switches (see https://serenity-bdd.github.io/theserenitybook/latest/web-testing-in-serenity.html#_configuring_chrome for how to configure chrome). You can also use the standard W3C properties by configuring a webdriver section in the serenity.conf file, e.g.

    webdriver {
      driver = chrome
      base.url = "https://bdd-flyer.herokuapp.com"

      # W3C Capabilities
      screenResolution = "1280x1024"
      strictFileInteractability = true
      unhandledPromptBehavior = "ignore"

      timeouts {
        script = 20000
        pageLoad = 400000,
        implicit = 1000
      }
    }

I rarely use Firefox locally as I have found it unstable and unreliable in the more recent versions.

@aybartsch
Copy link
Author

aybartsch commented Feb 28, 2022

That sounds promising! Unfortunately, our customer is making use of firefox and I have to take the gecko driver testing into account.

Out of curiosity: What kind of optimisations you are talking about?

@wakaleo
Copy link
Member

wakaleo commented Feb 28, 2022

Pretty much any configuration you specify in the serenity.conf file will not work for custom drivers.

@aybartsch
Copy link
Author

One final question if you allow: What could be the main reason for "Could not instantiate new WebDriver instance"?

@wakaleo
Copy link
Member

wakaleo commented Feb 28, 2022

That's just a wrapper for a Selenium failure, so it can mean anything.

@aybartsch
Copy link
Author

Thanks, John! Have a nice week.

@aybartsch
Copy link
Author

aybartsch commented Mar 1, 2022

@wakaleo Hi John, following your suggestion I'm planning to replace our custom driver implementation by the common serenity implementation. You were pointing me to the serenity docs which are a nice entry point to serenity framework. I found some interesting hints on how to define driver settings. But how would you switch between e.g. FirefoxDriver and RemoteWebDriver? Thanks and best regards, André

@aybartsch aybartsch reopened this Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants