About Chrome web drivers

Asked 2 years ago, Updated 2 years ago, 18 views

I'm trying to log in automatically with python, but I stumble when I start chrome using the Chrome web driver first.The implementation is done through Google collaboration.os is windows 10The chrome version is 98.0.4758.82, but the download page does not have the exact version, so I downloaded 98.0.4758.80.I tried to change the location of the code and exe file, but the error could not be resolved.What should I do?

!pip install selenium
from selenium import webdriver
from time import sleep

# Error here
browser=webdriver.Chrome(executable_path="/content/drive/MyDrive/chromedriver.exe")

Error

/usr/local/lib/python 3.7/dist-packages/ipykernel_launcher.py:1:DeprecationWarning:executable_path has been deprecated, please pass in a service object
  """Entry point for launching an IPython kernel.
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
/usr/local/lib/python 3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
     75 stdin = PIPE,
--- >76 creationflags=self.creationflags)
     77 except TypeError:

5 frames
PermissionError: [Errno13] Permission denied: '/content/drive/MyDrive/chromedriver.exe'

During handling of the above exception, another exception occurred:

WebDriverException Traceback (most recent call last)
/usr/local/lib/python 3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
     86 raise WebDriverException(
     87"%s' executable may have wrong permissions.%s"%(
--- >88os.path.basename (self.path), self.start_error_message)
     89                 )
     90 else:

WebDriverException: Message: 'chromedriver.exe' executable may have long permissions.Please see https://chromedriver.chromium.org/home

python

2022-09-30 10:41

1 Answers

If you want it to work with Google Collaboration, you will need to install and use ChromeDriver in your environment, Ubuntu.

The article around here shows how to do it.
[Python] Run Selenium on Google Collaboration
web scraping with Google Collaboration
Using chromedriver with Google Collaboration (September 2021)

I understand that the basics are to install ChromeDriver using the following command.
This will automatically set the permissions.

! apt install chromium-chromedriver

Some of the articles above have previously written about updating package information and copying installed ChromeDrivers, but if necessary, why not?


2022-09-30 10:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.