我已经使用了ChromeDriverManager1 年多,Chrome 浏览器更新后没有任何问题,但今天我收到以下错误消息:
URL https://chromedriver.storage.googleapis.com/115.0.5790/chromedriver_win32.zip没有这样的驱动程序
我手动打开链接可以看到该URL不存在。
任何帮助都会很棒,理想情况下仍在使用,ChromeDriverManager但如果没有,任何解决方法现在都会很好,因为对我来说这个包有很多依赖项。
这是我当前的代码:
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
def __init__(self):
# Initialize any necessary attributes here
self.headless_mode = False
def chrome_driver(self):
# Set webdriver options
options = ChromeOptions()
options.headless = self.headless_mode
# Add options arguments to webdriver
options.add_argument("--log-level=3")
options.add_argument("--start-maximized")
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_experimental_option("prefs", {
"download.default_directory": f'r"D:\\Users\\{os.getlogin()}\\Downloads\\"',
"download.prompt_for_download": False,
"download.directory_upgrade": True, …Run Code Online (Sandbox Code Playgroud) 在colab中使用selenium时出现错误
我正在尝试在 colab 中使用 selenium 但它们显示属性错误
在处理上述异常的过程中,又出现了一个异常:
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/common/driver_finder.py in get_path(service, options)
38 path = SeleniumManager().driver_location(options) if path is None else path
39 except Exception as err:
---> 40 msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."
41 raise NoSuchDriverException(msg) from err
42
AttributeError: 'str' object has no attribute 'capabilities'
Run Code Online (Sandbox Code Playgroud) web-scraping python-3.x selenium-webdriver google-colaboratory
我刚刚开始使用seleniumPython,并且不断收到以下错误代码:
TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'
Run Code Online (Sandbox Code Playgroud)
这是上下文的代码:
from selenium.webdriver import Firefox
from selenium.webdriver.common.keys import Keys
url = 'https://example'
driver_path = r"D:\path\to\geckodriver.exe"
browser = Firefox(executable_path=driver_path)
browser.get(url)
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我检查了路径、selenium包的版本并确保我有正确的geckodriver.exe但仍然收到错误。
我在设置网络驱动程序时遇到了这个问题。我必须将 Chrome 更新到 116.0.5845.97。这就是我的行家的样子:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.4.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
设置 chrome 选项并最终创建网络驱动程序的代码:
if (browserName.equals("chrome")) {
WebDriverManager.chromedriver().setup();
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments(new String[]{"--incognito"});
chromeOptions.addArguments(new String[]{"window-size=1980,1080"});
chromeOptions.addArguments(new String[]{"--remote-allow-origins=*"});
this.driver = new ChromeDriver(chromeOptions);
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Starting ChromeDriver 114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052}) on port 9006
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: This version of …Run Code Online (Sandbox Code Playgroud)