I want to run a python script on Linux. using selenium.
I'm getting an error and apparently it's caused by running with root privileges.
How to run python script in linux without root?
Error: Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
A common cause for Chrome to crash during startup is running Chrome as root
user (administrator
) on Linux. While it is possible to work around this issue by passing --no-sandbox
flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Chrome as a regular user instead.
My code:
op = Options()
op.add_argument('headless')
chromedriver = "/usr/bin/chromedriver"
driver = webdriver.Chrome(chromedriver, options=op)
url = '.......'
try: op.add_argument('headless'), but not solved. also others..
driver.get(url)