selenium.common.exceptions.SessionNotCreateException:消息:未创建会话:未找到匹配的功能

2024-06-16 11:19:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试在我的笔记本电脑上使用selenium,但我总是出错,大约1小时后,我已经尝试自己修复它了

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

我有以下代码(从posthere复制而来):

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不稳定),尽管现在这似乎不再是问题


Tags: fromimportversiondriverseleniumgooglechromechromedriver
1条回答
网友
1楼 · 发布于 2024-06-16 11:19:21

您正在使用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/')

相关问题 更多 >