MSEdgeDriver - session not created: No matching capabilities found error on Selenium with Python(MSEdgeDriver-未创建会话:在Selify和Python上未发现匹配功能错误)
本文介绍了MSEdgeDriver-未创建会话:在Selify和Python上未发现匹配功能错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Microsoft Edge上运行自动化时遇到一些问题。安装了正确的浏览器版本驱动程序,并尝试了其他几个修复程序,但都无济于事。这是在PyCharm上使用Selence和Python3。
回到开头,这是我的代码...
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.edge.options import Options
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
options = Options()
driver = webdriver.Edge(executable_path='/Users/james.stott/PycharmProjects/venv/Selenium/Remote/msedgedriver')
以下是引发的错误...
selenium.common.exceptions.SessionNotCreatedException:消息:未创建会话:未找到匹配的功能
如有任何帮助,我们将不胜感激。
推荐答案
我猜您使用的是Edge Chromium,您可以参考下面的步骤,使用Selify Python代码自动执行Edge浏览器:
从此link下载并安装Python。
以管理员身份启动命令提示符。
运行下面的命令以安装Edge Selify工具。
pip install msedge-selenium-tools selenium==3.141从此link安装正确版本的边缘Web驱动程序。(Web驱动程序版本应与边缘浏览器版本相同)
使用下面的代码创建一个Python文件,并根据您自己的需要进行修改。
from msedge.selenium_tools import Edge, EdgeOptions options = EdgeOptions() options.use_chromium = True options.binary_location = r"C:Program Files (x86)MicrosoftEdgeApplicationmsedge.exe" driver = Edge(executable_path = r"D:selenium web driversedge drivermsedgedriver.exe", options = options) # Modify the path here... driver.get("https://example.com")
更新:
如果您使用Mac OS,则需要发送功能。您可以尝试发送空功能:
desired_cap={}
driver = webdriver.Edge(executable_path='/Users/james.stott/PycharmProjects/venv/Selenium/Remote/msedgedriver', capabilities=desired_cap)
这篇关于MSEdgeDriver-未创建会话:在Selify和Python上未发现匹配功能错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
编程基础网
本文标题为:MSEdgeDriver-未创建会话:在Selify和Python上未发现匹配功能错误
基础教程推荐
猜你喜欢
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
