【发布时间】:2022-01-20 12:38:19
【问题描述】:
我使用了 Google Collab 和浏览器 Edge,并用 selenuim 尝试了这段代码:
!wget -O 'edgedriver_win64.zip' -q
'https://msedgedriver.azureedge.net/96.0.1054.57/edgedriver_win64.zip'
!unzip '/content/edgedriver_win64.zip'
import selenium
from selenium import webdriver
wd = webdriver.Edge('/content/msedgedriver.exe')
我遇到了这个错误:
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:3: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
This is separate from the ipykernel package so we can avoid doing imports until
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
75 stdin=PIPE,
---> 76 creationflags=self.creationflags)
77 except TypeError:
5 frames
PermissionError: [Errno 13] Permission denied: '/content/msedgedriver.exe'
During handling of the above exception, another exception occurred:
WebDriverException Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
86 raise WebDriverException(
87 "'%s' executable may have wrong permissions. %s" % (
---> 88 os.path.basename(self.path), self.start_error_message)
89 )
90 else:
WebDriverException: Message: 'msedgedriver.exe' executable may have wrong permissions. Please download from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
但是我之前已经通过 !wget 下载了最新版本的 Edge 驱动程序,我不知道如何修复它,因为 Stack Overflow 上的所有解决方案都是针对 Chrome 驱动程序的,它们对我不起作用。
【问题讨论】:
-
嗨@F1nn 这个问题怎么样? my answer below 对解决问题有帮助吗?如果有什么我可以在这里提供帮助的,请告诉我。
标签: python selenium selenium-webdriver google-colaboratory microsoft-edge