简体   繁体   English

Edge 浏览器驱动程序未在“Selenium”中启动

[英]Edge browser driver does not launch in "Selenium"

I want to use Selenium to control the MS Edge browser.我想用 Selenium 来控制 MS Edge 浏览器。

However, I get an error and cannot move forward.但是,我收到一个错误,无法继续前进。

Please let me know the cause of this error and how to deal with it.请让我知道这个错误的原因以及如何处理它。

# Information about the environment # 环境信息

# Code # 代码

*The commented-out "Chrome" will launch normally. *注释掉的“Chrome”将正常启动。


from selenium import webdriver

#driver = webdriver.Chrome(executable_path='/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Documents/scraping/chromedriver')
driver = webdriver.Edge(executable_path='/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Documents/scraping/msedgedriver')

# Error message # 错误信息

---------------------------------------------------------------------------
SessionNotCreatedException                Traceback (most recent call last)
<ipython-input-8-ae341505cdf7> in <module>
      4 #driver = webdriver.Edge(executable_path='/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Documents/scraping/msedgedriver')
      5 
----> 6 driver = webdriver.Edge(executable_path="/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Downloads/edgedriver_mac64 (1)/msedgedriver")

~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/edge/webdriver.py in __init__(self, executable_path, capabilities, port, verbose, service_log_path, log_path, keep_alive)
     64                                               resolve_ip=False,
     65                                               keep_alive=keep_alive),
---> 66             desired_capabilities=capabilities)
     67         self._is_remote = False
     68 

~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
    155             warnings.warn("Please use FirefoxOptions to set browser profile",
    156                           DeprecationWarning, stacklevel=2)
--> 157         self.start_session(capabilities, browser_profile)
    158         self._switch_to = SwitchTo(self)
    159         self._mobile = Mobile(self)

~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, capabilities, browser_profile)
    250         parameters = {"capabilities": w3c_caps,
    251                       "desiredCapabilities": capabilities}
--> 252         response = self.execute(Command.NEW_SESSION, parameters)
    253         if 'sessionId' not in response:
    254             response = response['value']

~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
    319         response = self.command_executor.execute(driver_command, params)
    320         if response:
--> 321             self.error_handler.check_response(response)
    322             response['value'] = self._unwrap_value(
    323                 response.get('value', None))

~/opt/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
    240                 alert_text = value['alert'].get('text')
    241             raise exception_class(message, screen, stacktrace, alert_text)
--> 242         raise exception_class(message, screen, stacktrace)
    243 
    244     def _value_or_default(self, obj, key, default):

SessionNotCreatedException: Message: session not created: No matching capabilities found

You need to send capabilities if you're using Mac OS.如果您使用的是 Mac OS,则需要发送功能。 You can try to send an empty capability:您可以尝试发送一个空功能:

desired_cap={}

driver = webdriver.Edge(executable_path='/Users/yuchikawa/Dropbox/My Mac (YuのMacBook Pro)/Documents/scraping/msedgedriver', capabilities=desired_cap)

There're threads with same issues:有相同问题的线程:

MSEdgeDriver - session not created: No matching capabilities found error on Selenium with Python MSEdgeDriver - session 未创建:在 Selenium 与 Python 上未找到匹配功能错误

Running Edge browser on Selenium in MacOs (Catalina) 在 MacOs (Catalina) 的 Selenium 上运行 Edge 浏览器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 Selenium Python EdgeOption 启动 Edge 浏览器 - Unable to launch Edge Browser using Selenium Python EdgeOption Python - Selenium 节点不启动 Chrome 浏览器 - Python - Selenium node does not launch the Chrome browser 带有 MS Edge 浏览器的 Python (Selenium):&#39;Connection aborted.&#39;, ConnectionResetError(10054, ...)“Microsoft Web Driver 已停止工作” - Python (Selenium) with MS Edge browser: 'Connection aborted.', ConnectionResetError(10054, ...) "Microsoft Web Driver has stopped working" 为什么在 Ubuntu 18.04 上运行 Selenium chrome 驱动程序时 chrome 浏览器无法启动 - Why chrome browser doesn't launch when running Selenium chrome driver on Ubuntu 18.04 python selenium 3 Edge web 驱动程序错误 - Error in python selenium 3 Edge web driver Selenium Driver for Edge 获取恒定版本错误 - Selenium Driver for Edge getting constant version error 启动 selenium 或氦气驱动程序的一个实例 - Launch one instance of selenium or helium driver 选择下拉框不会激活Edge Selenium WebDriver的Edge浏览器上的确认对话框窗口 - Selecting drop down box does not activate confirm dialog window on Edge browser for Python Selenium WebDriver 在 MacOs (Catalina) 的 Selenium 上运行 Edge 浏览器 - Running Edge browser on Selenium in MacOs (Catalina) 有没有用 selenium 为边缘浏览器定义 windows 大小? - is there anyway to define windows size for edge browser with selenium?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM