Unable to run the selenium script while connected to the LAN

做~自己de王妃 提交于 2019-12-12 17:36:04

问题


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

回答1:


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.


来源:https://stackoverflow.com/questions/48824322/unable-to-run-the-selenium-script-while-connected-to-the-lan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!