Answer the question
In order to leave comments, you need to log in
How to run selenium from chrome on vds ubuntu server?
Good day, great Linux Gurus,
I turn to you for help . On a local machine, I created
an
instagram parser in a bunch of selenium chrome python beautifulsoup
.
Traceback (most recent call last):
File "instagram.py", line 10, in
driver = webdriver.Chrome()
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/chrome/webdriver .py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session( capabilities, browser_profile)
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321,in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.7/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/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
from bs4 import BeautifulSoup
from selenium import webdriver
driver=webdriver.Chrome()
driver.get('https://www.instagram.com/support_point/')
html=driver.page_source
soup=BeautifulSoup(html, 'html.parser')
items=soup.find_all('div', class_="v1Nh3")
driver.quit()
Answer the question
In order to leave comments, you need to log in
On the VPS server, add the following options to the script:
options = webdriver.ChromeOptions()
options.add_argument('headless')
options.add_argument('--no-sandbox')
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.add_argument('headless')
options.add_argument('--no-sandbox')
driver=webdriver.Chrome(options=options)
driver.get('https://www.instagram.com/support_point/')
print(driver.title)
driver.quit()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question