Java-Opencv(chromedriver) Forwarding newSession on session null to remote 解决方案

环境:tomcat9.0.x+jdk 1.8.x +opencv 451 + chrome 88.0.4324.104(selenium-server-standalone-3.141.59.jar)  在本机运行正常,放到阿里云服务器就报错!!!

selenium操作chrome浏览器需要有ChromeDriver驱动来协助。

效果:chrome浏览器一打开就自动关闭了.....

 

以下是本机运行提示

Starting ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784}) on port 28388
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
二月 03, 2021 11:54:22 上午 org.openqa.selenium.remote.ProtocolHandshake createSession
信息: Detected dialect: W3C

 

阿里云服务器就报错

Starting ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784}) on port 28388
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
org.openqa.selenium.remote.ProtocolHandshake createSession(无这一行,且显示了下面这行)

二月 03, 2021 11:56:22 上午 信息:[Forwarding newSession on session null to remote] org.openqa.selenium.remote.ProtocolHandshake.createSession Detected dialect: W3C

 

org.openqa.selenium.remote.ProtocolHandshake createSession是Selenium WebDriver中的一个常见错误,通常是由于Webdriver与浏览器版本不兼容或由于ChromeDriver或FirefoxDriver等驱动程序版本过旧引起的。

以下是一些可能的解决方案:

  1. 更新Webdriver和浏览器到最新版本。请注意,您需要使用与您的浏览器版本相对应的Webdriver版本。例如,如果您使用Chrome浏览器版本90,则需要使用ChromeDriver版本90。

  2. 如果您在本地使用Webdriver,则可以尝试关闭防火墙或网络代理,或将防火墙或代理配置为允许Webdriver访问本地端口。

  3. 如果您使用的是远程Webdriver,可以尝试检查网络连接是否正确,并确保远程Webdriver正在正确的端口上运行。

  4. 检查您的代码是否正确地使用了WebDriver实例。确保在实例化WebDriver对象后使用它来打开浏览器,而不是创建多个实例并在不同的线程中使用它们。

希望这些解决方案可以帮助您解决org.openqa.selenium.remote.ProtocolHandshake createSession错误。

 

posted @ 2021-02-03 12:18  锐洋智能  阅读(936)  评论(8编辑  收藏  举报