Selenium with Firefox webdriver results in error: Service geckodriver unexpectedly exited. Status code was:...












2















I have been wracking my brain over this. I'm getting the error:




System geckodriver unexpectedly exited. Status code: -11.




I am using a Linux server that is a shared hosting web server. I have everything set up in a virtual environment.




  • Linux Server - CentOS, Release: 7.4.1708

  • Selenium version 3.141.0

  • geckodriver version 0.23.0

  • Firefox 60.3.0

  • Python 3.6.2 and cannot use a newer version


Python, Selenium and Geckodriver reside on a virtual environment on a Linux web server. Firefox resides outside of the virtual environment



export PATH=$PATH:/path/to/geckodriver


to my terminal to have geckodriver be used in the PATH environment variable.



Below is my code:



#!/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/python

# -*- coding: UTF-8 -*-
import cgitb
import cgi
from selenium import webdriver
from selenium.webdriver import FirefoxOptions

cgitb.enable()
print ("Content-Type: text/html; charset=utf-8nn")
path = r'/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver'
binary = FirefoxBinary(r'/usr/lib64/firefox')

opts = FirefoxOptions()
opts.add_argument("--headless")

browser = webdriver.Firefox(firefox_options=opts, firefox_binary=binary, executable_path=path)
rowser.get("http://google.com/")
print ("Headless Firefox Initialized")
browser.quit()


Here is my traceback error:



Traceback (most recent call last):
File "selen.py", line 20, in <module>
browser = webdriver.Firefox(firefox_options=opts, executable_path=path)
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver unexpectedly exited. Status code was: -11


Why am I getting this error and how do I fix it?










share|improve this question

























  • -11 means a segmentation fault in the child process, if that helps.

    – Davis Herring
    Jan 3 at 2:17






  • 2





    @Jayjayyy: It appears in the subprocess documentation. (True exit status values are non-negative, so you know they’re special somehow.)

    – Davis Herring
    Jan 3 at 2:49











  • @Jayjayyy: subprocess represents the termination of a child because of a signal (rather than an exit, which is the only other choice) with a negative number that indicates the signal (and can’t be confused with an exit code). (Segmentation faults happen during execution, not before it, although one could theoretically happen after fork and before exec.)

    – Davis Herring
    Jan 3 at 5:02











  • Thanks guys! How do I fix the segmentation fault for geckodriver.exe? I tried running 'geckodriver --version' through a terminal for the server yesterday, and it came back with the same error: segmentation fault. The permissions for the driver is set to 755.

    – StephenB
    Jan 3 at 16:15











  • Please run file /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver and post the output.

    – SiKing
    Jan 4 at 17:28
















2















I have been wracking my brain over this. I'm getting the error:




System geckodriver unexpectedly exited. Status code: -11.




I am using a Linux server that is a shared hosting web server. I have everything set up in a virtual environment.




  • Linux Server - CentOS, Release: 7.4.1708

  • Selenium version 3.141.0

  • geckodriver version 0.23.0

  • Firefox 60.3.0

  • Python 3.6.2 and cannot use a newer version


Python, Selenium and Geckodriver reside on a virtual environment on a Linux web server. Firefox resides outside of the virtual environment



export PATH=$PATH:/path/to/geckodriver


to my terminal to have geckodriver be used in the PATH environment variable.



Below is my code:



#!/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/python

# -*- coding: UTF-8 -*-
import cgitb
import cgi
from selenium import webdriver
from selenium.webdriver import FirefoxOptions

cgitb.enable()
print ("Content-Type: text/html; charset=utf-8nn")
path = r'/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver'
binary = FirefoxBinary(r'/usr/lib64/firefox')

opts = FirefoxOptions()
opts.add_argument("--headless")

browser = webdriver.Firefox(firefox_options=opts, firefox_binary=binary, executable_path=path)
rowser.get("http://google.com/")
print ("Headless Firefox Initialized")
browser.quit()


Here is my traceback error:



Traceback (most recent call last):
File "selen.py", line 20, in <module>
browser = webdriver.Firefox(firefox_options=opts, executable_path=path)
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver unexpectedly exited. Status code was: -11


Why am I getting this error and how do I fix it?










share|improve this question

























  • -11 means a segmentation fault in the child process, if that helps.

    – Davis Herring
    Jan 3 at 2:17






  • 2





    @Jayjayyy: It appears in the subprocess documentation. (True exit status values are non-negative, so you know they’re special somehow.)

    – Davis Herring
    Jan 3 at 2:49











  • @Jayjayyy: subprocess represents the termination of a child because of a signal (rather than an exit, which is the only other choice) with a negative number that indicates the signal (and can’t be confused with an exit code). (Segmentation faults happen during execution, not before it, although one could theoretically happen after fork and before exec.)

    – Davis Herring
    Jan 3 at 5:02











  • Thanks guys! How do I fix the segmentation fault for geckodriver.exe? I tried running 'geckodriver --version' through a terminal for the server yesterday, and it came back with the same error: segmentation fault. The permissions for the driver is set to 755.

    – StephenB
    Jan 3 at 16:15











  • Please run file /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver and post the output.

    – SiKing
    Jan 4 at 17:28














2












2








2


1






I have been wracking my brain over this. I'm getting the error:




System geckodriver unexpectedly exited. Status code: -11.




I am using a Linux server that is a shared hosting web server. I have everything set up in a virtual environment.




  • Linux Server - CentOS, Release: 7.4.1708

  • Selenium version 3.141.0

  • geckodriver version 0.23.0

  • Firefox 60.3.0

  • Python 3.6.2 and cannot use a newer version


Python, Selenium and Geckodriver reside on a virtual environment on a Linux web server. Firefox resides outside of the virtual environment



export PATH=$PATH:/path/to/geckodriver


to my terminal to have geckodriver be used in the PATH environment variable.



Below is my code:



#!/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/python

# -*- coding: UTF-8 -*-
import cgitb
import cgi
from selenium import webdriver
from selenium.webdriver import FirefoxOptions

cgitb.enable()
print ("Content-Type: text/html; charset=utf-8nn")
path = r'/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver'
binary = FirefoxBinary(r'/usr/lib64/firefox')

opts = FirefoxOptions()
opts.add_argument("--headless")

browser = webdriver.Firefox(firefox_options=opts, firefox_binary=binary, executable_path=path)
rowser.get("http://google.com/")
print ("Headless Firefox Initialized")
browser.quit()


Here is my traceback error:



Traceback (most recent call last):
File "selen.py", line 20, in <module>
browser = webdriver.Firefox(firefox_options=opts, executable_path=path)
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver unexpectedly exited. Status code was: -11


Why am I getting this error and how do I fix it?










share|improve this question
















I have been wracking my brain over this. I'm getting the error:




System geckodriver unexpectedly exited. Status code: -11.




I am using a Linux server that is a shared hosting web server. I have everything set up in a virtual environment.




  • Linux Server - CentOS, Release: 7.4.1708

  • Selenium version 3.141.0

  • geckodriver version 0.23.0

  • Firefox 60.3.0

  • Python 3.6.2 and cannot use a newer version


Python, Selenium and Geckodriver reside on a virtual environment on a Linux web server. Firefox resides outside of the virtual environment



export PATH=$PATH:/path/to/geckodriver


to my terminal to have geckodriver be used in the PATH environment variable.



Below is my code:



#!/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/python

# -*- coding: UTF-8 -*-
import cgitb
import cgi
from selenium import webdriver
from selenium.webdriver import FirefoxOptions

cgitb.enable()
print ("Content-Type: text/html; charset=utf-8nn")
path = r'/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver'
binary = FirefoxBinary(r'/usr/lib64/firefox')

opts = FirefoxOptions()
opts.add_argument("--headless")

browser = webdriver.Firefox(firefox_options=opts, firefox_binary=binary, executable_path=path)
rowser.get("http://google.com/")
print ("Headless Firefox Initialized")
browser.quit()


Here is my traceback error:



Traceback (most recent call last):
File "selen.py", line 20, in <module>
browser = webdriver.Firefox(firefox_options=opts, executable_path=path)
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver unexpectedly exited. Status code was: -11


Why am I getting this error and how do I fix it?







python selenium geckodriver






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 4 at 21:14







StephenB

















asked Jan 2 at 23:51









StephenBStephenB

76112




76112













  • -11 means a segmentation fault in the child process, if that helps.

    – Davis Herring
    Jan 3 at 2:17






  • 2





    @Jayjayyy: It appears in the subprocess documentation. (True exit status values are non-negative, so you know they’re special somehow.)

    – Davis Herring
    Jan 3 at 2:49











  • @Jayjayyy: subprocess represents the termination of a child because of a signal (rather than an exit, which is the only other choice) with a negative number that indicates the signal (and can’t be confused with an exit code). (Segmentation faults happen during execution, not before it, although one could theoretically happen after fork and before exec.)

    – Davis Herring
    Jan 3 at 5:02











  • Thanks guys! How do I fix the segmentation fault for geckodriver.exe? I tried running 'geckodriver --version' through a terminal for the server yesterday, and it came back with the same error: segmentation fault. The permissions for the driver is set to 755.

    – StephenB
    Jan 3 at 16:15











  • Please run file /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver and post the output.

    – SiKing
    Jan 4 at 17:28



















  • -11 means a segmentation fault in the child process, if that helps.

    – Davis Herring
    Jan 3 at 2:17






  • 2





    @Jayjayyy: It appears in the subprocess documentation. (True exit status values are non-negative, so you know they’re special somehow.)

    – Davis Herring
    Jan 3 at 2:49











  • @Jayjayyy: subprocess represents the termination of a child because of a signal (rather than an exit, which is the only other choice) with a negative number that indicates the signal (and can’t be confused with an exit code). (Segmentation faults happen during execution, not before it, although one could theoretically happen after fork and before exec.)

    – Davis Herring
    Jan 3 at 5:02











  • Thanks guys! How do I fix the segmentation fault for geckodriver.exe? I tried running 'geckodriver --version' through a terminal for the server yesterday, and it came back with the same error: segmentation fault. The permissions for the driver is set to 755.

    – StephenB
    Jan 3 at 16:15











  • Please run file /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver and post the output.

    – SiKing
    Jan 4 at 17:28

















-11 means a segmentation fault in the child process, if that helps.

– Davis Herring
Jan 3 at 2:17





-11 means a segmentation fault in the child process, if that helps.

– Davis Herring
Jan 3 at 2:17




2




2





@Jayjayyy: It appears in the subprocess documentation. (True exit status values are non-negative, so you know they’re special somehow.)

– Davis Herring
Jan 3 at 2:49





@Jayjayyy: It appears in the subprocess documentation. (True exit status values are non-negative, so you know they’re special somehow.)

– Davis Herring
Jan 3 at 2:49













@Jayjayyy: subprocess represents the termination of a child because of a signal (rather than an exit, which is the only other choice) with a negative number that indicates the signal (and can’t be confused with an exit code). (Segmentation faults happen during execution, not before it, although one could theoretically happen after fork and before exec.)

– Davis Herring
Jan 3 at 5:02





@Jayjayyy: subprocess represents the termination of a child because of a signal (rather than an exit, which is the only other choice) with a negative number that indicates the signal (and can’t be confused with an exit code). (Segmentation faults happen during execution, not before it, although one could theoretically happen after fork and before exec.)

– Davis Herring
Jan 3 at 5:02













Thanks guys! How do I fix the segmentation fault for geckodriver.exe? I tried running 'geckodriver --version' through a terminal for the server yesterday, and it came back with the same error: segmentation fault. The permissions for the driver is set to 755.

– StephenB
Jan 3 at 16:15





Thanks guys! How do I fix the segmentation fault for geckodriver.exe? I tried running 'geckodriver --version' through a terminal for the server yesterday, and it came back with the same error: segmentation fault. The permissions for the driver is set to 755.

– StephenB
Jan 3 at 16:15













Please run file /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver and post the output.

– SiKing
Jan 4 at 17:28





Please run file /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver and post the output.

– SiKing
Jan 4 at 17:28












1 Answer
1






active

oldest

votes


















2














This is at least a partial answer to your question.




  • Status code -11 means that subprocess experiences a segmentation fault. Read more about it at Determining if a python subprocess segmentation faults




In the past, there were some problems with certain versions of Selenium not working well together with certain versions of Firefox and/or geckodriver. Find out your versions, update them to the most recent versions if possible and look for existing bug reports for your versions.



The following versions work well together on my Ubuntu 18.04 LTS Bionic Beaver system:





  • Check Python version



    $ python3 --version
    Python 3.6.7



  • Check Selenium version



    $ python3 -c "import selenium; print(selenium.__version__)"
    3.141.0



  • Check Firefox version



    $ firefox --version
    Mozilla Firefox 64.0



  • Check geckodriver version



    $ geckodriver --version
    geckodriver 0.23.0 ( 2018-10-04)

    The source code of this program is available from
    testing/geckodriver in https://hg.mozilla.org/mozilla-central.

    This program is subject to the terms of the Mozilla Public License 2.0.
    You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.





If you have to browse to a special path to make those commands work and those commands don't work directly in your terminal or virtual environment, you might need to set one of the following keyword arguments in your call to webdriver.Firefox:






  • firefox_binary – Instance of FirefoxBinary or full path to the Firefox binary. If undefined, the system default Firefox installation will be used.


  • executable_path – Full path to override which geckodriver binary to use for Firefox 47.0.1 and greater, which defaults to picking up the binary from the system path.






Run nothing fancy as a test, but a minimal example of Selenium with Firefox in headless mode only, for example minimal_selenium_test.py:



import selenium.webdriver

options = selenium.webdriver.FirefoxOptions()
options.add_argument("--headless")

driver = selenium.webdriver.Firefox(firefox_options=options)
driver.get('https://www.python.org/')
print(driver.title)
driver.close()


This should work on your local laptop as well as on a virtual server as well as inside a Docker container and should print:



$ python3 minimal_selenium_test.py 
Welcome to Python.org





share|improve this answer


























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014683%2fselenium-with-firefox-webdriver-results-in-error-service-geckodriver-unexpected%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    This is at least a partial answer to your question.




    • Status code -11 means that subprocess experiences a segmentation fault. Read more about it at Determining if a python subprocess segmentation faults




    In the past, there were some problems with certain versions of Selenium not working well together with certain versions of Firefox and/or geckodriver. Find out your versions, update them to the most recent versions if possible and look for existing bug reports for your versions.



    The following versions work well together on my Ubuntu 18.04 LTS Bionic Beaver system:





    • Check Python version



      $ python3 --version
      Python 3.6.7



    • Check Selenium version



      $ python3 -c "import selenium; print(selenium.__version__)"
      3.141.0



    • Check Firefox version



      $ firefox --version
      Mozilla Firefox 64.0



    • Check geckodriver version



      $ geckodriver --version
      geckodriver 0.23.0 ( 2018-10-04)

      The source code of this program is available from
      testing/geckodriver in https://hg.mozilla.org/mozilla-central.

      This program is subject to the terms of the Mozilla Public License 2.0.
      You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.





    If you have to browse to a special path to make those commands work and those commands don't work directly in your terminal or virtual environment, you might need to set one of the following keyword arguments in your call to webdriver.Firefox:






    • firefox_binary – Instance of FirefoxBinary or full path to the Firefox binary. If undefined, the system default Firefox installation will be used.


    • executable_path – Full path to override which geckodriver binary to use for Firefox 47.0.1 and greater, which defaults to picking up the binary from the system path.






    Run nothing fancy as a test, but a minimal example of Selenium with Firefox in headless mode only, for example minimal_selenium_test.py:



    import selenium.webdriver

    options = selenium.webdriver.FirefoxOptions()
    options.add_argument("--headless")

    driver = selenium.webdriver.Firefox(firefox_options=options)
    driver.get('https://www.python.org/')
    print(driver.title)
    driver.close()


    This should work on your local laptop as well as on a virtual server as well as inside a Docker container and should print:



    $ python3 minimal_selenium_test.py 
    Welcome to Python.org





    share|improve this answer






























      2














      This is at least a partial answer to your question.




      • Status code -11 means that subprocess experiences a segmentation fault. Read more about it at Determining if a python subprocess segmentation faults




      In the past, there were some problems with certain versions of Selenium not working well together with certain versions of Firefox and/or geckodriver. Find out your versions, update them to the most recent versions if possible and look for existing bug reports for your versions.



      The following versions work well together on my Ubuntu 18.04 LTS Bionic Beaver system:





      • Check Python version



        $ python3 --version
        Python 3.6.7



      • Check Selenium version



        $ python3 -c "import selenium; print(selenium.__version__)"
        3.141.0



      • Check Firefox version



        $ firefox --version
        Mozilla Firefox 64.0



      • Check geckodriver version



        $ geckodriver --version
        geckodriver 0.23.0 ( 2018-10-04)

        The source code of this program is available from
        testing/geckodriver in https://hg.mozilla.org/mozilla-central.

        This program is subject to the terms of the Mozilla Public License 2.0.
        You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.





      If you have to browse to a special path to make those commands work and those commands don't work directly in your terminal or virtual environment, you might need to set one of the following keyword arguments in your call to webdriver.Firefox:






      • firefox_binary – Instance of FirefoxBinary or full path to the Firefox binary. If undefined, the system default Firefox installation will be used.


      • executable_path – Full path to override which geckodriver binary to use for Firefox 47.0.1 and greater, which defaults to picking up the binary from the system path.






      Run nothing fancy as a test, but a minimal example of Selenium with Firefox in headless mode only, for example minimal_selenium_test.py:



      import selenium.webdriver

      options = selenium.webdriver.FirefoxOptions()
      options.add_argument("--headless")

      driver = selenium.webdriver.Firefox(firefox_options=options)
      driver.get('https://www.python.org/')
      print(driver.title)
      driver.close()


      This should work on your local laptop as well as on a virtual server as well as inside a Docker container and should print:



      $ python3 minimal_selenium_test.py 
      Welcome to Python.org





      share|improve this answer




























        2












        2








        2







        This is at least a partial answer to your question.




        • Status code -11 means that subprocess experiences a segmentation fault. Read more about it at Determining if a python subprocess segmentation faults




        In the past, there were some problems with certain versions of Selenium not working well together with certain versions of Firefox and/or geckodriver. Find out your versions, update them to the most recent versions if possible and look for existing bug reports for your versions.



        The following versions work well together on my Ubuntu 18.04 LTS Bionic Beaver system:





        • Check Python version



          $ python3 --version
          Python 3.6.7



        • Check Selenium version



          $ python3 -c "import selenium; print(selenium.__version__)"
          3.141.0



        • Check Firefox version



          $ firefox --version
          Mozilla Firefox 64.0



        • Check geckodriver version



          $ geckodriver --version
          geckodriver 0.23.0 ( 2018-10-04)

          The source code of this program is available from
          testing/geckodriver in https://hg.mozilla.org/mozilla-central.

          This program is subject to the terms of the Mozilla Public License 2.0.
          You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.





        If you have to browse to a special path to make those commands work and those commands don't work directly in your terminal or virtual environment, you might need to set one of the following keyword arguments in your call to webdriver.Firefox:






        • firefox_binary – Instance of FirefoxBinary or full path to the Firefox binary. If undefined, the system default Firefox installation will be used.


        • executable_path – Full path to override which geckodriver binary to use for Firefox 47.0.1 and greater, which defaults to picking up the binary from the system path.






        Run nothing fancy as a test, but a minimal example of Selenium with Firefox in headless mode only, for example minimal_selenium_test.py:



        import selenium.webdriver

        options = selenium.webdriver.FirefoxOptions()
        options.add_argument("--headless")

        driver = selenium.webdriver.Firefox(firefox_options=options)
        driver.get('https://www.python.org/')
        print(driver.title)
        driver.close()


        This should work on your local laptop as well as on a virtual server as well as inside a Docker container and should print:



        $ python3 minimal_selenium_test.py 
        Welcome to Python.org





        share|improve this answer















        This is at least a partial answer to your question.




        • Status code -11 means that subprocess experiences a segmentation fault. Read more about it at Determining if a python subprocess segmentation faults




        In the past, there were some problems with certain versions of Selenium not working well together with certain versions of Firefox and/or geckodriver. Find out your versions, update them to the most recent versions if possible and look for existing bug reports for your versions.



        The following versions work well together on my Ubuntu 18.04 LTS Bionic Beaver system:





        • Check Python version



          $ python3 --version
          Python 3.6.7



        • Check Selenium version



          $ python3 -c "import selenium; print(selenium.__version__)"
          3.141.0



        • Check Firefox version



          $ firefox --version
          Mozilla Firefox 64.0



        • Check geckodriver version



          $ geckodriver --version
          geckodriver 0.23.0 ( 2018-10-04)

          The source code of this program is available from
          testing/geckodriver in https://hg.mozilla.org/mozilla-central.

          This program is subject to the terms of the Mozilla Public License 2.0.
          You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.





        If you have to browse to a special path to make those commands work and those commands don't work directly in your terminal or virtual environment, you might need to set one of the following keyword arguments in your call to webdriver.Firefox:






        • firefox_binary – Instance of FirefoxBinary or full path to the Firefox binary. If undefined, the system default Firefox installation will be used.


        • executable_path – Full path to override which geckodriver binary to use for Firefox 47.0.1 and greater, which defaults to picking up the binary from the system path.






        Run nothing fancy as a test, but a minimal example of Selenium with Firefox in headless mode only, for example minimal_selenium_test.py:



        import selenium.webdriver

        options = selenium.webdriver.FirefoxOptions()
        options.add_argument("--headless")

        driver = selenium.webdriver.Firefox(firefox_options=options)
        driver.get('https://www.python.org/')
        print(driver.title)
        driver.close()


        This should work on your local laptop as well as on a virtual server as well as inside a Docker container and should print:



        $ python3 minimal_selenium_test.py 
        Welcome to Python.org






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 5 at 1:19

























        answered Jan 4 at 17:33









        finefootfinefoot

        2,81641936




        2,81641936
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014683%2fselenium-with-firefox-webdriver-results-in-error-service-geckodriver-unexpected%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            How to fix TextFormField cause rebuild widget in Flutter