Forums

Activate headless Chrome on my account

Hi there,

I've been having issues with virtual displays when using Selenium and saw that you activated headless Chrome on another account on this post:

https://eu.pythonanywhere.com/forums/topic/16/#id_post_46

Could you do the same for my account?

Thanks!

No problem. I have updated your account.

Thanks!

About activation of Chrome headless in my account

could you please activate chrome in my account ?

Sure, we have tweaked that for you. Any new consoles that you start / webapps that you reload / tasks that restart etc will be in the new name space. You can check this by doing a ps in it. This will not error (old consoles will say you don't have the permissions to do so).

Please note that because you are still on an old system image, you may have to build the chrome binary yourself unless you also switch that over- but that will require you to rebuild your virtualenvs and may break your code since library versions would have changed.

Good evening, could you activate chrome browser in my account aswell? Thank you!

OK, vaska1234, it's done for you.

Hello, Could you please do the same for my account as well? FirefoxDriver is not working on my code.

Just for clarity -- with our new system, we strongly advise you to use Chrome in headless mode, not Firefox -- Chrome tends to be more reliable. With that said, the new virtualisation system is now active for your account. Any new consoles you start will use the new system, scheduled tasks will pick it up the next time they run, and websites/always-on tasks the next time they're restarted.

You'll need to upgrade Selenium to the most recent version for the version of Python that you're using, eg. "pip install --upgrade selenium" if you're using a virtualenv, or "pip3.7 install --user --upgrade selenium" to upgrade it for Python 3.7 if you're not).

Once that's done, this sample code might be useful:

            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")
                return "Page title was '{}'".format(browser.title)

            finally:
                browser.quit()

Hello there! Could you also activate chrome browser for my account? Not sure how to (and if it is even possible) to build Chrome binaries from the console.

Thanks giles!! Your sample code works on my account.
But when I replace "https://www.google.com" with "https://www.amazon.com" or "https://www.microsoft.com/en-us", browser.title becomes null.
Would you happen to know the difference between them and how to solve this issue?

You have a free account. You can only access sites on the whitelist: https://www.pythonanywhere.com/whitelist/

@glenn Oh, I see. Thank you for your information.

Hi giles, may I enable my account as well? Also, is it necessary to have chromedriver uploaded? If so, for what OS? Thank you

No problem. I have updated your account. There is a chromedriver already installed and available.

Okay, this is what I'm getting:

>>> import selenium
>>> from selenium import webdriver
>>> chrome_options = webdriver.ChromeOptions()
>>> chrome_options.add_argument("--headless")
>>> chrome_options.add_argument("--disable-gpu")
>>> browser = webdriver.Chrome(options=chrome_options)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/samcha/.local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __i
nit__
    desired_capabilities=desired_capabilities)
  File "/home/samcha/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __
init__
    self.start_session(capabilities, browser_profile)
  File "/home/samcha/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in st
art_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/samcha/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in ex
ecute
    self.error_handler.check_response(response)
  File "/home/samcha/.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: 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 a
ssuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1095-aw
s x86_64)

Is there something I can do on my end to get past this point? Thank you very much.

I have enabled the new virtualisation system for your account. So, in a new console, the headless option should now work.

Excellent, thank you very much!

About activation of Chrome headless in my account could you please activate chrome in my account ? I am using chrome 80 stable version. I am facing below error: selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist)

You'll need to use the version of Chrome that we have pre-installed rather than one that you installed yourself, unless you also want to keep Chromedriver up-to-date. But your account has Chrome 78 installed, which is pretty recent.

In order to make it work, 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()

Just stumbled across this thread, could I have chrome activated for my account? Thanks.

Sure! That's done now. See my last post on this thread for the next steps.

It is still saying 'chromedriver' executable needs to be in PATH, as in this thread

I am not seeing chromedriver in /usr/local/bin. Anything else that needs to be upgraded in order for this to work is fine with me.

Please note that because you are still on an old system image, you may have to build the chrome binary yourself unless you also switch that over- but that will require you to rebuild your virtualenvs and may break your code since library versions would have changed. Let us know if you want us to switch you over to the latest system image (it will also add python 3.7 and 3.8 to your account)

Are there instructions anywhere on how to build the chrome binary myself? Do I need to download a specific version?

You can't build Chrome yourself (it's Google proprietary), but you can build Chromium, the open-source base of Chrome. Instructions should be on the Internet. You may also be able to download either Chrome or Chromium binaries for Ubuntu 64bit and then install it into your home directory.

I have tried installing it myself but I am getting the same error as samcha above. So I guess I need to go with the new system image then?

It looks that way. Would you like us to update your system image?

yes please

No problem. That's done.

Just come across this topic, would love to try headless chrome too. Can I try?

@adminviczo, it's done for you.

Thank you very much!

Good evening, could you activate chrome browser in my account too? Thank you!

I have responded to your post in the other thread.

Hi, can you please activate chrome in my account? Thanks!

Sure, I have done that for you. You will have to restart your consoles/reload your webapps etc for the change to take place.

>>> import selenium >>> from selenium import webdriver >>> chrome_options = webdriver.ChromeOptions() >>> chrome_options.add_argument("--headless") >>> chrome_options.add_argument("--disable-gpu") >>> browser = webdriver.Chrome(options=chrome_options) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__ desired_capabilities=desired_capabilities) File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/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: 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) >>> from webdriver_manager.chrome import ChromeDriverManager >>> driver = webdriver.Chrome(ChromeDriverManager().install(),options = options) /bin/sh: 1: google-chrome: not found Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/webdriver_manager/chrome.py", line 24, in install driver_path = self.download_driver(self.driver) File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/webdriver_manager/manager.py", line 32, in download_driver driver_version, is_latest = self.__get_version_to_download(driver) File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/webdriver_manager/manager.py", line 23, in __get_version_to_download return self.__get_latest_driver_version(driver), True File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/webdriver_manager/manager.py", line 17, in __get_latest_driver_version return driver.get_latest_release_version() File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/webdriver_manager/driver.py", line 54, in get_latest_release_version self._latest_release_url + '_' + chrome_version()) File "/home/venky6888/.virtualenvs/mydjanproj/lib/python3.6/site-packages/webdriver_manager/utils.py", line 98, in chrome_version .format(cmd) ValueError: Could not get version for Chrome with this command: google-chrome --version Getting this error can you activate chrome on my account? Thanks!

@venky6888, it's done for you

Hi, can you please activate chrome in my account? Thanks!

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hi, I have the same issue, can you please activate chrome in my account? Thanks a lot!

Error running WSGI application 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.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1100-aws x86_64)

driver = webdriver.Chrome(options=chrome_options) File "/home/nipunhedaoo/.local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in init desired_capabilities=desired_capabilities) File "/home/nipunhedaoo/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__self.start_session(capabilities, browser_profile) File "/home/nipunhedaoo/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/nipunhedaoo/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response File "/home/nipunhedaoo/.local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace)

I'm getting these errors. I've changed the code as you've given in previous comments, can you help? Thanks

@YuliaArKa - no problem that's done

@nipunhedaoo - It looks like you were leaving processes lying around so you got to a point where you had so many processes that you could not start any more. I have killed those processes for you, so you should have more success now. Also, make sure that you are trying to run the code in a console that was created after the account change.

Hi, I have the same issue, can you please activate chrome in my account? Thanks a lot!

No problem. I have updated your account.

Hi, I have the same issue, can you please activate chrome in my account? Thanks a lot!

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hi , I want to use Selenium with Headless Chrome on your server with my account . Can you please enable the access to use it ?

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

could you please activate chrome browser in my account?

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

hello, please enable for me also

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

to access kite.trade which is already supported in your list, should i need to purchase subscription plan?

If a site is in the whitelist, then you don't need a paid account to access it. However, the whitelist only covers APIs, so for the site you mention, api.kite.trade is on the whitelist, but kite.trade is not.

Hi, Can you activate chrome in my account?

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Please activate chrome in my account.

Hi, can you please activate chrome in my account?

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hello, Can you please activate chrome in my account as well. :)

Sure, I've done that for you.

hey, can u activate chrome for my account? its need for my bot :(

Hi, can you please activate chrome in my account? Thanks!

@IIIAYPMA228 -- the new virtualization system is already active on your account -- perhaps you contacted one of my colleagues over some other channel?

@colony66694 -- no problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hello, Giles et. al. Is it possible for me to to have Chrome activated for my account?

If it already is, when I try to run browser = webdriver.Chrome(options=chrome_options) I am getting a TypeError: __init__() got an unexpected keyword argument 'options'

Any assistance on this? Thanks!

sure, I just turned that on for you. For that particular error though, it seems like there may be a selenium version mismatch.

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)

Hey is it a error due to not activated account ?? can you please do that

@Itzkartik I activated it for you.

Hi, could you activate Chrome in my account?

sure, we've switched that on for you

Hello, could you activate Chrome in my account? Thanks!

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hello, could you please enable Chrome for me?

I have 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.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1100-aws x86_64)

sure, I've turned that on for you.

Hi Conrad,

Please could you activate the chrome driver on my account? Im getting the following error: init() got an unexpected keyword argument 'options'

Thanks,

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hello. Would you please enable the chrome browser for my account? I have the crashing problem as well.

Ok. I have enabled it for your account.

Please activate headless chrome on my account

I have responded to your other post.

Hi there! Could you also activate chrome browser for my account? thx!

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hi! Could you also activate chrome browser for my account?

Hi, I request Chrome browser to be activated for my account as well please. I'm trying to scrape a thing from http://www.salt-partners.com/ but I keep getting following 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- 1106-aws x86_64

I did it for you, but you have to know, that with the free account your options will be very limited.

When downloading a file through headless Chrome, where does it end up in Python Anywhere? I used the following code, but the file does not seem to end up there even though my code runs without error.

prefs = {"download.default_directory" : '/files/home/user/temp'}
chrome_options.add_experimental_option('prefs', prefs)

Is '/files/home/user/temp' the exact path that you're using? That wouldn't work, it would need to be a full Linux path, like '/home/smircovich/something'

Below is the exact code I am using, but the file downloaded in the script is not ending up in the temp directory I created:

prefs = {"download.default_directory" : '/home/smircovich/temp'}
chrome_options.add_experimental_option('prefs', prefs)

What if you try with trailing /

?

Hi, could I get Chrome browser enabled for my Selenium please?

Have responded to the new post you made here

Hello, can you please enable the headless Chrome for my selenium too, please?

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hi, can you please enable the headless Chrome for my selenium too, please? Thank you in advance!

No problem, that's done now

Can you please install chrome google stable so that webdriver_manager can do his magic

The chrome that is available in your account is the most recent that we currently have.

Hi, can you please enable the headless Chrome for my selenium too, please? Thank you in advance!

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hi, can you please enable the headless Chrome for my selenium too, please? Thank you in advance!

@newfiepicks No problem. It's done for you.

Hello , could you please enable the headless Chrome for my selenium ? And also I would like to know what happened with cookies?

Hello there could you please enable headless Chrome for my selenium? I would like to get some data from google. Thank you!

@sinfsr, flaskgmscaper -- no problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Also, @sinfsr -- not sure what you mean about cookies...?

I Getting this unfortunately "The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed."

It seems it's because I have a free account.. I have one question that can I run a .py in another web hosting (like heroku) and import that here??

Both should running nun-stop

It seems I need to a direction on my account like (home/usn/bla.py imported from url or st.)

@giles

headless chrome does not appear to be working on mine either. Could I get it activated for my account? Thank you!

@smith7929 no problem, that's activated for your account and will work in new consoles. See my earlier post for the next steps you need to take to use it.

@sinfsr -- no, I don't think the problem is because you have a free account -- Chrome should work fine. What happens if you run the minimal Chrome script in my previous post?

Regarding running a Python script in one hosting platform and importing it from another -- do you mean that you'd like to run the code there, and then get the results in some other code running here? You'd need to set things up on the other platform so that it ran as a website, or something like that, and then access that site from your code here.

I copied exactly what you write and gotten the error i wrote. ( And been come so sad). I have access to go to any websites , Find items , Click , And get data , With free account?

This! And This : chrome not reachable (Session info: headless chrome=78.0.3904.70)

from selenium import webdriver
    import time


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

    driver.get("http://www.tsetmc.com/")


    time.sleep(3)
    text = driver.find_element_by_tag_name("body").text
    print(text)

You have a free account. Free accounts can only connect out of PythonAnywhere to a whitelist of sites. If the site has a publicly documented API, send us a link to the API documentation and we'll consider it for the whitelist.

I said that before genius man.

Again, what happens if you run the code that was in my previous post? The code you posted has a different URL.

I just never minded , God bless you all

Hello giles , could you activate chrome browser in my account as well? Thank you!

No problem. I have updated your account and it will work in new consoles. See the earlier post for the next steps you need to take to use it.

Could you activate it on my account too?

Could I get it activated for my account? Thank you!

@dadukhankevin -- it's already active for your account.

@jonathansst -- no problem, that's done now -- see my earlier post for the next steps you need to take to use it.

hi @giles — Can you activate it for my account please?

No problem. It's done for you.

hi @giles -- Can you activate it for my account please? Thanks in advance!

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hi @giles — I am receiving the same exact error as @samcha. Can you enable the new virtualization system on my account as well?

hmm- you already do have that enabled

Hi! Can you please enable chrome on my account too? Thanks in advance!

@phonedhaba It's done for you.

Hi! Can you please enable chrome on my account too?

It's done for you

Hi! Can you please enable chrome on my account too?

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Hello, I have been trying to work chrome but I get this error ValueError: Could not get version for Chrome with this command: google-chrome --version || google-chrome-stable --version

is it possible to activate my chromedriver as well? thank you very much

No problem. I have enabled it for your account.

Hi! Can you please enable chrome on my account as well? Thank you so much!

Your account is using an old system image that does not support it.We can update it for you, but it may break existing code and you may need to rebuild any virtualenvs that you are using. Let us know whether you'd like to go ahead with the update.

Yes, I'd like to have it updated. I'll rebuild the virtualenvs then. Thanks, I appreciate it!

You're welcome, it's done.

Can you please update the headless chrome on my end as well? I kept getting this error.

driver = webdriver.Chrome(options=chromeoptions)
TypeError: __init__() got an unexpected keyword argument 'options'

Thanks!

No problem, that's done now -- see my earlier post for the next steps you need to take to use it.

Could you activate the headless Chrome on my account as well

Hi, I have the same issue, can you please activate chrome in my account? Thanks a lot!

it's done for you.

Hello please activate chrome for me too.

No problem. I have activated it for your account.

Would you be so kind to do that for my account too? I'll need it for my next project. Thank you in advance!

No problem. It's done for you.

Can you do the same magic for me activating chrome? Thanks in advance!

The magic is done for you.

\'.
 \ '.                      .-****-.
  \  \                    *       _*
  _L__L_           _     * EVAL .'  *
  //~ ~           / /    *.___.'    *
  G   >           //     '.   APPLY.'
  / \\\\-------.,//        *.____.*
 / ' \\\______ |;3
|   \ \\      \//

Hi, please can you do the same operation for me? Thank you

Could you please activate chrome in my account? Thanks in advance!

@bettingdad & @gusriobr It's done for both of you.

Hi @fjl, I continue to have this error: TypeError: init() got an unexpected keyword argument 'options'.

What can I do?

Have you started a new console after I changed your features?

Ok, my python version is 3.8 so executing pip3.8 install --user --upgrade selenium, now it works. Thank you.

Great, glad you got it working!

Hi, could you please activate chrome in my account as well? Thanks in advance

NO problem. I have activated it for your account.

Thanks for the help @glenn! I only managed my webscraping code to work once, but since then every time i run it as a scheduled task I get the following error: selenium.common.exceptions.WebDriverException: Message: chrome not reachable.

May I also suggest updating the following page with info on headless chrome https://help.pythonanywhere.com/pages/selenium/

What happens in your code when you get that error?

The project gets all postings from an ad aggregator website. So at that step the code tries to wait for the first posting to be visible.

try:
            WebDriverWait(browser, 100).until(EC.visibility_of_element_located((By.CLASS_NAME, "ListingItemSequential-module__new")))
except TimeoutException as exception:
            print('no cars')

Also I just found another error in a different scheduled task that performs the same code:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created from tab crashed

It occurs when I try to start chrome with browser = webdriver.Chrome(options=chrome_options) Could it be the reason why chrome no longer works properly?

Whether the options you pass to Chrome may be causing problems will depend on the options that you're passing to it. Make sure you're using the ones that @giles shows above.

Can you please activate chrome on my account too! Right now the chrome driver isn't in my /usr/local/bin :(

Thank you

@mjgibbons3 I replied you in that post.

Can you please activate chrome on my account

@LikhachAlexander it's done for you.

Can you please activate chrome on my account?

It's done for you.

Can you please activate chrome on my account too?

No problem. I have activated it for your account.

Dear PythonAnywhere Staff,

Thank you again for enabling this feature on my account -- I can confirm it's working in bash (while I'm not using a virtualenv)...


virtualenv + chrome (issue persists)

Sorry if this is a really dumb question, how do I get this working in a invoked python virtualenv? I made my env in this manner (following steps mentioned here)...


mkvirtualenv app_in_py37 --python=/usr/bin/python3.7

When I run my python app/script (with all modules/libraries installed correctly in virutalenv), I get the error/Traceback of this:


Traceback (most recent call last):
  File "rapp_online_101.py", line 3226, in <module>
    driver = webdriver.Chrome()
  File "/home/guacamoleleader/.virtualenvs/rapp_py37/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/guacamoleleader/.virtualenvs/rapp_py37/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/guacamoleleader/.virtualenvs/rapp_py37/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/guacamoleleader/.virtualenvs/rapp_py37/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/guacamoleleader/.virtualenvs/rapp_py37/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: 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)

Apologies if this is a simple fix -- any help would be greatly appreciated!

UPDATE

Ignore what I said -- it works... I just need to "ONLY" use those options/parameters in the setup (my script was trying to do a few more things that caused the error above to show)

OK, glad you got it working! Out of interest, what ere the extra parameters that broke it?

could I have chrome activated for my account? Thanks.

It is already activated on your account

Hi guys, please activate Chrome in my account as well. Regards.

No problem. I have activated it for your account.

Hello, could you please activate chrome for my account? Thanks

No problem. I have activated it for your account.

Hi, could you activate chrome browser in my account aswell? Thank you!

thanks! we have activated that for you.

Hi, can you activate chrome browser in my account too? Thank you so much in advance

No problem. I have activated it for your account.

Thanks! Still getting ModuleNotFoundError: No module named 'webdriver_manager' on line 5 (see code below) Any idea on how to solve this issue?

import pandas as pd import numpy as np from selenium import webdriver from bs4 import BeautifulSoup from webdriver_manager.chrome import ChromeDriverManager import time from datetime import date import dateutil import os import lxml

Make sure you've install webdriver_manager into the version of Python that you're using to run your code: https://help.pythonanywhere.com/pages/InstallingNewModules/

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

No problem. I have activated that for your account.

Hello, I was wondering if I could have the Chrome browser activated on my account? Thank you!

Hey, can i also get headless chrome activated?

okay, we've done that! happy holidays and happy coding :)

Could you please activate chrome browser for my account. Thank you :)

No problem! That's done now and will be active in any new consoles you start. The next step is for you 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()

I also want chrome activated please

Sure, no problem -- that's done now. See my previous post for the next steps.

thank you! happy hollidays

And to you too!

I also want chrome activated please

thanks! we've switched that over for you.

thanks it works!!! happy holidays!!!

Great, thanks for confirming that :)

Hello, I asked a few weeks ago to have chrome activated for my account. But it still doesn't work, even if did exactly what it described in this post. Can someone check if it is really enabled in my account? Thanks!

Hi, can you please enable Chrome Headless for my account please? Thanks!

Hi @Fonzy59, it must have been some oversight on our part, sorry, it's enabled now.

Hi @Pafk Can I also get the feature enabled on my account?

Since this is such a frequent request, does the team plan on making it a self service feature of the platform anytime soon?

.

I think that's a good point , maybe it's complicated to implement... but i think it's also a good idea to have this as a feature you can enable.... Happy New Year to you all .... thank you soo much for making this software , much love to you all

.

also could i possibly have this feature enabled on my account too ? ... :)

@freddy57 It's done for you

Thank you so much ... Much love and all the best on the year ahead :)

And to you too :-)

I also want chrome activated please

Sure, no problem -- that's done now. See my previous post for the next steps.

Hello there! Could you also activate chrome browser for my account?

It is already activated for your account.

Hi, if I could also get chrome enabled for my account that'd be great. Thank you!

No problem, @bakichu77, it's done for you.

Hi, can you please activate chrome in my account? Thanks!

@teoein It's done for you

Can we not activate chrome our self. I would like to have it in my app as well. Thank you.

No problem. I have enabled it for your account.

Hello, please activate chrome for my account too thank you :)

That's done for you, @jiwasyk.

hello, i'm sorry to ask, but could you enable chrome for me as well`thank you :))

Sure, no problem -- that's done now. See my previous post for the next steps.

Hi, can you activate it in my account? Would be great, thanks for your work!!

No problem. I have enabled it for your account.

Hello Sir, Can you activate it for my account also? Thanks in advance! :)

@creature It's done for you

Hello, can you activate it for my account also?

Sure, no problem -- that's done now. See my previous post for the next steps.

Hello..please do the same for me too... :)

No problem. I have activated it for your account.

Hello, can you please activate it for my account also?

@temi95 It's already active for your account.

hello can you please activate it for my account?

@devinjcooley -- sure, it's done.

Hello, could you please activate it for my account, too?

Sure, no problem -- that's done now. See my previous post for the next steps.

Hi, can you please activate chrome in my account? Thanks!

Sure, no problem -- that's done now. See my previous post for the next steps.

Hey, can you activate chrome in my account please

Sure, no problem -- that's done now. See this post for the next steps.

Hey, can you activate chrome in my account please ?

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

Hello! Just stumbled across this thread, could I have chrome activated for my account? Thanks.

No problem. I have activated it for your account.

Hello, can I please have chrome activated in my account. Thanks

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

Hello, can I also have headless Chrome activated in my account? Thank you.

Hello, can I also have headless Chrome activated in my account? Thank you.

Sure, no problem -- that's done now. See my previous post for the next steps.

Can u activate headless chrome on my account as well please

Sure, no problem -- that's done now. See my previous post for the next steps.

Hi, could you please activate headless Chrome in my account as well? Thank you very much.

Hi @zihou. You already have it enabled. If you're getting some errors it's probably due to old version of selenium which ought to be upgraded.

Just to add to that -- my previous post explains how to upgrade Selenium to the right version.

Hi @pafk and @giles. Thank you all very much! It seems working. Cheers.

Thanks for confirming that!

Hi, I have the same problem but with the Firefox driver. Can this be activated for my account to resolve this or do I need to switch to using Chrome?

What problem are you seeing?

Hello! May I have headless chrome enabled for my account as well? Thank you!

No problem. I have enabled it for your account.

Hi, please enable headless Chrome for my account. Thank you

@JoSchmaltz. 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 first batches to be moved over to it.

Please enable headless Chrome for my account, thanks

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 first batches to be moved over to it.

Hi @senluiss -- we've enabled virtualization feature for you. Here are the next steps:

To use Chrome, 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()

Please enable headless Chrome for my account, thanks

hi there, you should already have the virtualization system enabled-- but if you are currently on an older system image, which means that you have older library versions etc. If you don't want to compile chrome yourself, you could switch to the newest system image.

Hi @JoSchmaltz -- we've enabled virtualization feature for you, to use selenium with headless chrome you need to update selenium.

Same request here. I just realized that that may be why I have been having so many issues with selenium

@nrs250 Your account has it already enabled.

Hi, I have the same issue, can you please activate chrome in my account? Thanks!

It's activated for your account already -- you just need to follow the steps in our previous post to use it.

Hello, I have the same issue, can you please activate chrome in my account? You will really help me , thanks for your time.

@bory -- it's been already activated for your account. If you get any errors, please follow the steps metioned in the post above.

Hello, could you please help activate chrome for my account? Thank you.

Hello, could you please help activate chrome for my account? Thank you.

you do already have everything activated, but you won't be able to easily use it because as a free user, you would only be able to access a whitelist instead of the unrestricted internet.

if you are seeing errors you need to upgrade the python selenium package

hello, could you please activate chrome for my account? i'm getting the 'DevToolsActive Port file doesn't exist' error like others above. thanks!

@joenasti -- you have it enabled; did you follow steps mentioned by Giles above?

@pafk, thank you! things seemed to work ok after I went a little extra with chromedriver options, still haven't rolled them back to see which ones are absolutely necessary...

but i really appreciate the quick support!

from selenium import webdriver

chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--verbose") chrome_options.add_argument("--remote-debugging-port=0") chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") chrome_options.add_argument('--disable-dev-shm-usage') browser = webdriver.Chrome(options=chrome_options) try: browser.get("https://www.google.com") print("Page title was '{}'".format(browser.title)) finally: browser.quit()

@joenasti Let us know if you need us again!

hello, could you please activate chrome for my account?

We're speaking on email and we'll carry on there

hello, could you please activate chrome for my account as well?

hello, could you please activate chrome for my account as well?

It's activated for your account already -- you just need to follow the steps in our previous post to use it.

Hello, can you please activate it for my account also?

It's activated for your account already

Hello, im trying to start browser within next code:

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

i get error:

>>> browser = webdriver.Chrome(options=chrome_options)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nikobu/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "/home/nikobu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/nikobu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/nikobu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/nikobu/.local/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
  (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.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.4.0-1038-aws x86_64)

or

>>> browser = webdriver.Chrome(options=chrome_options)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nikobu/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "/home/nikobu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/nikobu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/nikobu/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/nikobu/.local/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: 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-1038-aws x86_64)

what iam doing wrong?

Did you upgrade selenium?

Yes

17:58 ~ $ pip3 show selenium
Name: selenium
Version: 3.141.0

Could you try this in a new console and check if it reproduces?

now it works!

Thanks for confirming that.

Hi, could you please activate chromedriver for my account? Thanks!

It is already activated for your account. All accounts have it activated by default now.

could you activate chrome browser in my account too? Thank you!

@ALIALAHDAL -- it's already activated on all accounts.

could you activate chrome browser in my account too? Thank you!

@dreamfollower85 -- it's already activated on all accounts.

Can you please activate chromedriver for my account? I tried downloading webdriver manager several times but I still get import errors at the error log. A quick response would highly be appreciated.

Chromediriver is pre-installed. You do not need to install anything. We need more details about what you try to do and what happens.

@glenn Hi, I have the same issue, can you please activate chrome in my account? Thanks a lot!

/home/CarlosASC/ws.py:32: DeprecationWarning: use options instead of chrome_options driver = webdriver.Chrome(chrome_options=options) Traceback (most recent call last): File "/home/CarlosASC/ws.py", line 32, in <module> driver = webdriver.Chrome(chrome_options=options) File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in init RemoteWebDriver.init( File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init self.start_session(capabilities, browser_profile) File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.9/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: 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.)

Can someone help me to fix this error please

/home/CarlosASC/ws.py:32: DeprecationWarning: use options instead of chrome_options driver = webdriver.Chrome(chrome_options=options) Traceback (most recent call last): File "/home/CarlosASC/ws.py", line 32, in <module> driver = webdriver.Chrome(chrome_options=options) File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in init RemoteWebDriver.init( File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init self.start_session(capabilities, browser_profile) File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.9/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: 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.)

Can someone help me to fix this error please

Check out this help page on using Selenium -- I think you might be missing one of the options (specifically, "--no-sandbox") which is needed to run it on PythonAnywhere.

Hello ! I have the same issue, do we still need to ask for an access ?

@Kruegpy2 no need to enable anything for you. Just follow this help page on using Selenium

Can you please activate chromedriver for my account?

It is already activated for your account. All accounts have it activated by default now.

Upgraded selenium, but still get the following error while using Chromedriver:

File "/home/sanderfillet/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 286, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/sanderfillet/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 378, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/sanderfillet/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/home/sanderfillet/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, 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.)
Stacktrace:
#0 0x558a65a1be89 <unknown>

Can you please activate Chrome for me as well?

@sanderfillet it's already activated for all accounts. How are you running your script and do you use the settings we recommend on the help page.

after running below code:

import selenium
from selenium import webdriver
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()

I am getting below error, can you please enable chrome for me or advise other wise what could be the issue.

DEBUG:selenium.webdriver.remote.remote_connection:POST http://localhost:40337/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "chrome", "pageLoadStrategy": "normal", "goog:chromeOptions": {"extensions": [], "args": ["--headless", "--disable-gpu"]}}}}
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:40337
DEBUG:urllib3.connectionpool:http://localhost:40337 "POST /session HTTP/1.1" 500 352
DEBUG:selenium.webdriver.remote.remote_connection:Remote response: status=500 | data={"value":{"error":"unknown error","message":"unknown error: Chrome failed to start: exited abnormally.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)","stacktrace":"#0 0x564668767e89 \u003Cunknown>\n"}} | headers=HTTPHeaderDict({'Content-Length': '352', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG:selenium.webdriver.remote.remote_connection:Finished Request
---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
Input In [32], in <cell line: 6>()
      4 chrome_options.add_argument("--headless")
      5 chrome_options.add_argument("--disable-gpu")
----> 6 browser = webdriver.Chrome(options=chrome_options)
      8 try:
      9     browser.get("https://www.google.com")

File /usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py:70, in WebDriver.__init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, service, keep_alive)
     67 if not service:
     68     service = Service(executable_path, port, service_args, service_log_path)
---> 70 super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
     71                                 port, options,
     72                                 service_args, desired_capabilities,
     73                                 service_log_path, service, keep_alive)

File /usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py:92, in ChromiumDriver.__init__(self, browser_name, vendor_prefix, port, options, service_args, desired_capabilities, service_log_path, service, keep_alive)
     89 self.service.start()
     91 try:
---> 92     RemoteWebDriver.__init__(
     93         self,
     94         command_executor=ChromiumRemoteConnection(
     95             remote_server_addr=self.service.service_url,
     96             browser_name=browser_name, vendor_prefix=vendor_prefix,
     97             keep_alive=keep_alive, ignore_proxy=_ignore_proxy),
     98         options=options)
     99 except Exception:
    100     self.quit()

File /usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:275, in WebDriver.__init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
    273 self._authenticator_id = None
    274 self.start_client()
--> 275 self.start_session(capabilities, browser_profile)

File /usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:365, in WebDriver.start_session(self, capabilities, browser_profile)
    363 w3c_caps = _make_w3c_caps(capabilities)
    364 parameters = {"capabilities": w3c_caps}
--> 365 response = self.execute(Command.NEW_SESSION, parameters)
    366 if 'sessionId' not in response:
    367     response = response['value']

File /usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:430, in WebDriver.execute(self, driver_command, params)
    428 response = self.command_executor.execute(driver_command, params)
    429 if response:
--> 430     self.error_handler.check_response(response)
    431     response['value'] = self._unwrap_value(
    432         response.get('value', None))
    433     return response

File /usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:247, in ErrorHandler.check_response(self, response)
    245         alert_text = value['alert'].get('text')
    246     raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough here
--> 247 raise exception_class(message, screen, stacktrace)

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 0x564668767e89 <unknown>

[edited by admin]

I believe we already replied to you via email -- let's keep conversation in one place, @mahinder70.

Hi, could you please activate chromedriver for my account? Thanks!

It is already activated for all accounts. See https://help.pythonanywhere.com/pages/selenium/