连接到LAN时无法运行Selenium脚本 [英] Unable to run the selenium script while connected to the LAN

查看:87
本文介绍了连接到LAN时无法运行Selenium脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在连接到LAN时无法运行Selenium脚本,但是在连接到WIFI时可以正常工作.我将所有代理设置保持不变. 下面是代码:

    String exePath = "/usr/local/bin/chromedriver";
    System.setProperty("webdriver.chrome.driver", exePath);
    WebDriver driver = new ChromeDriver();
    driver.get("https://www.google.com");

OS:Mac 10.11.6 硒2.53 还尝试了3.8.1 ChromeDriver:2.33.2 铬:V60. Eclipse氧气.

获取以下提到的错误消息:

Starting ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 21777
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.65 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
System info: host: '01hw382197', ip: '172.25.155.171', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '9.0.4'
Driver info: org.openqa.selenium.chrome.ChromeDriver

解决方案

错误说明了一切:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.65 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'

主要原因是您使用的二进制文件与不兼容一样:

  • 您正在使用(2017-10-03)
  • 中的 ChromeDriver v2.33
  • 您的 Chrome浏览器版本是 60.x
  • 您的 Selenium Client 版本是时间的 2.53.1 :'2016-06-30 17:32:46'
  • >

因此,发布 Selenium Client v2.53.1 ChromeDriver v2.33 的时间间隔将近 2年 >

解决方案

  • 将您的 Selenium Client 升级到最新的 Selenium v​​3.9.1 级别.
  • 将您的 ChromeDriver 升级到最新的 ChromeDriver = 2.35 级别.
  • 根据 ChromeDriver = 2.35 Chrome浏览器升级到 Chrome v62-64 级别.
  • 如果您的基本 Chrome浏览器版本太旧,请通过Chrome浏览器 ="nofollow noreferrer"> Revo卸载程序 ,并安装最新版本的 Chrome浏览器
  • 定期运行 CCleaner 工具,以清除之前所有的操作系​​统杂项在执行您的 Test Suite
  • 之后
  • 执行您的测试

更新

正如您提到的,在连接到LAN时无法运行脚本,但是在连接到WIFI时可以正常运行,您需要确保以下几点:

  • WebDriver 变体( GeckoDriver / ChromeDriver / IEDriverServer )使用的端口局域网上的软件/服务.
  • LAN管理员没有出于特定目的阻止端口(端口范围).
  • 防火墙已禁用.

Unable to run the selenium script while connected to the LAN, however it works fine when connected to the WIFI. I have kept all the proxy settings same. Below is the code:

    String exePath = "/usr/local/bin/chromedriver";
    System.setProperty("webdriver.chrome.driver", exePath);
    WebDriver driver = new ChromeDriver();
    driver.get("https://www.google.com");

OS: Mac 10.11.6 Selenium: 2.53 Also tried with 3.8.1 ChromeDriver: 2.33.2 Chrome: V60. Eclipse Oxygen.

Getting Below mentioned error message:

Starting ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 21777
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.65 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
System info: host: '01hw382197', ip: '172.25.155.171', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '9.0.4'
Driver info: org.openqa.selenium.chrome.ChromeDriver

解决方案

The error says it all :

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=60.0.3112.113)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.65 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'

The main reason is the binaries you are using are incompatible as :

  • You are using ChromeDriver v2.33 of (2017-10-03)
  • Your Chrome Browser version is 60.x
  • Your Selenium Client version is 2.53.1 of time: '2016-06-30 17:32:46'

So there is a time gap of almost 2 years between the release of Selenium Client v2.53.1 and ChromeDriver v2.33

Solution

  • Upgrade your Selenium Client to recent Selenium v3.9.1 level.
  • Upgrade your ChromeDriver to recent ChromeDriver=2.35 level.
  • As per the Release Notes of ChromeDriver=2.35 upgrade your Chrome Browser to Chrome v62-64 levels.
  • If your base Chrome Browser version is too old uninstall Chrome Browser through Revo Uninstaller and install a recent released GA version of Chrome Browser
  • Run CCleaner tool regularly to wipe off all the OS chores before and after the execution of your Test Suite
  • Execute your Tests

Update

As you mentioned you are unable to run the script while connected to the LAN but works fine when connected to the WIFI you need to ensure the following :

  • Ports used by the WebDriver variants (GeckoDriver / ChromeDriver / IEDriverServer) are not used by any other Software/Services over the LAN.
  • Ports (range of ports) are not blocked by the LAN Admins for specific purpose.
  • Firewall is disabled.

这篇关于连接到LAN时无法运行Selenium脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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