Selenium + Geckodriver + firefox test throws various errors


I'm trying to make some simple selenium tests with firefox and can't make it working correctly. Task is avoid using driver manager and use Geckodriver.

Here is example of my code:

public void checkDownloadPage(){
    System.setProperty("webdriver.gecko.driver", "drivers/windows/geckodriver.exe");
    FirefoxProfile profile = new ProfilesIni().getProfile("TestAutomation");
    FirefoxOptions ffOptions = new FirefoxOptions();
    WebDriver driver = new FirefoxDriver(ffOptions);

Here is console output:

1616876616440   geckodriver INFO    Listening on
1616876617340   mozrunner::runner   INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "0" "-foreground" "-no-remote" "-profile" "C:\\Users\\Abaddon\\AppData\\Local\\Temp\\rust_mozprofiles624Y0"
DevTools listening on ws://localhost:54709/devtools/browser/c139d218-070e-445b-89fd-6067dbb4b52a
1616876618916   Marionette  INFO    Listening on port 54695
1616876619397   Marionette  WARN    TLS certificate errors will be ignored for this session
Mar 27, 2021 10:23:39 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
1616876620273   Marionette  INFO    Stopped listening on port 54695
!!! error running onStopped callback: TypeError: callback is not a function

###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

1616876620574   RemoteAgent ERROR   unable to stop listener: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIWindowMediator.getEnumerator]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://remote/content/cdp/observers/TargetObserver.jsm :: stop :: line 61"  data: no] Stack trace: stop()@TargetObserver.jsm:61

Default Suite
Total tests run: 1, Passes: 1, Failures: 0, Skips: 0

Process finished with exit code 0

Versions of stuff I have in dependencies:


tried also with selenium 3.141.59, geckodriver both 32 and 64 bit, Firefox is 87.0 version

Would really like to understand how to get rid of that error messages.

asked on Stack Overflow Mar 27, 2021 by Miamato

2 Answers


Best thing is to use wedDriver manager. This will automatically handle all your browser related versions. Instead of system.setProperty() use WebDriverManager.firefoxdriver().setup();

answered on Stack Overflow Mar 29, 2021 by nitish21gupta

There is an open bug about this:

answered on Stack Overflow Apr 12, 2021 by JohnP2

User contributions licensed under CC BY-SA 3.0