此问题已通过提交解决,并且修复程序可用ChromeDriver 73.x保护chromedriver使用的端口对于@barancev 的端口使用我们无能为力提及 ChromeDriver 尝试使用系统查找免费的临时端口-依赖的临时端口范围检测器.临时端口 是一个短期端点,当程序请求任何可用的用户端口时,它由操作系统创建.操作系统从预定义的范围中选择端口号,通常在 1024 到 65535 之间,并在相关 TCP 连接终止后释放端口.默认情况下,系统最多可以创建大约 4,000 个在 Windows Server 2003 上并发运行的临时端口,在 Windows Server 2008 上创建大约 16,000 个.解决方案升级到 ChromeDriver 73.x 将解决这个问题.尾声这些日志消息反映了ChromeDriver - 安全注意事项.ChromeDriver 是一个强大的工具,如果落入坏人之手,可能会造成伤害.使用 ChromeDriver 时,请遵循以下建议以确保其安全:默认情况下,ChromeDriver 只允许本地连接.如果您需要从远程主机连接到它,请在命令行上使用 --whitelisted-ips 开关来指定允许连接到 ChromeDriver 的 IP 地址列表.如果可能,请使用无法访问敏感本地或网络数据的测试帐户运行 ChromeDriver.ChromeDriver 不应使用特权帐户运行.如果可能,请在 Docker 或虚拟机等受保护环境中运行 ChromeDriver.使用防火墙防止未经授权的远程连接到 ChromeDriver.如果您通过 Selenium Server 等第三方工具使用 ChromeDriver,请务必同时保护这些工具的网络端口.使用最新版本的 ChromeDriver 和 Chrome.您可以在 Chrome 上找到受限端口列表 这里.Normally when I run chromedriver I always get this output which I'm sure everyone gets when running chromedriver. It's not the whole output but about a specif sentence.Only local connections are allowed.Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.As the title says and the output I always get. How do I make sure that the ports ChromeDriver is using only protected ports? 解决方案 This INFO message...Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.... was the result of a bug which got induced with ChromeDriver v2.46AnalysisAs per the discussion 2.46 produces unexpected debug.log file if verbose logging is enabled, within the InitLogging() function of logging.cc some logging messages were written too early even before logging::InitLogging is called (at the last line of the function). This turned out to be OK on Linux and Mac OS, where the default log destination is where it is expected. But on Windows, the default log destination is a file named debug.log.So ChromeDriver team needed to remove the two VLOG calls to the end of the method, after calling logging::InitLogging.This issue was addressed through a commit and the fix was available within ChromeDriver 73.xProtecting the ports that chromedriver useThere is nothing much we can do about the port usage as @barancev mentions ChromeDriver attempts to find a free Ephemeral port using a system-dependent ephemeral port range detector. An ephemeral port is a short-lived endpoint that is created by the operating system when a program requests any available user port. The operating system selects the port number from a predefined range, typically between 1024 and 65535, and releases the port after the related TCP connection terminates.By default, the system can create a maximum of approximately 4,000 ephemeral ports that run concurrently on Windows Server 2003 and approximately 16,000 on Windows Server 2008.SolutionUpgrading to ChromeDriver 73.x will solve this issue.OutroThese log messages were the reflection of ChromeDriver - Security Considerations.ChromeDriver is a powerful tool, and it can cause harms in the wrong hands. While using ChromeDriver, please follow these suggestions to help keeping it safe:By default, ChromeDriver only allows local connections. If you need to connect to it from a remote host, use --whitelisted-ips switch on the command line to specify a list of IP addresses that are allowed to connect to ChromeDriver.If possible, run ChromeDriver with a test account that has no access to sensitive local or network data. ChromeDriver should never be run with a privileged account.If possible, run ChromeDriver in a protected environment such as Docker or virtual machine.Use firewall to prevent unauthorized remote connection to ChromeDriver.If you are using ChromeDriver through third-party tools such as Selenium Server, be sure to protect the network ports of those tools as well.Use the latest versions of ChromeDriver and Chrome. You can find the list of restricted ports on Chrome here. 这篇关于如何保护 chromedriver 使用的端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!