首页 > 解决方案 > 使用 python 和 selenium 打开链接时出错

问题描述

尝试使用 python 和 selenium 在浏览器中打开谷歌,给了我以下错误:(错误图片

DevTools 监听 ws://127.0.0.1:57033/devtools/browser/45f6818b-0d1e-4b81-9 637-861b579c7470 [0901/085753.496:ERROR:gl_surface_egl.cc(863)] eglInitialize D3D9 失败,出现错误 EGL_01IALED_IT0 /085753.496:ERROR:gl_initializer_win.cc(232)] GLSurfaceEGL::InitializeOneOf f 失败。[0901/085753.502:ERROR:viz_main_impl.cc(201)] 由于初始化期间出现错误而退出 GPU 进程 [7188:10216:0901/085753.819:ERROR:gpu_process_transport_factory.cc(1016)] 丢失 UI 共享上下文。[0901/085753.912:ERROR:command_buffer_proxy_impl.cc(113)] ContextResult::kFatalF ailure: 共享内存句柄无效 [0901/085753.962:ERROR:command_buffer_proxy_impl.cc(113)] ContextResult::kFatalF ailure: 共享内存句柄是无效

它启动 chrome 浏览器,也打开链接,但它在后面给出错误...

print("Starting...")

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select

print("Opening...")
driver = webdriver.Chrome()
driver.get('https://google.com')

标签: pythonpython-3.xseleniumselenium-webdriverselenium-chromedriver

解决方案


推荐阅读