Running headless Firefox or chrome in DigitalOcean












0














I am trying to run headless Chrome or Firefox in DigitalOcean and have tried alot of solutions but none seem to work.



The code works superb in my local system but in my DigitalOcean server it doesn't.



This is a test i am using to test headless Firefox



from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.firefox.options import Options


# print("open virtual display")
with Display():
print("open Firefox browser")
browser = webdriver.Firefox()
browser.set_window_size(1120, 550)

url = 'http://arbspiper.com/'
browser.get(url)

title = browser.title
print(title)
browser.quit()


The error i get is



Traceback (most recent call last):
File "firefox.py", line 9, in <module>
browser = webdriver.Firefox()
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException: Message: newSession


Mozilla Firefox 64.0
Selenium version (3.141.0)










share|improve this question


















  • 1




    What version of geckodriver are you using? You might need to upgrade it. github.com/SeleniumHQ/selenium/issues/6590
    – Manoj Kengudelu
    Nov 21 at 1:01










  • i was using v0.18. upgraded it to gekodriver 0.23.0 which is compatible with Mozilla Firefox 64.0 Selenium version (3.141.0). --Manoj you are awesome. Thank you so much.
    – Muhika Thomas
    Nov 21 at 11:05










  • Glad it worked out for you!
    – Manoj Kengudelu
    Nov 21 at 15:43
















0














I am trying to run headless Chrome or Firefox in DigitalOcean and have tried alot of solutions but none seem to work.



The code works superb in my local system but in my DigitalOcean server it doesn't.



This is a test i am using to test headless Firefox



from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.firefox.options import Options


# print("open virtual display")
with Display():
print("open Firefox browser")
browser = webdriver.Firefox()
browser.set_window_size(1120, 550)

url = 'http://arbspiper.com/'
browser.get(url)

title = browser.title
print(title)
browser.quit()


The error i get is



Traceback (most recent call last):
File "firefox.py", line 9, in <module>
browser = webdriver.Firefox()
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException: Message: newSession


Mozilla Firefox 64.0
Selenium version (3.141.0)










share|improve this question


















  • 1




    What version of geckodriver are you using? You might need to upgrade it. github.com/SeleniumHQ/selenium/issues/6590
    – Manoj Kengudelu
    Nov 21 at 1:01










  • i was using v0.18. upgraded it to gekodriver 0.23.0 which is compatible with Mozilla Firefox 64.0 Selenium version (3.141.0). --Manoj you are awesome. Thank you so much.
    – Muhika Thomas
    Nov 21 at 11:05










  • Glad it worked out for you!
    – Manoj Kengudelu
    Nov 21 at 15:43














0












0








0







I am trying to run headless Chrome or Firefox in DigitalOcean and have tried alot of solutions but none seem to work.



The code works superb in my local system but in my DigitalOcean server it doesn't.



This is a test i am using to test headless Firefox



from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.firefox.options import Options


# print("open virtual display")
with Display():
print("open Firefox browser")
browser = webdriver.Firefox()
browser.set_window_size(1120, 550)

url = 'http://arbspiper.com/'
browser.get(url)

title = browser.title
print(title)
browser.quit()


The error i get is



Traceback (most recent call last):
File "firefox.py", line 9, in <module>
browser = webdriver.Firefox()
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException: Message: newSession


Mozilla Firefox 64.0
Selenium version (3.141.0)










share|improve this question













I am trying to run headless Chrome or Firefox in DigitalOcean and have tried alot of solutions but none seem to work.



The code works superb in my local system but in my DigitalOcean server it doesn't.



This is a test i am using to test headless Firefox



from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.firefox.options import Options


# print("open virtual display")
with Display():
print("open Firefox browser")
browser = webdriver.Firefox()
browser.set_window_size(1120, 550)

url = 'http://arbspiper.com/'
browser.get(url)

title = browser.title
print(title)
browser.quit()


The error i get is



Traceback (most recent call last):
File "firefox.py", line 9, in <module>
browser = webdriver.Firefox()
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/arbspiper_project/env/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException: Message: newSession


Mozilla Firefox 64.0
Selenium version (3.141.0)







selenium selenium-webdriver web-scraping selenium-firefoxdriver






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 at 18:56









Muhika Thomas

243




243








  • 1




    What version of geckodriver are you using? You might need to upgrade it. github.com/SeleniumHQ/selenium/issues/6590
    – Manoj Kengudelu
    Nov 21 at 1:01










  • i was using v0.18. upgraded it to gekodriver 0.23.0 which is compatible with Mozilla Firefox 64.0 Selenium version (3.141.0). --Manoj you are awesome. Thank you so much.
    – Muhika Thomas
    Nov 21 at 11:05










  • Glad it worked out for you!
    – Manoj Kengudelu
    Nov 21 at 15:43














  • 1




    What version of geckodriver are you using? You might need to upgrade it. github.com/SeleniumHQ/selenium/issues/6590
    – Manoj Kengudelu
    Nov 21 at 1:01










  • i was using v0.18. upgraded it to gekodriver 0.23.0 which is compatible with Mozilla Firefox 64.0 Selenium version (3.141.0). --Manoj you are awesome. Thank you so much.
    – Muhika Thomas
    Nov 21 at 11:05










  • Glad it worked out for you!
    – Manoj Kengudelu
    Nov 21 at 15:43








1




1




What version of geckodriver are you using? You might need to upgrade it. github.com/SeleniumHQ/selenium/issues/6590
– Manoj Kengudelu
Nov 21 at 1:01




What version of geckodriver are you using? You might need to upgrade it. github.com/SeleniumHQ/selenium/issues/6590
– Manoj Kengudelu
Nov 21 at 1:01












i was using v0.18. upgraded it to gekodriver 0.23.0 which is compatible with Mozilla Firefox 64.0 Selenium version (3.141.0). --Manoj you are awesome. Thank you so much.
– Muhika Thomas
Nov 21 at 11:05




i was using v0.18. upgraded it to gekodriver 0.23.0 which is compatible with Mozilla Firefox 64.0 Selenium version (3.141.0). --Manoj you are awesome. Thank you so much.
– Muhika Thomas
Nov 21 at 11:05












Glad it worked out for you!
– Manoj Kengudelu
Nov 21 at 15:43




Glad it worked out for you!
– Manoj Kengudelu
Nov 21 at 15:43












1 Answer
1






active

oldest

votes


















0














answer from Manoj Kengudelu's comment.



gekodriver has to be compatible with ther version of firefox you are using.
check out supported platforms table here



once you found the gekodriver you would like to use you can download it, make it executable and add it to path.



Thanks again: Manoj Kengudelu






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%2f53399741%2frunning-headless-firefox-or-chrome-in-digitalocean%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









    0














    answer from Manoj Kengudelu's comment.



    gekodriver has to be compatible with ther version of firefox you are using.
    check out supported platforms table here



    once you found the gekodriver you would like to use you can download it, make it executable and add it to path.



    Thanks again: Manoj Kengudelu






    share|improve this answer


























      0














      answer from Manoj Kengudelu's comment.



      gekodriver has to be compatible with ther version of firefox you are using.
      check out supported platforms table here



      once you found the gekodriver you would like to use you can download it, make it executable and add it to path.



      Thanks again: Manoj Kengudelu






      share|improve this answer
























        0












        0








        0






        answer from Manoj Kengudelu's comment.



        gekodriver has to be compatible with ther version of firefox you are using.
        check out supported platforms table here



        once you found the gekodriver you would like to use you can download it, make it executable and add it to path.



        Thanks again: Manoj Kengudelu






        share|improve this answer












        answer from Manoj Kengudelu's comment.



        gekodriver has to be compatible with ther version of firefox you are using.
        check out supported platforms table here



        once you found the gekodriver you would like to use you can download it, make it executable and add it to path.



        Thanks again: Manoj Kengudelu







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 at 11:09









        Muhika Thomas

        243




        243






























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f53399741%2frunning-headless-firefox-or-chrome-in-digitalocean%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

            Wiesbaden

            Marschland

            Dieringhausen