NS_ERROR_SOCKET_ADDRESS_IN_USE [英] NS_ERROR_SOCKET_ADDRESS_IN_USE
本文介绍了NS_ERROR_SOCKET_ADDRESS_IN_USE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码:
from selenium import webdriver
import selenium.webdriver.support.ui as ui
import time
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
driver = webdriver.Firefox()
driver.get("https://www.youtube.com")
login_wait = WebDriverWait(driver, 10)
textbox = login_wait.until(EC.visibility_of_element_located((By.ID, 'search')))
textbox.send_keys("a")
time.sleep(10)
driver.close()
在Python控制台中没有错误,但geckodriver.log:
No error in Python console but geckodriver.log:
1514074507756 geckodriver INFO geckodriver 0.19.1
1514074507763 geckodriver INFO Listening on 127.0.0.1:49865
1514074508870 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-profile" "/var/folders/kf/8800phd97vx28vtzdytqk1m80000gn/T/rust_mozprofile.oI7AzEUKweAr"
1514074509913 Marionette ERROR Error on starting server: [Exception... "Component returned failure code: 0x804b0036 (NS_ERROR_SOCKET_ADDRESS_IN_USE) [nsIServerSocket.initSpecialConnection]" nsresult: "0x804b0036 (NS_ERROR_SOCKET_ADDRESS_IN_USE)" location: "JS frame :: chrome://marionette/content/server.js :: MarionetteServer.prototype.start :: line 95" data: no]
[Exception... "Component returned failure code: 0x804b0036 (NS_ERROR_SOCKET_ADDRESS_IN_USE) [nsIServerSocket.initSpecialConnection]" nsresult: "0x804b0036 (NS_ERROR_SOCKET_ADDRESS_IN_USE)" location: "JS frame :: chrome://marionette/content/server.js :: MarionetteServer.prototype.start :: line 95" data: no]
MarionetteServer.prototype.start@chrome://marionette/content/server.js:95:19
MarionetteComponent.prototype.init@jar:file:///Applications/Firefox.app/Contents/Resources/omni.ja!/components/marionette.js:217:5
MarionetteComponent.prototype.handle@jar:file:///Applications/Firefox.app/Contents/Resources/omni.ja!/components/marionette.js:112:5
2017-12-23 19:15:11.556 plugin-container[42994:4077314] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9b3b, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-12-23 19:15:11.559 plugin-container[42994:4077314] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9e03, name = 'com.apple.CFPasteboardClient'
See /usr/include/servers/bootstrap_defs.h for the error codes.
推荐答案
如果您在错误堆栈跟踪中查找,则错误说明了一切:
If you look ino the error stack trace, the error says it all :
1514074509913 Marionette ERROR Error on starting server: [Exception... "Component returned failure code: 0x804b0036 (NS_ERROR_SOCKET_ADDRESS_IN_USE) [nsIServerSocket.initSpecialConnection]" nsresult: "0x804b0036 (NS_ERROR_SOCKET_ADDRESS_IN_USE)" location: "JS frame :: chrome://marionette/content/server.js :: MarionetteServer.prototype.start :: line 95" data: no]
这实际上意味着 Marionette
试图通过端口在您的 localhost
即 127.0.0.1
上打开您的连接> 49865
,但由于以下原因之一,当前端口已被占用:
This essentially means Marionette
is trying to open up a connection on you localhost
i.e. 127.0.0.1
through port 49865
but the port is currently occupied due to one of the following reasons :
-
Port 49865
当前正在由localhost
用尽的其他一些应用程序使用. -
Port 49865
由您的localhost
运行的某些服务使用. -
Port 49865
尚未被悬空的WebDriver
变体实例释放,例如GeckoDriver
,ChromeDriver
,IEDriverServer
或GhostDriver
.
Port 49865
is currently being used by some other application running out of yourlocalhost
.Port 49865
is used by some service running from yourlocalhost
.Port 49865
haven't been released by a dangling instance of aWebDriver
variant e.g.GeckoDriver
,ChromeDriver
,IEDriverServer
orGhostDriver
.
解决方案将是以下所有步骤之一或全部:
The solution would be either/all of the following steps :
- 始终在
Automation Script
的tearDown()
方法中使用driver.quit()
. 如果WebDriver
变体的任何悬空实例,例如GeckoDriver
,ChromeDriver
,IEDriverServer
或GhostDriver
存在于您的系统上,杀死是通过编程/手动方式进行的. - 确保
Port 49865
没有被用在localhost
之外的其他任何应用程序使用. - 确保从您的
localhost
运行的某些服务未使用Port 49865
. - 在执行
Tests
之前和之后,使用CCleaner
工具清除系统上的操作系统杂项. - 接受
System Reboot
- 如果问题仍然存在,请通过
Revo Uninstaller
uninstall
Mozilla Firefox Browser
并安装Mozilla Firefox Browser
的新实例. li>
- Always use
driver.quit()
withintearDown()
method of yourAutomation Script
. If any dangling instance ofWebDriver
variant e.g.GeckoDriver
,ChromeDriver
,IEDriverServer
orGhostDriver
are present on your system, Kill them programatically/manually. - Ensure that
Port 49865
is not used by any other application running out of yourlocalhost
. - Ensure that
Port 49865
is not used by some service running from yourlocalhost
. - Use
CCleaner
tool before and after executing yourTests
to wipe off the OS chores from your system. - Take a
System Reboot
- If the issue still persists,
uninstall
Mozilla Firefox Browser
throughRevo Uninstaller
and install fresh instance ofMozilla Firefox Browser
这篇关于NS_ERROR_SOCKET_ADDRESS_IN_USE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文