Forums

Chrome doesn't work with selenium

i'm having this error whenever i run selenim with Chrome:

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1100-aws x86_64)

We have a new, experimental way of sandboxing users that should allow you to use a more recent version of Chrome. Let us know if you'd like us to enable it for your account.

yes i would like to , thanks

Ok. I have enabled it for your account.

Hi, I have the same issue: selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1100-aws x86_64) Can you help me please?

Ah- okay, I have turned on that virtualization for you. You will have to restart your console/webapps etc for the change to take effect.

Hello, I have the same error. selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally   (unknown error: DevToolsActivePort file doesn't exist)   (The process started from chrome location / usr / bin / chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)   (Driver info: chromedriver = 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac), platform = Linux 4.4.0-1100-aws x86_64) What is the reason for this?

Our system does not support Chrome by default, it's something that we have to switch on for you. I've done that now, and as a next step, you'll need to upgrade Selenium for your account -- for example, if you're using Python 3.7, run this in Bash:

pip3.7 install --user --upgrade selenium

...and then you can run Selenium with Chrome using code like this:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))

finally:
    browser.quit()

hi, can you enable chrome for free versions for testing? thank you

I believe I've got a similar problem....

Here's my error: (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1100-aws x86_64)

I'm a new user, and intend to use Selenium and ChromeDriver. Based on the above, can you do the same for my account. Thanks, ds4573

No problem @zaheer, @outsidedog and @ds4573, I have enabled it for your account.

Hi am new as well can someone teach me how to install?

Could you give more details about what you're trying to do, and what problems you're having?

please enable chrome for me. thank you I have the following error while running my application WebDriverException at /new_search Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

OK -- I've switched that on, so if you follow the steps from my previous post then that will get Chrome working for you.

i followed previous post steps but still showing the same error. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Sorry, it looks like the setting was not actually applied. I have applied it now so it should work. Bear in mind, that if you're running the code in a console, you will need to start a new console for it to be applied and if you're running it in a web app, you will need to reload the web app.

I'm a new user, and intend to use Selenium and ChromeDriver. Based on the above, can you do the same for my account. Thanks, ifmeonline

OK -- I've switched that on, so if you follow the steps from my previous post then that will get Chrome working for you.

@giles

Hi, can you help me switch to the most recent system? I would like to use Selenium + ChromeDriver too. Thank you.

I'm a new user, and intend to use Selenium and ChromeDriver. Please activate me this

@theansweryang, @darerror Sure, I've switched that on for both of you, so if you follow the steps from my previous post then that will get Chrome working for you.

so. i have done this work (previous steps), but i still have unknown error: Chrome failed to start: crashed (unknown error: unable to discover open pages) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1100-aws x86_64)

Now i have: Message: session not created from tab crashed

Are you getting emails about processes in your account running of of memory and crashing?

can we use Selenium and ChromeDriver with free acount? If it is possible, please activate me this, else please tell me which paid account I should get.

It is possible, but keep in mind that with a free account, you can only access a whitelist of external sites that are public apis. So it may not work for your use case. If you still want to do that let us know and we will set you up.

Hello, you can also turn on the ChromeDriver for me.

Hello, I have the same error. selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location / usr / bin / chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver = 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac), platform = Linux 4.4.0-1100-aws x86_64) , can you enable the new version for me please?

Ok, @Shrik558 and @MutFild, I have enabled it for your accounts.

Hello, could you please turn on this thing for me? Thanks.

Ok. I have enabled it for your account.

browser = webdriver.Chrome(options=chrome_options) TypeError: init() got an unexpected keyword argument 'options'

OK -- I've switched on the new virtualization system for you, so if you follow the steps from my previous post then that will get Chrome working for you.

Hi, I was wondering if you could enable this feature for me as well. I'm having the same issues here.

Sure, I've turned that on for you.

Can I please have this turned on for me as well? I'm currently a free user, and testing Selenium + Chrome with the whitelist websites for now. Will move over to a paid account once I can verify that my code works.

Sure, we've turned that on for you.

Could you please turn the new virtualization on for me as well? so I can be able to run Chrome driver headless. Thank you very much

Sure! I've switched on the new virtualization system for you, so if you follow the steps from my previous post then that will get Chrome working for you.

I tried yesterday, either home or here, is Selenium have a problem???? Is there a tutorial?? Is my security blocking me??? how to check that???

Sure! I've switched on the new virtualization system for you, so if you follow the steps from my previous post then that will get Chrome working for you.

Wow! You guys have a lightning fast support, I'm super positively impressed! Thanks a lot

@Tsurubaso -- what problems are you seeing? The feature is switched on for your account, so as long as you've upgraded Selenium (see this post) it should all work fine.

@yall -- no problem! Glad to help.

Could you please turn the new virtualization on for me as well? so I can be able to run Chrome driver headless. Thank you very much

Your account is still on an old system image. To make it work we would have to update your system image, too. Switching to a new system image may break your code that was working on your old image. You will also need to rebuild any virtual environments you have created.

Ok sir, I have backed up my all resources it's ready to update. You can take action.

No problem. That's done. New consoles will use the new system and your web app will use it once it has been reloaded.

Hi!, please turn on the ChromeDriver for me.Thanks!

Your account will also need its system image to be changed in order to support Chromedriver. Your files and data will be unchanged, but it will change the point releases of Python (eg. 3.7.0 to 3.7.5), which might break any virtualenvs you have -- 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're happy for us to switch you over despite that, then let us know.

Hello, I also wanted to have the new virtualization on for me, I am trying to use Selenium to automate a task. Thanks!

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you.

Hi!, please turn on the ChromeDriver for me.Thanks!

Hi! I'm ready. Please turn on ChromeDriver. Thanks!

Hi, please turn on the ChromeDriver for me.Thanks!

No problem, @archproug and @blackhat0, I have enabled it for your accounts.

I upgraded to payed account. can you turn on the ChromeDriver for me to use selenium? Thank you.

Its enabled for you, @academicpost

HI! I have a free account. Could chrome be enabled for my account too? Thanks!

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you. It's worth noting, though, that from a free account you are still limited to the sites on our whitelist.

Я новый пользователь и собираюсь использовать Selenium и ChromeDriver. Исходя из вышеизложенного, можете ли вы подключить их для моей учетной записи. Спасибо 0310sawbuy0310

0310sawbuy0310 it's done for you.

выдает вот такую ошибку, с чем это может быть связано?

File "/home/0310sawbuy0310/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 86, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromiu m.org/chromedriver/home

You appear to be trying to use a chromedriver executable that is not the one that we have installed and you have not made it executable. Chromedriver is quite sensitive to versioning, so I would suggest not specifying the chromedriver in your code and use the one that is installed by default.

Hi!, please turn on the ChromeDriver for me. Thanks! I want to test just for now, then I will upgrade my account

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you. It's worth noting, though, that from a free account you are still limited to the sites on our whitelist.

I am also stuck on getting the chromedriver up and running. Mind activating mine account too? I'm currently testing and would like to use selenium with chromedriver to scrape Instagram. Is that possible?

hi ! please the same problem here please can you turn on the ChromeDriver for me. thanks in advance.

@Gissa and @kumarraj123, I have enabled it for your accounts.

which chrome version is installed here can u tell me?

Chromium 78.0.3904.70 Built on Ubuntu , running on Ubuntu 16.04

Hello, could you switch on this Chrome support for me?

Thanks!

No problem. I have enabled it for your account.

Hi, is it possible to activate Chrome support for me too? Thanks!

It's done for you.

Hi, could I have it enabled for me aswell? Thanks!

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you. It's worth noting, though, that from a free account you are still limited to the sites on our whitelist.

Please enable it for me too thanks!

Sure, no problem -- that's done now.

Please enable it for me too thanks!

No problem. It's done for you

Hi, please enable this for me, thanks in advance

@taipham It's done for you.

Hi, please enable this for me too)

@ell4me It's done for you as well.

Hi, i have a question, i am gonna use aroud 100-150 processes with multiprocessing,1 process include new initialization with webdriver. It means i'll have 150 processes with 150 different opened windows(webdrivers). How can i use this script on your servers and is it posible? And another question if it would be posible so i'll need to send 150 requests(driver.get("some site")) to only 1 site,how i understand i'll need to use proxies,right? And which driver can u recommended me, firefox or chrome,which work better on your servers with proxies etc. Thanks in advance.

A couple things to look out for:

  1. if you are free user, you can only access our whitelisted sites over http/https.
  2. depending on how memory intensive this is, it may run up against memory limits and be killed
  3. see this, the standard recommended solution, which is firefox, but also see this which will require us to switch it on for you, which is Chromium

@conrad Ок,thanks. And what paid plan are u recommended me for my tasks? And how many memory limit maximum can be use for 1 task so my process won't be kill? And last question,can i mesure how many memory used for only 1 task?

You can see the features that each account has on your account page and you can also use the "Customise your plan" to choose a specific set of features. The features you need will depend on your code.

Each process can use 3G of memory and there is no real way to measure your use except by experimenting to see when your processes get killed. You are much more likely to run into our process limit, which is 128 processes per user per server.

Hi, I am trying to use selenium with chrome driver but it's giving me an error. I suspect it's the chrome not being enabled. Can you enable chrome for me?

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you. It's worth noting, though, that from a free account you are still limited to the sites on our whitelist.

Hi, please enable this for me too) Thanks!

@codecompagnons It's done for you.

@pafk Thanks!

Hey ill try to use selenium and chromedriver and chromium on a linux ec2 machine and get always thsi error.

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromedriver is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Can you please help me too?

Hi there -- this is the forum for discussion and tech support for PythonAnywhere, an online hosting environment, so we can't really help with problems you're having on other systems. You may want to try posting your question on a general programming help site like Stack Overflow.

Hi, please enable this for me too) Thanks!

Привет, я хочу использовать selenium в моем проекте. Включите эту функцию для меня. заранее спасибо!

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you. It's worth noting, though, that from a free account you are still limited to the sites on our whitelist.

Thx

Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

Hey i am receiving this error, is there anything i can do?

Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

Hey i am receiving this error, is there anything i can do?

Hey sorry i opened a new terminal and i ran the code again and i am getting this error

selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: -11

is there anything i can do?

How does your code look like?

Okay i went to the terminal again and i got the same error as last time

selenium.common.exceptions.WebDriverException: Message: unknown error: failed to start a thread for the new session (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

import built-in & third-party modules

import os import zipfile import shutil

from os.path import sep from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.firefox.options import Options as Firefox_Options from selenium.webdriver.chrome.options import Options as Chrome_Options from instapy_chromedriver import binary_path from selenium.webdriver import Remote from webdriverdownloader import GeckoDriverDownloader

import InstaPy modules

from .util import interruption_handler from .util import highlight_print from .util import emergency_exit from .util import get_current_url from .util import check_authorization from .util import web_address_navigator from .file_manager import use_assets from .settings import Settings from .time_util import sleep

import exceptions

from selenium.common.exceptions import WebDriverException from selenium.common.exceptions import UnexpectedAlertPresentException

def get_geckodriver(): # prefer using geckodriver from path gecko_path = shutil.which("geckodriver") or shutil.which("geckodriver.exe") if gecko_path: return gecko_path

asset_path = use_assets()
gdd = GeckoDriverDownloader(asset_path, asset_path)
# skips download if already downloaded
sym_path = gdd.download_and_install()[1]
return sym_path

def create_chrome_extension(): ext_path = os.path.abspath(os.path.dirname(file) + sep + "chrome_extension") # safe into assets folder zip_file = use_assets() + sep + "extension.xpi"

files = ["manifest.json", "content.js", "arrive.js"]
with zipfile.ZipFile(zip_file, "w", zipfile.ZIP_DEFLATED, False) as zipf:
    for file in files:
        zipf.write(ext_path + sep + file, file)

return zip_file

def set_selenium_local_session( proxy_address, proxy_port, proxy_username, proxy_password, headless_browser, browser_profile_path, disable_image_load, page_delay, geckodriver_path, browser_executable_path, logfolder, logger, geckodriver_log_level, ): """Starts local session for a selenium server. Default case scenario."""

browser = None
err_msg = ""

# set Firefox Agent to mobile agent
user_agent = (
    "Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 "
    "(KHTML, like Gecko) FxiOS/18.1 Mobile/16B92 Safari/605.1.15"
)

# keep user_agent
Settings.user_agent = user_agent

chrome_options = Chrome_Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

if headless_browser:
    chrome_options.add_argument("-headless")

if browser_profile_path is not None:
    chrome_profile = webdriver.ChromeProfile(browser_profile_path)
else:
    driver = webdriver.Chrome()

if browser_executable_path is not None:
    chrome_options.binary = browser_executable_path

# set "info" by default
# set "trace" for debubging, Development only
chrome_options.log.level = geckodriver_log_level

# set English language
chrome_profile.set_preference("intl.accept_languages", "en-US")
chrome_profile.set_preference("general.useragent.override", user_agent)

if disable_image_load:
    # permissions.default.image = 2: Disable images load,
    # this setting can improve pageload & save bandwidth
    chrome_profile.set_preference("permissions.default.image", 2)

if proxy_address and proxy_port:
    chrome_profile.set_preference("network.proxy.type", 1)
    chrome_profile.set_preference("network.proxy.http", proxy_address)
    chrome_profile.set_preference("network.proxy.http_port", int(proxy_port))
    chrome_profile.set_preference("network.proxy.ssl", proxy_address)
    chrome_profile.set_preference("network.proxy.ssl_port", int(proxy_port))

# mute audio while watching stories
chrome_profile.set_preference("media.volume_scale", "0.0")

# prevent Hide Selenium Extension: error
chrome_profile.set_preference("dom.webdriver.enabled", False)
chrome_profile.set_preference("useAutomationExtension", False)
chrome_profile.set_preference("general.platform.override", "iPhone")
chrome_profile.update_preferences()

# geckodriver log in specific user logfolder
geckodriver_log = "{}geckodriver.log".format(logfolder)

# prefer user path before downloaded one
driver_path = geckodriver_path or get_geckodriver()
browser = webdriver.Chrome(
    chrome_profile=chrome_profile,
    executable_path=driver_path,
    log_path=geckodriver_log,
    options=chrome_options,
)

# add extenions to hide selenium
browser.install_addon(create_chrome_extension(), temporary=True)

# converts to custom browser
# browser = convert_selenium_browser(browser)

# authenticate with popup alert window
if proxy_username and proxy_password:
    proxy_authentication(browser, logger, proxy_username, proxy_password)

browser.implicitly_wait(page_delay)

# set mobile viewport (iPhone X)
try:
    browser.set_window_size(375, 812)
except UnexpectedAlertPresentException as exc:
    logger.exception(
        "Unexpected alert on resizing web browser!\n\t"
        "{}".format(str(exc).encode("utf-8"))
    )
    close_browser(browser, False, logger)
    return browser, "Unexpected alert on browser resize"

message = "Session started!"
highlight_print("browser", message, "initialization", "info", logger)

return browser, err_msg

def proxy_authentication(browser, logger, proxy_username, proxy_password): """ Authenticate proxy using popup alert window """

# FIXME: https://github.com/SeleniumHQ/selenium/issues/7239
# this feauture is not working anymore due to the Selenium bug report above
logger.warn(
    "Proxy Authentication is not working anymore due to the Selenium bug "
    "report: https://github.com/SeleniumHQ/selenium/issues/7239"
)

try:
    # sleep(1) is enough, sleep(2) is to make sure we
    # give time to the popup windows
    sleep(2)
    alert_popup = browser.switch_to_alert()
    alert_popup.send_keys(
        "{username}{tab}{password}{tab}".format(
            username=proxy_username, tab=Keys.TAB, password=proxy_password
        )
    )
    alert_popup.accept()
except Exception:
    logger.warn("Unable to proxy authenticate")

def close_browser(browser, threaded_session, logger): with interruption_handler(threaded=threaded_session): # delete cookies try: browser.delete_all_cookies() except Exception as exc: if isinstance(exc, WebDriverException): logger.exception( "Error occurred while deleting cookies " "from web browser!\n\t{}".format(str(exc).encode("utf-8")) )

    # close web browser
    try:
        browser.quit()
    except Exception as exc:
        if isinstance(exc, WebDriverException):
            logger.exception(
                "Error occurred while "
                "closing web browser!\n\t{}".format(str(exc).encode("utf-8"))
            )

def retry(max_retry_count=3, start_page=None): """ Decorator which refreshes the page and tries to execute the function again. Use it like that: @retry() => the '()' are important because its a decorator with params. """

def real_decorator(org_func):
    def wrapper(*args, **kwargs):
        browser = None
        _start_page = start_page

        # try to find instance of a browser in the arguments
        # all webdriver classes (chrome, firefox, ...) inherit from Remote class
        for arg in args:
            if not isinstance(arg, Remote):
                continue

            browser = arg
            break

        else:
            for _, value in kwargs.items():
                if not isinstance(value, Remote):
                    continue

                browser = value
                break

        if not browser:
            print("not able to find browser in parameters!")
            return org_func(*args, **kwargs)

        if max_retry_count == 0:
            print("max retry count is set to 0, this function is useless right now")
            return org_func(*args, **kwargs)

        # get current page if none is given
        if not start_page:
            _start_page = browser.current_url

        rv = None
        retry_count = 0
        while True:
            try:
                rv = org_func(*args, **kwargs)
                break
            except Exception as e:
                # TODO: maybe handle only certain exceptions here
                retry_count += 1

                # if above max retries => throw original exception
                if retry_count > max_retry_count:
                    raise e

                rv = None

                # refresh page
                browser.get(_start_page)

        return rv

    return wrapper

return real_decorator

class custom_browser(Remote): """ Custom browser instance for manupulation later on """

def find_element_by_xpath(self, *args, **kwargs):
    """ example usage of hooking into built in functions """
    rv = super(custom_browser, self).find_element_by_xpath(*args, **kwargs)
    return rv

def wait_for_valid_connection(self, username, logger):
    counter = 0
    while True and counter < 10:
        sirens_wailing, emergency_state = emergency_exit(self, username, logger)
        if sirens_wailing and emergency_state == "not connected":
            logger.warning("there is no valid connection")
            counter += 1
            sleep(60)
        else:
            break

def wait_for_valid_authorization(self, username, logger):
    # save current page
    current_url = get_current_url(self)

    # stuck on invalid auth
    auth_method = "activity counts"
    counter = 0
    while True and counter < 10:
        login_state = check_authorization(self, username, auth_method, logger)
        if login_state is False:
            logger.warning("not logged in")
            counter += 1
            sleep(60)
        else:
            break

    # return to original page
    web_address_navigator(self, current_url)

def convert_selenium_browser(driver): """ Changed the class to our custom class """ driver.class = custom_browser return driver

This is the code is in browser.py file

can you enable chrome for me please

Sorry how do i enable chrome?

@yonataliasu13 we have turned on that virtualization for you- any new consoles you start will be able to run chrome.

@dewey you already have that virtualization turned on. I see that you pasted a lot of code a couple replies up. Could you try doing this, and using this simple code instead to see if it runs?

Hello! I have such error :

    unknown error: Chrome failed to start: crashed
      (unknown error: DevToolsActMessageivePort file doesn't exist)
      (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
      (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux
5.4.0-1020-aws x86_64)

I think that possibly chrome was not closed in the previous running. Can you check it for me, please? And how I can check it and fix? Chrome is available for my account

@MrGorsky Are you sure that it is running headless?

It is running not in headless mode. I tried to use it in this way (not headless), and my script worked, but later browser crashed and I saw this error. Can I use it without headless?

You can use it in non-headless mode, though it will run more slowly. How are you running the script -- is it from a console, or inside a website's code, or in a scheduled task?

I use it in scheduled tasks. I killed all running tasks in tab "Tasks", and now chrome works well. Thank you for your concern :)

Glad to hear you got it working!

Hello! I want to run one of my scripts in sheduled tasks using selenuim+chrome and other script using selenium+firefox? Is is possible to activate chromedriver and geckodriver both to my account? Now chrome is available for me.

At the moment we have an old version of firefox available on the system, and it misbehaves. That's why we recommend chrome and suggest the activation of experimental features required to run it (it's already done for you). As far as I know, nothing (apart from the general flakiness of the installed firefox) prevents you from running both.

Hi, can I also have Chrome enabled?

ok sure, we have enabled that for you.

Hi, can I also have Chrome enabled please? Thanks.

No problem, it's enabled for you @zparkar.

@pafk Hey, can you activate chrome browser in my account please? Thanks a lot!

No problem. I have activated it for your account.

Hey, can you activate chrome browser in my account please? Thanks a lot!

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you.

Hi, can I please have Chrome activated in my account too?

Sure, @henrydh, it's done for you.

Hi, can I please have Chrome activated in my account too? :) :) :)

@freddy57 It's done for you

Hey, could you please configure my account to be able to use Chrome too?

Appreciate it.

It looks like it is already enabled for your account.

Hey, could you please configure my account to be able to use Chrome too?

Appreciate it.

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you.

Please configure my account to be able to use Chrome with selenium, please

I see that you posted another thread about that, so I've answered there.

Hello!! I would like to run chrome webdriver too! Can it be switched on for me?

Hi, can you please enable my account to work with Chrome as well? Thanks!

@renatonm007 @jhollier It's done for both of you

Hi, I restarted all consoles, verified selenium was upgraded to the latest, and tried the sample code in the post from April 13, 2020 to verify but am still getting the classic error when trying to run chromedriver:

"(unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)"

Is it possible my account wasn't enabled?

@jhollier It is enabled for you. How do you configure your webdriver?

That examle code works:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))

finally:
    browser.quit()

You should also upgrade selenium with something like:

pip3.7 install --user --upgrade selenium

Interestingly, everything works great now with no changes. Anyway, thanks for the assistance :)

Thanks for letting us know!

can you please enable my account to work with chrome as well?

@devinjcooley -- I see you asked for this in several threads, already replied in another one.

I have received this error while attempting to use Selenium and chromedriver, could my account by changed for the new virtualization as well?:

Error Message: unknown error: Chrome failed to start: exited abnormally 
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 5.4.0-1020-aws x86_64)

I have enabled the following Selenium Webdriver settings for chromedriver:

options = ChromeOptions()
options.add_argument("--disable-gpu")
options.add_argument("--headless")

Thank you for your help.

Sure, no problem -- that's done now, and new consoles will be using it. If you follow the steps from my previous post then that will get Chrome working for you.

Hi can you please configure my account to also be used with Chrome Selenium? I am getting the following:

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

@atorresvt It's done for you

Hello, I got the following error message.

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

Could you help me to use Chrome for my account as well?

I see you posted in this forum thread too, so I'll reply there.

Hey support, I got the same error too, please enable chromedriver or virtualization (whatever it takes) for my account as well plz

selenium.common.exceptions.WebDriverException: Message: unknown error: 
Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser i
s no longer running, so ChromeDriver is assuming that Chrome has crashe
d.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d
2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

No problem. I have enabled it for your account.

hi, can you enable chrome for free versions for testing? thank you

No problem. I have enabled it for your account.

can you enable chrome for me as well?

Sure, we actually already have that enabled for you.

can you enable chrome for me as well?

Sure, we have enabled that for you

can you please enable chrome for me as well?

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

PLEASE ENABLE CHROME FOR ME

@Louisoft It's already done for you

Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1020-aws x86_64)

Can you please enabled it for me as well ?

Sure, no problem -- see my previous post for the next steps.

I'm a new user, and intend to use Selenium and ChromeDriver. Based on the above, can you do the same for my account. Thanks!

No problem. I have updated your account.

I had a Selenium / chromedriver setup working on my account as you have activated it in the past. Yesterday I have upgraded my account and now receive the same error message as the previous users. Could you please check if upgrading the account has somehow disabled chrome? Thank you!

No, the setting is still enabled on your account.

Can you enable for me?

Since our most recent deploy, we have to pause adding the feature for a while until we can switch everyone across.

Hi, I am facing the same problem and receiving this message Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist he process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome h as crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1029-aws x86_64

Can you please enable the selenium driver for me.

Thank you so much for all your help.

Hi @rashidanwar0146. We're currently in the process of enabling the new virtualization system for all accounts on PythonAnywhere, which unfortunately may take a week or two to complete. We'll let you know when that has been done for your account; I've made a note to make sure that you're in one of the next batches to be moved over to it.

@rashidanwar0146 that's done for you now; see my previous post for the next steps.

I'm a new user, and intend to use Selenium and ChromeDriver. Please activate me this

@bory -- I already replied to you in the other thread. If you still have problems, contact support@pythonanywhere.com providing us with more details.

I'm beginner, please enable chromedriver on my account

I'm beginner, please enable chromedriver on my account as well.

Hello, please enable ChromeDriver for me too. Thank you.

@ageronimo -- you need to update your system image to the most recent one first: https://help.pythonanywhere.com/pages/ChangingSystemImage/.

@reza16, @fabio8178 -- did you update Selenium as advised above? For example, if you're using Python 3.7, run this in Bash:

pip3.7 install --user --upgrade selenium

...and then you can run Selenium with Chrome using code like this:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)
try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))
finally:
    browser.quit()

@pafk I've updated system image to fishnchips and everything's working now. thank you!

@ageronimo -- excellent, thanks for confirming!

@giles @pafk Hello, can you enable please Chromedriver for me? Thanks!

It is already enabled by default for all accounts

Hi. I'm trying to get selenium to work, and can't seem to figure it out. Totally novice question, but when I run a python script that calls chrome, I get this error:

WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

I can't figure out a) what version of chromedriver I need, and b) where to put it? I tried putting it where the python file is and a few others areas, and nothing seems to work. Any ideas?

@tonysmall75 -- we already provide chromedriver executable with version matching installed Chrome, which is on PATH, so you don't need to specify that.

I'm a new user, and intend to use Selenium and ChromeDriver. Based on the above, can you do the same for my account and enable chrome for me Thanks!

VikP

It's enabled for all new accounts.

Hi there, can you activate my chrome as well please?

It's activated for all accounts now.

I am running glastonury and all packages are installed. when i try the example above I get the following error. Any ideas?

File "<stdin>", line 1, in <module> File "/home/tweetologist/mysite/Qatune/myscrape.py", line 27, in scrape browser = webdriver.Chrome(options=chrome_options) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in init desired_capabilities=desired_capabilities) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init self.start_session(capabilities, browser_profile) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed. (chrome not reachable) (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

How does your code look like? From the traceback, it looks like it's not identical to the one above.

Here is the code. Line 27 is browser = webdriver....................

def scrape(url):


       result=''
        chrome_options = webdriver.ChromeOptions()
        chrome_options.add_argument("--headless")
        chrome_options.add_argument("--disable-gpu")
        browser = webdriver.Chrome(options=chrome_options)
        try:
            result =browser.get("https://www.google.com")
            print("Page title was '{}'".format(browser.title))
        finally:
            browser.quit()
        return result

It works now!! Not sure what changed but thanks.

It works now!! Not sure what changed but thanks.

That looks like it should work fine. Have you tried running that in a newly created console?

It stopped working a few minutes ago with the following error. The cleanup/quit is in the code so memory should not be an issue but getting the error below:

   wd = webdriver.Chrome('chromedriver',options=options)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Don't pass 'chromedriver' as the first argument when you;re creating the webdriver. The first argument to webdriver.Chrome is the path to chromedriver, which is already on the path and, if you specify it incorrectly, like you did, then it will not work.

Hi Giles,

Can you please turn chrome on for my account. I've already subscribed to the Hacker account. I can't seem to run my .ipynb scripts.

Thank you very much!

Respectfully,

Jaca

Chrome is already enabled for your accounts, but it will not work well in notebooks.

Hi Glenn,

Is there a workaround on how to read .xlsx file in .py files. my chromedriver works perfectly fine when running my script in .py but whenever I try to do a pd.read_excel(), it returns an empty dataframe. I already tried adding engine='openpyxl', but the error still persists.

I apologize this post is unrelated to this thread.

Respectfully yours,

Jaca

Have you checked that there is actually data in the Excel file that you're trying to read with read_excel?

Yes Glenn, I downloaded it from my directories.

Yes Glenn, I downloaded it from my directory.

That doesn't necessarily mean that there is actually anything in the file. Have you checked that the file that you're reading actually has anything in it to import? Also, make sure that you're reading the file that you think you're reading: https://help.pythonanywhere.com/pages/NoSuchFileOrDirectory/

Hi, can you enable chrome for me? I am having an issue:

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Here's what I've been getting, and nothing from the forums seems to work:

Ignoring exception in on_ready
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 61, in on_ready
    driver=webdriver.Chrome(options=chrome_options)#####, service=s)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 93, in __init__
    RemoteWebDriver.__init__(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 266, in __init__
    self.start_session(capabilities, browser_profile)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 357, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 418, in execute
    self.error_handler.check_response(response)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed.
  (chrome not reachable)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x557dafc05919 <unknown>

What happens if you try to run the minimal Selenium example on this page?

That's the error I got with the minimal example. Here's my code #Setting up Chromium Settings chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")

        driver=webdriver.Chrome(options=chrome_options)
        try:
          driver.get("https://www.google.com")
          print("Page title was '{}'".format(driver.title))

        finally:
          driver.quit()

Maybe I'm having the wrong package? Is there a specific package I would need for chromium browser?

Do you run your code on PythonAnywwhere (the traceback above does not look like it's running on PythonAnywhere)

I am having the same error:

File "/home/eyal360/.virtualenvs/fbvenv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed (unknown error: unable to discover open pages) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.8.0-1041-aws x86_64)

What should be done?

@eyal360 -- can you run the simple code from our help page and check if that works for you?

Hi I also intend to use Selenium python and ChromeDriver. Based on the above, can you do the same for my account and enable chrome/ change needed settings for me? Thanks!

In fact, it is very time sensitive and I'm facing an issue with the driver despite best attempts:

**> (The process started from chrome location /usr/bin/chromium is no

longer running, so ChromeDriver is assuming that Chrome has crashed.)**

In fact, it is very time sensitive and I'm facing an issue with the driver despite best attempts:

**> (The process started from chrome location /usr/bin/chromium is no

longer running, so ChromeDriver is assuming that Chrome has crashed.)**

nevermind it's working fine now. no action required. My bad.

@EmmanuelTeferi1 Glad to hear that you made it work.

@fjl Hi, did you change anything lately with selenium or with chromedriver? My script works perfectly till end of Janury but since February i almost always have error:

Traceback (most recent call last): File "/home/myusername/path/file.py", line 48, in <module> driver.execute_script("arguments[0].perform();", show_phones[i + 1]) File "/home/myusername/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 878, in execute_script return self.execute(command, { File "/home/myusername/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 424, in execute self.error_handler.check_response(response) File "/home/myusername/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: session deleted because of page crashfrom tab crashed(Session infoheadless chrome=78.0.3904.70) Stacktrace: #0 0x0000005f4f1c <unknown> #1 0x000000506bc0 <unknown> #2 0x0000004fbe79 <unknown> #3 0x0000004fb87e <unknown> #4 0x0000004fb3f4 <unknown> #5 0x0000004faff7 <unknown> #6 0x0000004faf25 <unknown> #7 0x000000507ef3 <unknown> #8 0x0000004e631e <unknown> #9 0x0000004dd7c3 <unknown> #10 0x0000004bff98 <unknown> #11 0x0000004c0f42 <unknown> #12 0x00000059f4d9 <unknown> #13 0x00000059e6ee <unknown> #14 0x00000059ea82 <unknown> #15 0x0000005a10aa <unknown> #16 0x0000005b20f5 <unknown> #17 0x0000005d1266 <unknown> #18 0x0000005fcddd <unknown> #19 0x7f5296bbc6ba start_thread #20 0x7f52953cd41d clone

@fjl Hi, did you change anything lately with selenium or with chromedriver? My script works perfectly till end of Janury but since February i almost always have error:

Traceback (most recent call last): File "/home/myusername/path/file.py", line 48, in <module> driver.execute_script("arguments[0].perform();", show_phones[i + 1]) File "/home/myusername/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 878, in execute_script return self.execute(command, { File "/home/myusername/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 424, in execute self.error_handler.check_response(response) File "/home/myusername/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: session deleted because of page crashfrom tab crashed(Session infoheadless chrome=78.0.3904.70) Stacktrace: #0 0x0000005f4f1c <unknown> #1 0x000000506bc0 <unknown> #2 0x0000004fbe79 <unknown> #3 0x0000004fb87e <unknown> #4 0x0000004fb3f4 <unknown> #5 0x0000004faff7 <unknown> #6 0x0000004faf25 <unknown> #7 0x000000507ef3 <unknown> #8 0x0000004e631e <unknown> #9 0x0000004dd7c3 <unknown> #10 0x0000004bff98 <unknown> #11 0x0000004c0f42 <unknown> #12 0x00000059f4d9 <unknown> #13 0x00000059e6ee <unknown> #14 0x00000059ea82 <unknown> #15 0x0000005a10aa <unknown> #16 0x0000005b20f5 <unknown> #17 0x0000005d1266 <unknown> #18 0x0000005fcddd <unknown> #19 0x7f5296bbc6ba start_thread #20 0x7f52953cd41d clone

The most likely cause of that is that the page changed in some way that is causing Chrome to crash.

Ignore this post, just realized I already have this.

Hello, please enable ChromeDriver for me too. Thank you.

I have got this error message: selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Chromedriver is already enabled for all accounts. If you are in the tarpit, you are likely to get that error.

Hi,

What's happening here, something to enable manually?

I'm on latest available image (glastonbury) and can't run the sample code.

Error:

 13:04 ~/browser_stuff $ python3 first_test.py
    Traceback (most recent call last):
      File "first_test.py", line 8, in <module>
        browser = webdriver.Chrome(options=chrome_options)
      File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
        RemoteWebDriver.__init__(
      File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
        self.start_session(capabilities, browser_profile)
      File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
        response = self.execute(Command.NEW_SESSION, parameters)
      File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
        self.error_handler.check_response(response)
      File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
        raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
      (unknown error: DevToolsActivePort file doesn't exist)
      (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Sample code:

 from selenium import webdriver
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--disable-gpu")
    browser = webdriver.Chrome(options=chrome_options)
    try:
        browser.get("https://www.google.com")
        print("Page title was '{}'".format(browser.title))
    finally:
        browser.quit()

Selenium version(also tried latest):

pip3 list | grep selenium
selenium                         3.141.0

Where are you running that code -- is it in a console, a website's code, in a notebook, or an always-on or scheduled task?

Hi giles,

I'm running it from console (ssh).

Ah, that explains it -- Selenium unfortunately doesn't work in SSH or in Jupyter notebooks right now. We're planning to change that in the future, but for now you'll need to run it in one of our in-browser consoles, in a scheduled or always-on task, or inside a website's code.

Thank you for information. From browser console it works.

Excellent, thanks for confirming!

Hey support, I got the same error too, please enable chromedriver or virtualization (whatever it takes) for my account as well plz, thank you

It's already enabled for all accounts. Which error exactly do you have? Where are you running your selenium code on PythonAnywhere? Also -- is the sample code from this help page working for you?

I fixed my issue by adding:

import signal

signal.signal(signal.SIGCHLD, signal.SIG_IGN)

Because python-anywhere limits the amount of processes you can have running at once, if you are scraping numerous sites and using driver.quit() or closing chrome through a bash command, python (as the parent process) will retain some defunct processes for every chrome process that was open. If you do this enough time you will have too high a process count and chromedriver will refuse to open.

Running the 2 lines of code will ignore the default setting of retaining child processes until the parent is closed. However, if for some reason you need to retain these defunct processes, then this will cause other problems for you. It works for me, hope it works for you.

Glad to hear that you made it work!

can I please also have the chrome driver enabled for me? I need it to run selenium tests. Thanks.

It is already enabled for all accounts.

I'm facing similar issue

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Stacktrace:

0 0x55754b165e89 <unknown>

It used to work correctly until 25th Aug,22. Now I don't understand what the issue is

-

Same for me. A few days ago everything worked fine. Now the Python only works when I start it manually. In the Task I get the following error from the view task log:

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Stacktrace:

0 0x55560f027e89 <unknown>

The process list shows me: /home/"user"/.local/bin/python -m virtualenvwrapper.hook_loader --script /tmp/virtualenvwrapper-initialize-hook-uWNuIh6Cuu initialize and bash -l -c python3.9 /home/"user"/"FileName".py

are you able to run and example from https://help.pythonanywhere.com/pages/selenium/ Does your configuration matches the one from the example?

Yes I have the same configuration. When I start the example code manually the programm works just fine. When I make task that is executed hourly i get the following error:

Traceback (most recent call last):
  File "/home/NikNak92/Test_Selenium.py", line 8, in <module>
    browser.get("https://www.google.com")
  File "/home/NikNak92/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 437, in get
    self.execute(Command.GET, {'url': url})
  File "/home/NikNak92/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 425, in execute
    self.error_handler.check_response(response)
  File "/home/NikNak92/.local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: -0.167
  (Session info: headless chrome=90.0.4430.212)
Stacktrace:
#0 0x5622abb3ae89 <unknown>


2022-09-07 15:12:11 -- Completed task, took 306.38 seconds, return code was 1.

Hello, we have the same problem, sometime ago all work fine

 Traceback (most recent call last):
  File "/home/AndriiV/cs_cart/update_prices.py", line 6, in <module>
    browser = webdriver.Chrome(options=chrome_options)
  File "/home/AndriiV/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/home/AndriiV/.local/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
    super().__init__(
  File "/home/AndriiV/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 270, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/AndriiV/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 363, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/AndriiV/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 428, in execute
    self.error_handler.check_response(response)
  File "/home/AndriiV/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Missing or invalid capabilities
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.15.0-1017-aws x86_64)

@NikNak92 We added some capacity to our task infrastructure. Let us know if it is not fixed during your next task run.

@fjl perfekt the program is now also working in the task. Thank you.

Can you also turn on chromedriver for me?

It's available for everyone now. If something is not working for you, see this help page.

hi, can you enable chrome for me ?

@mzr2q It's available for everyone now. If something is not working for you, see this help page.

Can I please have this turned on for me as well? I'm currently a free user, and testing Selenium + Chrome with the whitelist websites for now.

It's available for everybody on PythonAnywhere now. See this help page.

Hi i get SessionNotCreatedException(Message: session not created from disconnected: unable to connect to renderer (Session info: headless chrome=90.0.4430.212) . I want to open a local html file and refrash it every 60 sec

Have you made sure that you are using the options in the help page that @pafk linked to above?

I get this error when i try to use selenium on my account: : Message: unknown error: Chrome failed to start: exited abnormally.

Have you follower these steps -- https://www.pythonanywhere.com/forums/topic/27124/#id_post_78316

It's easy to miss the --user on the pip install

Can you help me with this:

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Make sure you follow the set up mentioned in this help page and not start multiple browsers at a time.

I have the same setup mentioned in the help page, what do you mean by not starting multiple browsers at a time.

This is the issue that is happening :

selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_TUNNEL_CONNECTION_FAILED (Session info: headless chrome=90.0.4430.212) Stacktrace:

0 0x555ebb8a9e89 <unknown>

NO MATCH

You're using a free account -- are you trying to scrape a site which is not on the allow list?

Hi, I have the same problem (unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist), can you help me?

See https://help.pythonanywhere.com/pages/selenium/