【问题标题】:selenium.common.exceptions.SessionNotCreatedException: Message: session not created: No matching capabilities foundselenium.common.exceptions.SessionNotCreatedException:消息:未创建会话:未找到匹配的功能
【发布时间】:2021-03-06 15:14:06
【问题描述】:

我一直在尝试在我的笔记本电脑上开始使用 selenium,但我总是遇到错误,大约 1 小时后我自己尝试修复它。

Selenium version: 3.141.0
chromedriver versoin: 860224
Chrome version: 90.0.4430.11
OS: Arch Linux x86_64

我有以下这段代码(从帖子here复制:

import selenium
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.binary_location = r'/opt/google/chrome-unstable/google-chrome-unstable'
driver = webdriver.Chrome(options= options, executable_path= '/home/andrei399/Downloads/chromedriver_linux64/chromedriver')
driver.get('http://google.com/')

谁能帮帮我?我经历了很多事情,在我重新启动笔记本电脑之前它说它没有找到任何二进制文件,虽然路径直接指向 x 程序,但我尝试过使用 chrome(不是 chrome-unstable),虽然现在这似乎不再是问题了。

【问题讨论】:

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


    【解决方案1】:

    您正在使用 webdriver.Chrome 功能,但您已导入 firefox 选项

    将您的代码更改为以下内容

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    options = Options()
    options.binary_location = r'/opt/google/chrome-unstable/google-chrome-unstable'
    driver = webdriver.Chrome(options= options, executable_path= '/home/andrei399/Downloads/chromedriver_linux64/chromedriver')
    driver.get('http://google.com/')
    

    【讨论】:

    • 天哪,你说得对,一开始我想用 firefox 做,但 gecko 不工作,以为我会切换到 chrome,但完全忘记改变了。非常感谢.
    猜你喜欢
    • 2019-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-28
    • 1970-01-01
    • 2020-05-11
    • 2019-01-30
    相关资源
    最近更新 更多