CreatePlatformSocket()返回错误:提供了无效的参数. (0x2726)端口不可用.正在退出...使用chromedriver和Selenium 3.2 [英] CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) Port not available. Exiting... with chromedriver and Selenium 3.2

查看:86
本文介绍了CreatePlatformSocket()返回错误:提供了无效的参数. (0x2726)端口不可用.正在退出...使用chromedriver和Selenium 3.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用硒启动chrome(或任何其他浏览器). 当我从家用PC上运行时,相同的代码也有效.所以我认为这与防火墙和安全设置有关.

I am unable to launch chrome (or any other browser) with selenium. The same code works when i run from my home PC. so i am thinking it has to do with firewall and security set up.

硒版本为3.2,Chrome驱动程序版本为2.28,我也尝试过2.25(相同的错误).使用的代码:

selenium version is 3.2, Chrome driver version is 2.28 i have also tried 2.25 (same error). the code used:

 System.setProperty("webdriver.chrome.driver", "K://browserdriver//chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://google.com");

错误消息:

Starting ChromeDriver 2.28.455520 (cc17746adff54984afff480136733114c6b3704b) on port 12121
Only local connections are allowed.
[0.023][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
[0.023][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
Port not available. Exiting...
Mar 11, 2017 9:13:06 PM org.openqa.selenium.os.UnixProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
FAILED CONFIGURATION: @BeforeTest beforeTest
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.2.0', revision: '8c03df6b79', time: '2017-02-23 10:51:31 +0000'
System info: host: 'a1', ip: '', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_77'
Driver info: driver.version: ChromeDriver
	at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:180)
	at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:168)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:178)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:167)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:124)
	at browesertest.NewTest.beforeTest(NewTest.java:23)
	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:80)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
	at org.testng.TestRunner.beforeRun(TestRunner.java:641)
	at org.testng.TestRunner.run(TestRunner.java:609)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
	at org.testng.TestNG.run(TestNG.java:1031)
	at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:24144/status] to be available after 20001 ms
	at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
	at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:177)
	... 32 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
	at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:140)
	at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:80)
	... 33 more
Caused by: java.util.concurrent.TimeoutException
	at java.util.concurrent.FutureTask.get(Unknown Source)
	at com.google.common.util.c

推荐答案

我找出了错误的原因;这是因为我的chromedriver.exe位于网络驱动器上,而不是浏览器正在运行测试的计算机上.解决方法是将chromedriver.exe移至C驱动器下.

I figured out the cause of the error; it is because my chromedriver.exe is on a networked drive and not on the machine the browser is running the test. Solution was to move chromedriver.exe under C drive.

这篇关于CreatePlatformSocket()返回错误:提供了无效的参数. (0x2726)端口不可用.正在退出...使用chromedriver和Selenium 3.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆