Forums

How can I get chromedriver to work on my pythonanywhere file?

the selenium code with chrome driver runs fine on my local machine but when i run it from python anywhere bash console it shows this error Permission denied: '/home/teamip/mysite/chromedriver.exe' and During handling of the above exception, another exception occurred: raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable may have wrong permissions.

See https://help.pythonanywhere.com/pages/selenium/

self.options = webdriver.ChromeOptions() self.options.add_argument('--headless') self.options.add_argument('--disable-gpu') self.options.add_argument('--disable-dev-shm-usage') self.options.add_argument('--no-sandbox') self.options.add_argument('--ignore-certificate-errors') self.driver=webdriver.Chrome(executable_path=r'/home/teamip/mysite/chromedriver.exe',options=self.options)

this is my code..

i have installed the 3.141.0 version of selenium as given in above link but still getting same error.. and if i don't give executable path in the above code then its raising " exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created from tab crashed"

Remove the executable_path argument.

I have removed the executable_path argument in the above code but now its raising " exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created from tab crashed" (Session info: headless chrome=90.0.4430.212)

That sounds like the site that you're trying to access is crashing the browser. Unfortunately, there is nothing we can do about that.

the given example in this link https://help.pythonanywhere.com/pages/selenium/ is also showing the same error

If you're still going to the same site that caused the browser crash then it's something about the site.

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() I'm running this code and still getting "selenium.common.exceptions.SessionNotCreatedException: Message: session not created from tab crashed"this error

What version of selenium are you using?

Version: 3.141.0

What if you upgrade selenium?

I think the roo-cause is : the version of chrome and chromedriver are outdated (pythonanywhere provides version 90.0.4430.212). If pythonanywhere can provide the image which includes the latest chrome and chromedriver, it would work for users who ever encountered this kind of issues.

While the Chromium version we provide is a bit old, it should work fine with all major websites out there. The version of chromedriver that is installed is the version that matches Chromium.

Can I run selenium to login into webset through chromedriver. Can you please enable it for my account. I want to run it with.py script

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