【问题标题】:Not able to use chrome web_driver in windows visual studio code无法在 Windows Visual Studio 代码中使用 chrome web_driver
【发布时间】:2022-12-18 06:52:19
【问题描述】:

我试着运行这段代码

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))

错误在下面给出


Output exceeds the size limit. Open the full output data in a text editor
-

WebDriverException                        Traceback (most recent call last)
Cell In \[4\], line 5
2 from selenium.webdriver.chrome.service import Service
3 from webdriver_manager.chrome import ChromeDriverManager
\----\> 5 driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
6 driver.get("https://www.google.com")

File c:\\Users\\varun\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\selenium\\webdriver\\chrome\\webdriver.py:81, in WebDriver.__init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, service, keep_alive)
78 if not service:
79     service = Service(executable_path, port, service_args, service_log_path)
\---\> 81 super().__init__(
82     DesiredCapabilities.CHROME\["browserName"\],
83     "goog",
84     port,
85     options,
86     service_args,
87     desired_capabilities,
88     service_log_path,
89     service,
90     keep_alive,
91 )

File c:\\Users\\varun\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\selenium\\webdriver\\chromium\\webdriver.py:106, in ChromiumDriver.__init__(self, browser_name, vendor_prefix, port, options, service_args, desired_capabilities, service_log_path, service, keep_alive)
103 self.service.start()
...
(No symbol) \[0x00A3051B\]
BaseThreadInitThunk \[0x753B7BA9+25\]
RtlInitializeExceptionChain \[0x76F9BB9B+107\]
RtlClearBits \[0x76F9BB1F+191\]

我已经安装了最新版本的 selenium,我的内核是 python 3.8.10 64 位。我安装了基于 chromium 的勇敢浏览器(版本 1.46.134 Chromium:108.0.5359.94(官方构建)(64 位)),但我仍然无法运行此代码。请帮忙

【问题讨论】:

    标签: python python-3.x selenium selenium-webdriver selenium-chromedriver


    【解决方案1】:

    尝试更新您的驱动程序:

    from webdriver_manager.core.utils import ChromeType
    
    driver = webdriver.Chrome(service=Service(ChromeDriverManager(chrome_type=ChromeType.BRAVE).install()))
    

    【讨论】:

      猜你喜欢
      • 2021-06-11
      • 2011-10-11
      • 2020-06-01
      • 2018-09-26
      • 1970-01-01
      • 1970-01-01
      • 2021-01-26
      • 1970-01-01
      • 2022-11-19
      相关资源
      最近更新 更多