当前位置: 首页 > 知识库问答 >
问题:

使用Selenium启动Edge后无法连接到localhot错误[重复]

蓟清野
2023-03-14

我正在尝试使用Selenium和Microsoft Edge,但在成功启动浏览器后,我得到了无法连接到localhost错误。从过去两天开始尝试解决这个问题,但没有一个解决方案对我有效。

已尝试更改Internet选项设置、在边缘中启用允许环回选项、使用CMD添加ChecknTisolation LoopbackExempt-a-n=“Microsoft.MicrosoftedGE_8WeKYB3D8BBWE等。

请检查附加得堆栈跟踪:

[17:58:31.190] - Listening on http://localhost:39298/ 

FAILED: LoginLogout
org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:39298
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'APSPNQ01LTP21', ip: '10.197.1.87', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_211'
Driver info: driver.version: EdgeDriver
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:209)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:132)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:141)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:96)
    at testCases.Base.driverInsWindows(Base.java:399)
    at testCases.Base.driverIns(Base.java:626)
    at testCases.SignInSignOut.LoginLogout(SignInSignOut.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:822)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1130)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:782)
    at org.testng.TestRunner.run(TestRunner.java:632)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
    at org.testng.SuiteRunner.run(SuiteRunner.java:268)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
    at org.testng.TestNG.run(TestNG.java:1064)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177)
Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:39298
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:240)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:158)
    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)
    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)
    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
    at okhttp3.RealCall.execute(RealCall.java:77)
    at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:101)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:101)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    ... 32 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at okhttp3.internal.platform.Platform.connectSocket(Platform.java:125)
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:238)
    ... 54 more

共有1个答案

卫骏
2023-03-14

检查是否有任何东西正在侦听端口39298:netstat-an find“39298”

确保该端口上有IPv6侦听器。您指定了localhost:39298,它转换为0:0:0:0:0:0:1:39298(IPv6)。如果服务器仅在IPv4模式下侦听,请尝试127.0.0.1:39298。

 类似资料:
  • 我试图通过Selenium打开Chrome webdriver,但在初始化时出错。我收到的错误是: 我一直在寻找不同的解决方案。我尝试手动指定Chrome.exe的路径,我添加了一些片段,如和以及使用单独的user-data-dir。当前代码可以在下面看到 Chrome的版本是71.0。3578.80,Chromedriver为2.45,因此应该兼容。我曾尝试使用较旧的版本,但只得到部分错误:De

  • 尝试使用Docker容器将Kibana连接到ES时出错: kibana-product-624|{"type":"log","@time戳":"2018-05-25T14:56:36Z","tags":["警告","elasticsearch","admin"],"pid": 1,"消息":"无法恢复连接:超文本传输协议://elasticsearch: 9200/"}kibana-product

  • Q-我安装了git以获取最新版本的Angular。当我尝试运行时 我连接到github 443错误失败 我甚至试过 这使我无法连接,没有错误消息。 我在公司防火墙后面。转到控制面板时,我看不到我的代理详细信息- 我终于做到了。我将更新我所采取的程序,以便只是想编译我所做的所有步骤,以使它正常工作

  • 使用此代码为相同,但它是给无法访问的浏览器异常和不工作。

  • 我正在尝试使用IntelliJ在WildFly 19中创建一个简单的JMS ActiveMQ连接。我遵循了安装指南,但遇到了连接错误。 我将Wildfly作为本地服务器运行,处于独立模式。我已经更新了IntelliJ中的启动脚本环境变量,以指向standalone-full.xml(显然我需要使用,以便使用JMS?) 我已经更新了XML文件,以便在代码中添加要连接的JMS队列: EAR正在部署,J

  • 问题内容: 我收到此错误: 当我在代码中执行以下操作时: 真的无法简单得多,但是错误是致命的。有任何想法吗? 问题答案: 我最终完成了这项工作,删除了NuGet在安装WebDriver时添加的所有软件包子文件夹,并决定手动添加它们。创建一个“ lib”文件夹,然后将硒二进制文件解压缩到该文件夹​​中。然后添加对所有二进制文件的引用。现在看来还好。