我开发了一个应用程序,可以使用Selenium
读取一些网页。
windows上的ChromeDriver
工作正常,但在unix基础上的Oss(Mac&Centos7(不工作!
我认为一个问题是";将会话为空时的newSession转发到远程";在基于unix的操作系统中。
当我在unix基本操作系统中运行应用程序时,一些警告和信息如下:
Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 53751
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1658989503.540][WARNING]: This version of ChromeDriver has not been tested with Chrome version 103.
28-Jul-2022 10:55:03.613 INFO [Forwarding newSession on session null to remote] org.openqa.selenium.remote.ProtocolHandshake.createSession Detected dialect: W3C
28-Jul-2022 10:55:03.673 WARNING [main] org.openqa.selenium.devtools.CdpVersionFinder.findNearestMatch Unable to find an exact match for CDP version 103, so returning the closest version found: a no-op implementation
28-Jul-2022 10:55:03.673 INFO [main] org.openqa.selenium.devtools.CdpVersionFinder.findNearestMatch Unable to find CDP implementation matching 103.
28-Jul-2022 10:55:03.674 WARNING [main] org.openqa.selenium.chromium.ChromiumDriver.lambda$new$3 Unable to find version of CDP to use for . You may need to include a dependency on a specific version of the CDP using something similar to `org.seleniumhq.selenium:selenium-devtools-v86:4.1.0` where the version ("v86") matches the version of the chromium-based browser you're using and the version number of the artifact is the same as Selenium's.
有什么解决方案可以解决ChromeDriver
错误吗?
如果你有什么建议可以帮助我,请添加评论或回答。
谢谢。
此错误消息。。。
Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 53751
.
[1658989503.540][WARNING]: This version of ChromeDriver has not been tested with Chrome version 103.
.
28-Jul-2022 10:55:03.613 INFO [Forwarding newSession on session null to remote] org.openqa.selenium.remote.ProtocolHandshake.createSession Detected dialect: W3C
28-Jul-2022 10:55:03.673 WARNING [main] org.openqa.selenium.devtools.CdpVersionFinder.findNearestMatch Unable to find an exact match for CDP version 103, so returning the closest version found: a no-op implementation
28-Jul-2022 10:55:03.673 INFO [main] org.openqa.selenium.devtools.CdpVersionFinder.findNearestMatch Unable to find CDP implementation matching 103.
28-Jul-2022 10:55:03.674 WARNING [main] org.openqa.selenium.chromium.ChromiumDriver.lambda$new$3 Unable to find version of CDP to use for . You may need to include a dependency on a specific version of the CDP using something similar to `org.seleniumhq.selenium:selenium-devtools-v86:4.1.0` where the version ("v86") matches the version of the chromium-based browser you're using and the version number of the artifact is the same as Selenium's.
意味着ChromeDriver无法启动/生成新的浏览上下文,即谷歌chrome会话。
您的主要问题是所使用的二进制文件版本之间存在不兼容性。
解决方案
确保:
- Selenium升级到当前发布的版本4.3.0
- ChromeDriver已更新到当前的ChromeDriver v103.0级别
- Chrome浏览器更新为当前Chrome=103.0(根据chromedriver=103.0.5060.53发布说明(