Chrome webdriver selenium内存错误-python 3

Chrome webdriver selenium内存错误-python 3,python,python-3.x,google-chrome,selenium,selenium-webdriver,Python,Python 3.x,Google Chrome,Selenium,Selenium Webdriver,您好,我试图通过创建一个脚本来测试selenium和chrome webdriver,该脚本将打开浏览器到特定站点 下面是我的代码: import selenium from selenium import webdriver from selenium.webdriver.common.keys import Keys def open_browser(user_string): browser = webdriver.Chrome() browser.get(user_st

您好,我试图通过创建一个脚本来测试selenium和chrome webdriver,该脚本将打开浏览器到特定站点

下面是我的代码:

import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

def open_browser(user_string):
    browser = webdriver.Chrome()
    browser.get(user_string)

def main():
    x = input("Where would you like to open the internet to? ")
    open_browser(x)

if __name__ == '__main__':
    main()
但是,当我在shell中运行此命令时,一个空白窗口会打开几秒钟,然后关闭,我会收到以下错误:

124:63332:1022/202611.560:ERROR:persistent_memory_allocator.cc(815)]
Corruption detected in shared-memory segment.

124:60160:1022/202621.325:ERROR:shader_disk_cache.cc(237)] Failed to
create shader cache entry: -2

我不知道是什么导致了这些错误。

这对我很有效。检查路径中是否有正确版本的chromedriver。
否则,请尝试删除shadercache:
~/.config/google chrome/shadercache/
(或在Windows上
C:\Users\YOU\AppData\Local\google\chrome\User Data\shadercache\

将“chromedriver.exe”放在脚本文件夹中,该文件夹位于已安装驱动程序的python文件夹中(默认情况下为C://python/script),然后在环境变量下的path中添加C://Python和C://Python/script。请按照步骤了解更多详细信息。安装程序完成后,重新启动一次,然后重试您的代码。

“chromedriver.exe”可执行文件需要位于路径中。请见见https://sites.google.com/a/chromium.org/chromedriver/home 是我得到的,因此我可能没有正确地将其添加到windows 10的路径中。Windows 10在将其添加到教程未显示的路径时有一个额外的步骤,因此这可能是我搞砸的地方。请将我的答案标记为正确,以便对其他人有用。