3

I have installed selenium and the chrome web driver and made it accessible via the path variable of my operating system (using Linux virtual machine on windows and python3). I run this simple code and get the below error. Any ideas as to what may cause this error?

Thanks in advance!

Selenium version installed: selenium-3.141.0 urllib3-1.25.8

Chrome driver installed (latest version for chrome browser 80) : ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882})

Chrome browser installed : Google Chrome 80.0.3987.132

Python version : Python 3.6.9

import selenium
from selenium import webdriver

options = webdriver.chrome.options.Options()

options.add_argument('--no-sandbox') 
options.add_argument('--disable-dev-shm-usage')

chromedriver = '/usr/bin/chromedriver'

print('test0') #is being printed

driver = webdriver.Chrome('/usr/bin/chromedriver',options=options)

print('test') #not being printed

driver.get('http:google.com')

Error message when running the code : The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.

Error message 2

When I try to run google-chrome with (sudo google-chrome) I get this message: [56:56:0316/235226.650275:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

Error message 3

I tried modifying the google-chrome file in the /usr/bin but it is read-only so the workaround I found online was to add the options '--no-sandbox' in my code above. But hasn't resolved the issue.

Resolved : had a python file named queue in working directory and had to rename it Error message

Nicole Douglas
  • 579
  • 4
  • 14
  • 1
    The code runs without error in my IDE, maybe you downloaded Selenium or the webdriver incorrectly? (Most likely the webdriver because the error is thrown on line 5 `driver=webdriver.Chrome()`) – noahjillson Mar 16 '20 at 02:18
  • The only visible difference between your code and mine (that I have noticed), is that I ran mine inside ```if __name__ == '__main__':```. Maybe this is the problem? If not, I'm not sure if I can help you out very much. – noahjillson Mar 16 '20 at 02:33
  • 1
    It seems like the solution may lie in one of these posts... (1)github.com/eternnoir/pyTelegramBotAPI/issues/298 and (2)github.com/python-zk/kazoo/issues/239. It seems like your error may be Linux specific. – noahjillson Mar 16 '20 at 02:52
  • Update the question with the error stack trace. – undetected Selenium Mar 16 '20 at 08:38
  • 1
    @noahjillson Thank you for the link. I had a script called Queue.py which interfered and once renaming it, it escaped that error. Now I have another error, that google chrome crashes. – Nicole Douglas Mar 16 '20 at 20:15
  • @NicoleDouglas happy to help, can you update/edit the post to include the new error and its traceback? – noahjillson Mar 16 '20 at 20:48
  • 1
    Im not 100% sure if this will solve all of your issues but it will certainly solve issues you will encounter later. You should create a class so that nothing selenium will need like the `driver.get()` call will go out of scope and get garbage collected. This way the page will stay open for an extended duration without it being closed through garbage collection. You Initialize the class as an Object and save it to a variable, and this will rid you of this issue. Hopefully it solves the problem you are having above but it may not. Either way I suggest you implement this to avoid later errors. – noahjillson Mar 16 '20 at 22:42

1 Answers1

2

Solution:

This error "AttributeError: 'LifoQueue' object has no attribute 'put' selenium webdriver" is caused by having in your working directory a file with the name Queue. Rename that.

For this error "The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed."

If you tried all possible solutions and still get issues then if you are using Linux virtual machine that seems to be causing the problem and I suggest to install docker desktop on windows and download a docker image with all the libraries you will be needing to run selenium apps .

Nicole Douglas
  • 579
  • 4
  • 14