I know, there are already some posts about the topic and I already checked them out:
e.g.: 1) https://help.pythonanywhere.com/pages/selenium/ 2) https://www.pythonanywhere.com/forums/topic/13460/ and several others.
As 2) suggests I downgraded Selenium to the latest version before 4.0.0 (3.141.0) via bash which worked fine.
Then I uploaded the given script from 1) and ran it in a console:
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()
The first (probably minor) issue is a "SyntaxError: EOL while scanning string literal" in line 4. I will probably sort that out at some point but to further simplify the process I reduced the code to the following:
from selenium import webdriver
browser = webdriver.Chrome()
try:
browser.get("https://www.google.com")
print("Page title was '{}'".format(browser.title))
finally:
browser.quit()
Yet, I still get the 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 is no longer running, so ChromeDriver is assuming that Chrome has crashed.)"
I'd appreciate some help and since it's my first post on any coding forum I ask for forgiveness in case of any unintended bad manners.