CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) when trying to access chromedriver through network path
CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) when trying to access chromedriver through network path
我了解到 OS 更新导致此问题不仅适用于 chromedriver,也适用于 geckodriver。
chromedriver 和 geckodriver 启动时没有任何问题,更新的站点在本地运行它们(例如驱动器 C:\)。当在网络路径中找到这两个时,就会出现问题。
我检查了运行这些 driver 的特定用户的权限,我还检查了 UAC 和防火墙,但它们似乎与问题无关。
为了维护,我更喜欢 运行 来自网络路径的 driver。因为,我有几个自动化站,我想集中基础设施。这样我就不需要维护每个站点的基础设施了。
我 运行 两个 driver 都使用默认设置而不使用他们的选项,我相信也许使用这些选项可以解决问题。
有人熟悉这类问题吗?是否有可能通过使用 driver 的选项我可以安全地通过这些问题?
顺便说一句,我 运行 超过 Windows 10 Pro 版本:1803 OS 版本:17134.1
chromedriver 是版本 2.40.565498 win32
geckodriver 是 v0.20.1-win64
我收到的错误消息是:
chromedriver
[1530079175.164][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
[1530079175.165][INFO]: listen on IPv4 failed with error ERR_INVALID_ARGUMENT
[1530079175.166][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
[1530079175.166][INFO]: listen on IPv6 failed with error ERR_INVALID_ARGUMENT
壁虎driver
An invalid argument was supplied. (os error 10022)
如你所说:
- ChromeDriver 和 GeckoDriver 在本地执行时都没有任何问题(例如
C:\
驱动器)
- 当在网络路径中找到 ChromeDriver 和 GeckoDriver 时会出现问题。
历史上,根据讨论:
- CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) Port not available. Exiting… with chromedriver and Selenium 3.2
- CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x27t6) Port not available. Exiting… in Selenium Webdriver
据观察,ChromeDriver 和 GeckoDriver 通过网络共享时,同时初始化各自的 浏览器客户 观察到以下错误:
样本 A:
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)
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
样本 B:
[0.147][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
[0.147][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x27t6)
Port not available. Exiting...
样本 C:
Starting ChromeDriver 2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 17873
Only local connections are allowed.
[1525873930.811][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
[1525873930.816][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
Port not available. Exiting...
May 09, 2018 7:22:30 PM org.openqa.selenium.os.UnixProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
甚至:
//chromedriver
[1530079175.164][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
[1530079175.165][INFO]: listen on IPv4 failed with error ERR_INVALID_ARGUMENT
//geckodriver
An invalid argument was supplied. (os error 10022)
//IEDriverServer
Failed to start the server with: port = '2305', host = '', log level = '', log file = '', whitelisted ips = ''
解决方案
因此,通用的解决方案是通过将 ChromeDriver 和 GeckoDriver 放入主机的本地驱动器来访问它们。
我了解到 OS 更新导致此问题不仅适用于 chromedriver,也适用于 geckodriver。
chromedriver 和 geckodriver 启动时没有任何问题,更新的站点在本地运行它们(例如驱动器 C:\)。当在网络路径中找到这两个时,就会出现问题。
我检查了运行这些 driver 的特定用户的权限,我还检查了 UAC 和防火墙,但它们似乎与问题无关。
为了维护,我更喜欢 运行 来自网络路径的 driver。因为,我有几个自动化站,我想集中基础设施。这样我就不需要维护每个站点的基础设施了。
我 运行 两个 driver 都使用默认设置而不使用他们的选项,我相信也许使用这些选项可以解决问题。
有人熟悉这类问题吗?是否有可能通过使用 driver 的选项我可以安全地通过这些问题?
顺便说一句,我 运行 超过 Windows 10 Pro 版本:1803 OS 版本:17134.1
chromedriver 是版本 2.40.565498 win32 geckodriver 是 v0.20.1-win64
我收到的错误消息是:
chromedriver
[1530079175.164][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
[1530079175.165][INFO]: listen on IPv4 failed with error ERR_INVALID_ARGUMENT
[1530079175.166][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726)
[1530079175.166][INFO]: listen on IPv6 failed with error ERR_INVALID_ARGUMENT
壁虎driver
An invalid argument was supplied. (os error 10022)
如你所说:
- ChromeDriver 和 GeckoDriver 在本地执行时都没有任何问题(例如
C:\
驱动器) - 当在网络路径中找到 ChromeDriver 和 GeckoDriver 时会出现问题。
历史上,根据讨论:
- CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) Port not available. Exiting… with chromedriver and Selenium 3.2
- CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x27t6) Port not available. Exiting… in Selenium Webdriver
据观察,ChromeDriver 和 GeckoDriver 通过网络共享时,同时初始化各自的 浏览器客户 观察到以下错误:
样本 A:
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) org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
样本 B:
[0.147][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) [0.147][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x27t6) Port not available. Exiting...
样本 C:
Starting ChromeDriver 2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 17873 Only local connections are allowed. [1525873930.811][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) [1525873930.816][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) Port not available. Exiting... May 09, 2018 7:22:30 PM org.openqa.selenium.os.UnixProcess checkForError SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
甚至:
//chromedriver [1530079175.164][SEVERE]: CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) [1530079175.165][INFO]: listen on IPv4 failed with error ERR_INVALID_ARGUMENT //geckodriver An invalid argument was supplied. (os error 10022) //IEDriverServer Failed to start the server with: port = '2305', host = '', log level = '', log file = '', whitelisted ips = ''
解决方案
因此,通用的解决方案是通过将 ChromeDriver 和 GeckoDriver 放入主机的本地驱动器来访问它们。