Unable to run the selenium script while connected to the LAN - selenium

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.

Related

Driver info: driver.version: unknown (Behat\Mink\Exception\DriverException) error with Selenium and Geckodriver

Here's the situation: I'm using Behat to run acceptance tests on Symfony. To do so, I start a Selenium instance with the Geckodriver, then I run Behat. Everything works fine on local (great!).
But when it runs on Github action, it fails. I've check the versions, I've even versioned the geckodriver and selenium.jar files to use exactly the same (despite they already exist on github action), but nothing works.
So I'm looking for any help to debug this error. Here's the commands and their results:
$ java -jar -Dwebdriver.gecko.driver=/usr/local/share/gecko_driver /usr/share/java/selenium-server-standalone.jar &
14:19:46.106 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
14:19:46.369 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-05-29 14:19:46.780:INFO::main: Logging initialized #1350ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:19:47.657 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
14:19:47.758 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
./vendor/bin/behat -s acceptance
Could not open connection: Unable to create new service: GeckoDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'fv-az33', ip: '10.1.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '5.3.0-1022-azure', java.version: '1.8.0_252'
Driver info: driver.version: unknown (Behat\Mink\Exception\DriverException)
This error message...
Driver info: driver.version: unknown (Behat\Mink\Exception\DriverException)
...implies that the GeckoDriver wasn't recognized back by the Browsing Context i.e. Firefox browser.
Solution
Ensure that:
JDK is upgraded to current levels JDK 8u251.
Selenium is upgraded to current levels Version 3.141.59.
GeckoDriver is upgraded to GeckoDriver v0.26.0 level.
Firefox is upgraded to current Firefox v76.0 levels.
GeckoDriver is present in the desired location.
GeckoDriver is having executable permission for non-root users.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your Test as a non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
Reference
You can find a couple of relevant discussions in:
Driver info: driver.version: unknown with ChromeDriver Chrome using Selenium and Python
Ok, I've just solved my problem. I think this is due to two things:
First, I was not using the headless mode. I don't know to set it using Geckodriver because I'm finally using Chromedriver
Second, the github action's doc is misleading. It says 'Chrome Driver is available via CHROMEWEBDRIVER environment variable', but in fact it's only the directory which is in the env var. So the path of the driver is $CHROMEWEBDRIVER/chromedriver (same for $GECKOWEBDRIVER)
For info, here's my config of behat:
javascript_session:
selenium2:
browser: chrome
capabilities:
chrome:
switches:
- "--headless"
- "--disable-gpu"
And to run Selenium:
java -Dwebdriver.chrome.driver=$CHROMEWEBDRIVER/chromedriver -jar $SELENIUM_JAR_PATH &

ChromeDriver crashes and does not create a session when chrome is already open in selenium-jvm

There are two parts of this problem -
When a chrome browser is already open and I trigger my selenium-java test case to run against the chrome it doesn't open a new chrome session.
It uses the existing chrome which is open and starts opening new tabs but still doesn't work.
My driver initialization looks like as below :
System.setProperty("webdriver.chrome.driver", ConfigUtils.getCurrentDirectory()+ Chromefile.getPath());
ChromeOptions options = new ChromeOptions();
//options.addArguments("--headless");
options.addArguments("--no-sandbox");
options.addArguments("start-maximized");
options.addArguments("disable-infobars");
options.addArguments("disable-extensions");
options.setExperimentalOption("useAutomationExtension", false)
driver = new ChromeDriver(options);
I have tried couple of things suggested on Stack Overflow -
Someone described that this is a problem because chromedriver cannot spin up another instance of chrome - default profile. So I have added the following line in the above code -
String profile1 = "C:\\Users\\user_id\\Documents\\ChromeProfile1\\";
options.addArguments("user-data-dir="+profile1);
This was done so that chromedriver could launch a new profile of chrome. And it does open a new chrome window but didn't navigated to the URL.
As per the official documentation of chromedriver -
By default, ChromeDriver will create a new temporary profile for each
session.
And I never has to do this before. I am not sure why this is not working and what else can I do?
I am using -
Selenium-java version 3.141.1
ChromeDriver version 2.38
Chrome version 70
Windows 10
Please note-
The chrome and chromedriver version I have mentioned above are compatible and working fine when chrome is not already running Also, I can run the same test in headless mode while chrome window is already open.
let me know if you need anymore info. Error I am getting is as below-
Starting ChromeDriver 2.38.552522
(437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 18020 Only local
connections are allowed. org.openqa.selenium.WebDriverException:
unknown error: Chrome failed to start: crashed (Driver info:
chromedriver=2.38.552522
(437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT
10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 61.87 seconds Build info:
version: '3.141.5', revision: 'd54ebd709a', time:
'2018-11-06T11:42:16' System info: host: 'XXXX', ip: 'XXXX', os.name:
'Windows 10', os.arch: 'x86', os.version: '10.0', java.version:
'1.8.0_162' Driver info: driver.version: ChromeDriver
ChromeDriver 2.38 only supports Chrome 65 through 67. Please see the release notes at https://chromedriver.storage.googleapis.com/2.38/notes.txt. It may happen to work with some other versions of Chrome under certain conditions, but such usage is unsupported. It is recommended to use ChromeDriver 2.44 with Chrome 70.
I don't see any problems with the code you posted. Hopefully you'll be able to get better results after downloading a newer ChromeDriver.

connection refused when running selenium tests in marionette

I have selenium 2.53.1 tests running on the marionette web driver, I get the following error when running the tests. I have the geckodriver executable installed at /opt/
Caused by: org.openqa.selenium.WebDriverException: The driver server has unexpectedly died!
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'or1010050252127.corp.test.com', ip: '10.50.252.127', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-74-generic', java.version: '1.7.0_111'
Driver info: driver.version: MarionetteDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:88)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
... 19 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:7048 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused
I had the same problem with Selenium 2.53.1 and Firefox 48 - it turned out that they are not playing well with each other and I had to revert to Firefox 47 - it worked well there.
Marionette/Geckodriver will be used by default in Selenium 3 (still in beta, requires Java 8), in Selenium 2 you have to explicitly request it's usage - by default Selenium uses internal Firefox driver, not compatible with Firefox 48. See c# Selenium 2.53 moving to marionette driver after firefox upgrade to 47 for details of enabling Marionette.
Additionally, Marionette and Geckodriver are not yet complete (here is the current status), so it may contain bugs and/or not have the features you need.

Selenium RC Safari Keyboard (SendKeys) not working

I'm running a Selenium RC 2.48.0 server on a Mac using the Safari plugin for Selenium 2.48.0. I'm running my tests on a PC in Visual Studio with Selenium.net 2.48.0 with a Remote web driver for Safari.
Here's how I create my Safari RC Remote web driver connection:
RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://192.168.50.13:4444/wd/hub"),DesiredCapabilities.Safari());
I try to send keys to the web driver using
driver.Keyboard.SendKeys("300001");
Problem: driver.Keyboard.SendKeys does not work. Instead they throw an exception. (The same commands work fine with a local Chrome Webdriver.
Selenium 2.48 is currently (at the time I'm writing this) the latest available Selenium version for Safari.
Here's the exception:
An exception of type 'System.InvalidOperationException' occurred in WebDriver.dll but was not handled in user code
Additional information: Unknown command: {"id":"15ugwifcwkos","name":"sendKeysToActiveElement","parameters":{"value":["3","0","0","0","0","1"]}} (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 4 milliseconds
Build info: version: '2.48.0', revision: 'b7b081a', time: '2015-10-07 15:48:56'
System info: host: '--------.local', ip: '192.168.50.13', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.2', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=9.0.2, cssSelectorsEnabled=true, platform=MAC, secureSsl=true}]
Session ID: null

Failed to connect to SafariDriver. Selenium 2.44.0 run via a daemon on OSX Yosemite & Safari 8

Im currently on Yosemite and Safari 8.
I keep getting this error:
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver after 10161 ms
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'TODIGWS000993.local', ip: 'xx.xx.xx.xx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.1', java.version: '1.8.0_25'
Driver info: driver.version: SafariDriver
at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:124)
at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:72)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:58)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:51)
... 14 more
18:42:43.408 WARN - Exception: Failed to connect to SafariDriver after 10161 ms
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'TODIGWS000993.local', ip: 'xx.xx.xx.xx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.1', java.version: '1.8.0_25'
Driver info: driver.version: SafariDriver
I am setting up my own grid and I'm using the standalone jar files (2.44.0). I am running the hub and node via daemons using launchd and a .plist file for each respectively.
All other browsers (FF and Chrome) load and run the tests fine.
I followed the instructions listed by
https://code.google.com/p/selenium/issues/detail?id=7933#c33
and successfully, manually, installed webdriver extension into the safari 8 browser
Initially when running selenium jars via daemons this did not work. But when i stopped the daemons and ran the jars (with the same arguments) using the logged in user the safari driver error went away and the safari browser loaded and ran the test.
I have tried with the argument
-Dwebdriver.safari.noinstall=true
but still no progress.
Have also set the daemon to have the same env variables as the logged in user that did successfully run the test but this also did not work.
Basically, the same command works when ran via the logged in user but not via a daemon. Any help will be greatly appreciated.
/usr/bin/java -jar /usr/lib/selenium/selenium-server-standalone-2.44.0.jar -port 5555 -role node -hub http://localhost:4444/grid/register -nodeConfig /usr/lib/selenium-code/osx/node_config.json -Dwebdriver.chrome.driver=/usr/lib/selenium/chromedriver
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'TODIGWS000993.local', ip: 'xxxxxxxx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.1', java.version: '1.8.0_25'
safari 8
Here are the logs from the safari driver:
18:40:41.78 [safaridriver.extension] Creating global session...
18:40:41.78 [safaridriver.extension.TabManager] Registering new tab
18:40:41.78 [safaridriver.extension.TabManager] Set command tab to hncoksu5irc9
18:40:41.78 [safaridriver.extension] Creating debug driver...
18:40:41.78 [safaridriver.extension] Waiting for connect command...
18:43:04.20 [safaridriver.extension.TabManager] Registering new tab
18:43:04.20 [safaridriver.extension.TabManager] Tab opened: wgoy5x4bmbnw
18:43:04.34 [safaridriver.extension.TabManager] Ignoring open window event
18:43:04.34 [safaridriver.extension.TabManager] Deleting entry for tab wgoy5x4bmbnw
18:43:04.89 [safaridriver.extension.Server] [wi8mei4r9u3q] Executing command: newSession
Thanks
I was facing the similar issue: createDriver
org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver after 10342 ms
To get it resolved after trying some things, I registered myself at the Apple Site for “Safari Developer Program” and generated a certificate to use in Safari. Installed the certificate in my Key-chain and added the Safari Extension to the browser.
Can refer the site for steps to proceed: https://rationaleemotions.wordpress.com/2012/05/25/working-with-safari-driver/
I am using software configurations like:
Selenium: selenium-server-standalone-2.43.1.jar
Safari: 7.1.3
Mac: 10.9.5
Even tested on latest Selenium 2.44.0 and Safari 8.0. This approach works.