Selenium ChromeDriver not Loading - java

Does anyone have a solution for this problem?
The driver is instantiated and the browser is opened, but then I get the following error:
[01:53:15,339] INFO [CheckOut-0] - ####### Test 'MyTestCases.CheckOut' started
Starting ChromeDriver (v2.9.248304) on port 17682
May 26, 2017 1:53:16 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
[0.183][WARNING]: PAC support disabled because there is no system implementation
May 26, 2017 1:53:18 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
[01:53:20,832] INFO [CheckOut-0] - ####### Test 'MyTestCases.CheckOut' finished after 5491 ms
[01:53:20,838] INFO [CheckOut-0] - Cleaning up ...
enter image description here

I found Solution for the Problem. I had Old Libraries and replaced it with Selenium Libraries from Here and it worked.

Related

Attempting bi-dialect session, assuming Postel's Law holds true on the remote end & Falling back to original OSS JSON using ChromeDriver and Selenium

Below is a snippet of code I'm using to initialize chrome webdriver:
System.out.println("Initializing Chrome");
ChromeOptions options = new ChromeOptions();
//options.setBinary("C:/Program Files (x86)/Google/Chrome/Application");
options.addArguments("start-maximized");
options.setExperimentalOption("excludeSwitches",new String[]{"enable-automation"});
options.addArguments("--disable-extensions");
options.addArguments("--disable-infobars");
options.addArguments("--allow-running-insecure-content");
WDriver = new ChromeDriver(options);
//WDriver = new ChromeDriver();
WDriver.manage().timeouts().implicitlyWait(60,TimeUnit.SECONDS);
System.out.println("Chrome Initialization Complete");
But it seems to be opening two instances of chrome, this is displayed on the console:
Initializing Chrome
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-
heads/3904#{#800}) on port 12262
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious
code.
Nov 04, 2019 3:29:38 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
log4j:WARN No appenders could be found for logger
(org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[1572910181.451][WARNING]: Timed out connecting to Chrome, retrying...
Nov 04, 2019 3:29:43 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
[1572910186.002][WARNING]: Timed out connecting to Chrome, retrying...
Nov 04, 2019 3:29:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Chrome Initialization Complete
Chrome Version: 78.0.3904.87
Chromedriver Version: chromedriver_78.0.3904.70
Selenium Version: 3.141.59
While the issue is not a major roadblock it is a bit annoying that it opens a 2nd instance of chrome that will eat memory while it is on standby.
Cheers.
There are a couple of things you need to take care:
This error message...
Nov 04, 2019 3:29:38 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
As per the discussion Attempting bi-dialect session, assuming Postel's Law holds true on the remote end thread 'webdriver dispatcher' panicked at 'index out of bounds: the len is 0 but the index is 0 this issue was observed with Selenium Client v3.0.0-beta3 which was released on 2016-09-01 14:57:03 -0700.
Simon in a comment mentioned that:
The root cause was a ClassCastException. We now catch that exception, log the thing that we were trying to parse and continue with other attempts to complete the handshake. The fix was available in Selenium Client v3.0.0-beta4.
The most appropriate solution would have been to:
Upgrade Selenium to current level of Version 3.141.59.
You can find a detailed discussion in org.openqa.selenium.remote.ProtocolHandshake createSession INFORMATION: Attempting bi-dialect session with Selenium Grid
The next error message...
Nov 04, 2019 3:29:43 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
[1572910186.002][WARNING]: Timed out connecting to Chrome, retrying...
Nov 04, 2019 3:29:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
...also implies that the ChromeDriver/Chrome Browser combo you are using is not the recent one as the current implementation of ChromeDriver follows W3C and initial logs are as follows:
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904#{#800}) on port 9626
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Nov 05, 2019 3:41:53 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Solution
Ensure that:
JDK is upgraded to current levels JDK 8u222.
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v78.0 level.
Chrome is updated to current Chrome Version 78.0 level. (as per ChromeDriver v78.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
(WindowsOS only) Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
(LinuxOS only) Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint before and after the execution of your Test Suite.
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 non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
References
You can find some relevant discussion in:
Issue 1504: Unable to Open latest chrome using latest Selenium.
Issue 1451: Chrome 54+ session not created exception: Runtime.executionContextCreated has invalid 'context'
Outro
As per this jar-download.com article the createSession() in ProtocolHandshake.java file of Selenium v3.0.1 contained the following:
public Result createSession(HttpClient client, Command command)
throws IOException {
// Avoid serialising the capabilities too many times. Things like profiles are expensive.
Capabilities desired = (Capabilities) command.getParameters().get("desiredCapabilities");
desired = desired == null ? new DesiredCapabilities() : desired;
Capabilities required = (Capabilities) command.getParameters().get("requiredCapabilities");
required = required == null ? new DesiredCapabilities() : required;
String des = new BeanToJsonConverter().convert(desired);
String req = new BeanToJsonConverter().convert(required);
// Assume the remote end obeys the robustness principle.
StringBuilder parameters = new StringBuilder("{");
amendW3CParameters(parameters, des, req);
parameters.append(",");
amendOssParamters(parameters, des, req);
parameters.append("}");
LOG.info("Attempting bi-dialect session, assuming Postel's Law holds true on the remote end");
Optional result = createSession(client, parameters);
// Assume a fragile OSS webdriver implementation
if (!result.isPresent()) {
parameters = new StringBuilder("{");
amendOssParamters(parameters, des, req);
parameters.append("}");
LOG.info("Falling back to original OSS JSON Wire Protocol.");
result = createSession(client, parameters);
}
// Assume a fragile w3c implementation
if (!result.isPresent()) {
parameters = new StringBuilder("{");
amendW3CParameters(parameters, des, req);
parameters.append("}");
LOG.info("Falling back to straight W3C remote end connection");
result = createSession(client, parameters);
}
if (result.isPresent()) {
Result toReturn = result.get();
LOG.info(String.format("Detected dialect: %s", toReturn.dialect));
return toReturn;
}
throw new SessionNotCreatedException(
String.format(
"Unable to create new remote session. " +
"desired capabilities = %s, required capabilities = %s",
desired,
required));
}

while doing selenium testing-- I am getting an error

[0.228][SEVERE]: bind() returned an error, errno=98: Address already in use (98)
Nov 20, 2017 1:03:49 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
when you try to run multiple services on same port number, you will get binding error . From your logs, it is evident that A service is already running on the specific port number on which you fired up selenium server . Change the port number.
--httpPort=9000
Download the latest version of chrome driver and set the property .
You can download from here https://sites.google.com/a/chromium.org/chromedriver/

Cannot run selenium java program after adding 3.0 jar file

I updated my project to use Marionette/gecko and when I try to run it I get this message:
1477424937782 geckodriver INFO Listening on 127.0.0.1:11146
Oct 25, 2016 3:48:58 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1477424938364 mozprofile::profile INFO Using profile path C:\Users\Janet\AppData\Local\Temp\rust_mozprofile.iMfi1TUVjDFi
1477424938367 geckodriver::marionette INFO Starting browser C:\Program Files\Mozilla Firefox\firefox.exe
1477424938372 geckodriver::marionette INFO Connecting to Marionette on localhost:50333
1477424939344 Marionette INFO Listening on port 50333
Oct 25, 2016 3:49:01 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
JavaScript warning: https://normandy.cdn.mozilla.net/static/bundles/selfrepair-910943d53dbd84b4c75a.a958f9d28733.js, line 7: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
Element users was not found
use below code. You need to set the system property so that your geckodriver can be located
System.setProperty("webdriver.gecko.driver", "C:\\Selenium\\geckodriver.exe");
driver = new MarionetteDriver();

Google Appengine: Unable to Vacuum Indexes

After reaching the 200 limit of indexes, i need to vacuum the indexes of my application.
Using AppEngine 1.8.6, if I launch the usual command for this operation
..\appengine-java-sdk-1.8.6\bin\appcfg.cmd vacuum_indexes C:\MyGaeProject\war
I get the following error
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) r
eturned error code 5.
Reading application configuration data...
ott 23, 2013 2:49:30 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed C:\MyGaeProject\war\WEB-INF/appengine-web.xml
ott 23, 2013 2:49:30 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\MyGaeProject\war\WEB-INF/web.xml
ott 23, 2013 2:49:30 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\MyGaeProject\war\WEB-INF/cron.xml
ott 23, 2013 2:49:30 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\MyGaeProject\war\WEB-INF/queue.xml
ott 23, 2013 2:49:30 PM com.google.apphosting.utils.config.IndexesXmlReader readConfigXml
INFO: Successfully processed C:\MyGaeProject\war\WEB-INF/datastore-indexes.xml
Beginning interaction for module default...
10% Found 79 local index definitions.
Error Details:
Line 0, column 12: Unable to find property 'application' on class: com.google.apphosting.utils.config.IndexYamlReader$In
dexYaml
Unable to perform vacuum_indexes
Unable to perform vacuum_indexes
Please see the logs [C:\UserTemp\appcfg6705503051002284735.log] for further information.
PS C:\Program Files (x86)\appengine-java-sdk-1.8.6\bin> .\appcfg.cmd vacuum_indexes "C:\MyGaeProject\war"
ott 23, 2013 2:50:18 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Reading application configuration data...
ott 23, 2013 2:50:19 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed C:\MyGaeProject\war\WEB-INF/appengine-web.xml
ott 23, 2013 2:50:19 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\MyGaeProject\war\WEB-INF/web.xml
ott 23, 2013 2:50:19 PM com.google.apphosting.utils.config.IndexesXmlReader readConfigXml
INFO: Successfully processed C:\MyGaeProject\war\WEB-INF/datastore-indexes.xml
Beginning interaction for module default...
10% Found 0 local index definitions.
Error Details:
Line 0, column 12: Unable to find property 'application' on class:
com.google.apphosting.utils.config.IndexYamlReader$IndexYaml
Unable to perform vacuum_indexes
Unable to perform vacuum_indexes
For testing purpose, I also tried and empty datastore-indexes.xml, but nothing
Even using Linux I get the same error
Same thing with Python
02:39 PM Application: my-gae-app
02:39 PM Host: appengine.google.com
02:39 PM Fetching index definitions diff.
Email: my-gae-email
Password for my-gae-email:
Error parsing yaml file:
Unexpected attribute 'application' for object of type IndexDefinitions.
in "<string>", line 2, column 14:
application: null
^
As i can read, i'm not the only one experiencing this error
Already tried with older SDKs of Java, an new blank project and another GAE application, same problems so far
EDIT:
I updated Python SDK to latest version (1.8.6, was 1.8.5), the error above is not shown anymore, but now i'm getting another error
Error 400: --- begin server output ---
Client Error (400)
The request is invalid for an unspecified reason.
--- end server output ---
Updating to the latest SDK [1.8.6] may resolve this.
I resolved the issue for Python SDK by installing the latest SDK.
The issue I met is:
Error parsing yaml file:
Unexpected attribute 'application' for object of type IndexDefinitions.
in "<string>", line 2, column 14:
application: null
^
For GAE/J, I use a command of the form (without the drive specifier):
appcfg.cmd --email=[E-mail address] vacuum_indexes "\MyGaeProject\war"
without problem (but I have not had to use this for some time). Obviously, you can omit the --email parameter, but you might want to try without the drive specifier (and quote the war folder just for fun).
You may have two options: 1. wait for the next sdk with bug fixes, or 2. open a ticket as specified here: https://code.google.com/p/googleappengine/issues/detail?id=10168

Why would App Engine Web Application terminate unexpectedly?

I just got prompted for a Java update on my iMac machine. After the java update, my App Engine based Web Application (in Eclipse) won't start anymore.
The following was in the console (as usual) when I tried to debug it as Web Application:
<terminated exit value:139> myapp [Web Application] /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java (Mar 13,2011 7:20:27 pm)
2011-03-13 19:20:28.193 java[1772:903] [Java CocoaComponent compatibility mode]: Enabled
2011-03-13 19:20:28.194 java[1772:903] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
Mar 14, 2011 2:20:29 AM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Mar 14, 2011 2:20:29 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed /Users/tom/Workspace/myapp/war/WEB-INF/appengine-web.xml
Mar 14, 2011 2:20:29 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed /Users/tom/Workspace/myapp/war/WEB-INF/web.xml
Mar 13, 2011 7:20:30 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:8081/
And then the app just stops. The termination value seem to be 139. Why does this happen and how can I fix it?
Deleting the Java cache folder (~/Library/Caches/Java) (as posted in tom's link to the groups discussion) - although temporarily successful - did't solve the problem.
After re-installing the previous Java version, the eclipse GAE environment worked without any problems.

Categories

Resources