Forums

Splinter not working

Edit: I resolved the issue by running the Display context-manager. I did not think it was necessary for headless browsing.

I can't get Splinter to work from Pythonanywhere. I've read everything I can find about it on the forums, but I haven't seen any solutions.

Just trying to run the simple code below throws an error:

from splinter import Browser
browser = Browser()
browser.quit()

I get this error message:

    "The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.

I have also tried to run it with a chromedriver, but that got me another error. And based on what I could read in the forums, it seems like this isn't an option here. I also tried to do it like this:

from splinter import Browser

browser = Browser('firefox', headless=True)
browser.quit()

But this gives me this error message:

TypeError: __init__() got an unexpected keyword argument 'headless'

Edit: I resolved the issue by running the Display context-manager. I did not think it was necessary for headless browsing.

Glad you worked out a solution!

We do now have an option in beta which will allow you to use Chrome in headless mode. However, to make that work we could need to upgrade the system image associated with your account to our latest one, which isn't without risk: it would upgrade the point releases of Python, for example 3.7.0 to 3.7.5, and because of those changes, any virtualenvs you have might break -- and if you're not using virtualenvs, the pre-installed Python modules will be upgraded so that might break any code you have that relies on the old installed versions.

If you'd like to try that out, then let us know and we can upgrade your system image and enable the new virtualisation feature so that you can use headless Chrome -- I don't know if it would work with splinter, though.