blueking15341534 2021-02-08 23:40 采纳率: 0%
浏览 283

ChromeCore' executable may have wrong permissions.

from selenium import webdriver
import selenium


#
# print(selenium.__version__)
# print(selenium.webdriver)



driver = webdriver.Chrome(executable_path=r"D:\softs\chrome\ChromeCore")
driver.get("https://www.baidu.com")

input = driver.find_element_by_css_selector('#kw')
input.send_keys("天堂的张望")

button = driver.find_element_by_css_selector('#su')
button.click()

Traceback (most recent call last):
  File "C:\Users\***\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "D:\softs\python3.8\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "D:\softs\python3.8\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] 拒绝访问。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/***/Desktop/spideframer/testing2.py", line 11, in <module>
    driver = webdriver.Chrome(executable_path=r"D:\softs\chrome\ChromeCore")
  File "C:\Users\***\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\***\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\common\service.py", line 86, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'ChromeCore' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
 

 

  • 写回答

1条回答 默认 最新

  • slience_me 人工智能领域新星创作者 2024-01-11 14:15
    关注

    根据你提供的错误信息,看起来问题是在启动 Chrome 浏览器时出现了权限错误。这通常是由于 ChromeDriver 执行文件的权限不足引起的。以下是可能的解决方案:

    1. 检查ChromeDriver版本: 确保你下载的 ChromeDriver 版本与你本地安装的 Chrome 浏览器版本匹配。你可以从 ChromeDriver官方网站 下载最新版本。

    2. 使用ChromeDriver正确路径: 确保 executable_path 参数提供的路径是正确的。你应该提供 chromedriver.exe 文件的完整路径,而不仅仅是文件夹路径。

      例如,如果你的 ChromeDriver 位于 D:\softs\chrome\ChromeCore 文件夹中,你应该提供完整路径,如下所示:

      driver = webdriver.Chrome(executable_path=r"D:\softs\chrome\ChromeCore\chromedriver.exe")
      
    3. 检查文件权限: 确保你有权限执行 ChromeDriver。右键点击 chromedriver.exe 文件,选择“属性”,然后切换到“安全”选项卡,确保你有执行文件的权限。

    4. 尝试使用ChromeOptions: 有时,使用 ChromeOptions 可以解决一些权限问题。例如:

      from selenium.webdriver.chrome.options import Options
      
      options = Options()
      options.add_argument("--no-sandbox")
      options.add_argument("--disable-dev-shm-usage")
      
      driver = webdriver.Chrome(executable_path=r"D:\softs\chrome\ChromeCore\chromedriver.exe", chrome_options=options)
      

    尝试上述解决方案中的一个或多个,应该能够解决你遇到的问题。如果问题仍然存在,请提供更多详细信息,以便更好地帮助你。

    评论

报告相同问题?

悬赏问题

  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了