Firefox Driver fails with org.openqa.selenium.SessionNotCreatedException: - java

I am getting this exception when running tests in Firefox.
com.codeborne.selenide.ex.SoftAssertionError: Test DraftTest.setUp failed (3 failures)
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
at com.codeborne.selenide.logevents.ErrorsCollector.cleanAndGetAssertionError(ErrorsCollector.java:64)
at com.codeborne.selenide.testng.SoftAsserts.failIfErrors(SoftAsserts.java:91)
at com.codeborne.selenide.testng.SoftAsserts.onConfigurationFailure(SoftAsserts.java:46)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
Firefox version: 98.0.1
Selenide version: 6.3.4 (Selenium 4.1.2)

I was getting the same error running my tests using Selenium 4.3.0 and Firefox 91.6. I downloaded the latest geckodriver from here (0.31.0 at the time of this writing) and that resolved the issue for me.

Related

Getting timeout on my OnePlus 5T while running Appium

I am using Appium version 1.15.0 and while running my Appium app automation suite on my OnePlus 5T, I am getting error : An unknown server-side error occurred while processing the command. Original error: Failed to launch Appium Settings app: Condition unmet after 5441 ms. Timing out.

Why are selenium ChromeDriver create null session in unix base OSs?

I developed a app to read some web pages using Selenium.
ChromeDriver on windows worked correctly but in unix base Oss (Mac & Centos7) does not worked!
I think a problem is "Forwarding newSession on session null to remote" in the unix base OSs.
Some warnings and info when I ran app in unix base OSs are as bellow:
Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005#{#819}) on port 53751
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1658989503.540][WARNING]: This version of ChromeDriver has not been tested with Chrome version 103.
28-Jul-2022 10:55:03.613 INFO [Forwarding newSession on session null to remote] org.openqa.selenium.remote.ProtocolHandshake.createSession Detected dialect: W3C
28-Jul-2022 10:55:03.673 WARNING [main] org.openqa.selenium.devtools.CdpVersionFinder.findNearestMatch Unable to find an exact match for CDP version 103, so returning the closest version found: a no-op implementation
28-Jul-2022 10:55:03.673 INFO [main] org.openqa.selenium.devtools.CdpVersionFinder.findNearestMatch Unable to find CDP implementation matching 103.
28-Jul-2022 10:55:03.674 WARNING [main] org.openqa.selenium.chromium.ChromiumDriver.lambda$new$3 Unable to find version of CDP to use for . You may need to include a dependency on a specific version of the CDP using something similar to `org.seleniumhq.selenium:selenium-devtools-v86:4.1.0` where the version ("v86") matches the version of the chromium-based browser you're using and the version number of the artifact is the same as Selenium's.
Are there any solutions to resolve ChromeDriver error?
If you have any suggestions that can be help me, please add comment or answer.
Thanks.
This error message...
Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005#{#819}) on port 53751
.
[1658989503.540][WARNING]: This version of ChromeDriver has not been tested with Chrome version 103.
.
28-Jul-2022 10:55:03.613 INFO [Forwarding newSession on session null to remote] org.openqa.selenium.remote.ProtocolHandshake.createSession Detected dialect: W3C
28-Jul-2022 10:55:03.673 WARNING [main] org.openqa.selenium.devtools.CdpVersionFinder.findNearestMatch Unable to find an exact match for CDP version 103, so returning the closest version found: a no-op implementation
28-Jul-2022 10:55:03.673 INFO [main] org.openqa.selenium.devtools.CdpVersionFinder.findNearestMatch Unable to find CDP implementation matching 103.
28-Jul-2022 10:55:03.674 WARNING [main] org.openqa.selenium.chromium.ChromiumDriver.lambda$new$3 Unable to find version of CDP to use for . You may need to include a dependency on a specific version of the CDP using something similar to `org.seleniumhq.selenium:selenium-devtools-v86:4.1.0` where the version ("v86") matches the version of the chromium-based browser you're using and the version number of the artifact is the same as Selenium's.
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. google-chrome session.
Your main issue is the incompatibility between the version of the binaries you are using.
Solution
Ensure that:
Selenium is upgraded to current released Version 4.3.0.
ChromeDriver is updated to current ChromeDriver v103.0 level.
Chrome Browser is updated to current chrome=103.0 (as per chromedriver=103.0.5060.53 release notes).

java.lang.RuntimeException: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally

I trying to render the webpage using chromedriver on centos7.I have installed both google-chrome and chromedriver .I am starting the chromedriver using the following command.
$ chromedriver --port=9515 --headless --whitelisted-ips="myip" --disable-dev-shm-usage --log-path='chrome.log'
Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}) on port 9515
Remote connections are allowed by a whitelist (myip).
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
I am running the google chrome using the following command
$ google-chrome --headless --remote-debugging-port=9222 --disable-gpu
xcb_connection_has_error() returned true
DevTools listening on ws://127.0.0.1:9222/devtools/browser/cf6b15dd-0e37-4106-88ed-01b959252da4
Here we have google-chrome and chromedriver running.But when my Java application try to connect to the port at which the chromedriver is running i am getting the following error
java.lang.RuntimeException: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}),platform=Linux 3.10.0-862.3.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
I have tried out the same in my windows environment it works fine.
version:
ChromeDriver 74.0.3729.6
Google Chrome 74.0.3729.131

Selenium UnreachableBrowserException - "Could not start a new session" in SoapUI Groovy TestStep

I use SoapUI Pro 5.1.2 on Win7 x32, and try to connect to Selenium Webdriver in Groovy TestStep.
For this purpose I added selenium-standalone-server.jar v2.45.0 in $SOAP_HOME$\bin\ext folder.
My Groovy TestStep code:
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
System.setProperty('webdriver.chrome.driver', 'C:\\\\Windows\\system32\\chromedriver.exe')
log.info(System.getProperty('webdriver.chrome.driver')) //got 'C:\\Windows\system32\chromedriver.exe'
WebDriver driver = new ChromeDriver() // this line causes error
driver.get('http://google.com')
driver.quit()
When I try to run this step, SoapUI returns message:
org.openqa.selenium.remote.UnreachableBrowserException:
Could not start a new session.
Possible causes are invalid address of the remote server or browser start-up failure.
Build info:
version: '2.45.0',
revision: '5017cb8',
time: '2015-02-26 23:59:50'
System info:
host: 'SmithPC',
ip: '10.0.2.15',
os.name: 'Windows 7',
os.arch: 'x86',
os.version: '6.1',
java.version: '1.8.0_45'
Driver info:
driver.version: ChromeDriver
error at line: 7
I tried to run this piece of code through the Netbeans IDE, after adding the same selenium-standalone-server.jar package to empty java project. And it has completed without problems!
This is error-log of soapUI:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'SmithPC', ip: '10.0.2.15', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:160)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
at Script3.run(Script3.groovy:7)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:79)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:138)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:79)
at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:77)
at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:183)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:126)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:72)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:133)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:66)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
... 23 more
I also tried use FirefoxDriver() instead of ChromeDriver(), and got the same error.
I have encountered the same error, which said:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
but chromedriver.exe started fine. I can see it in task manager.
My environment is as following,
windows 7, ultimate, 64 bit system
selenium-server-standalone-2.47.1
chromedriver 2.19
google chrome: 45.0
After many tries suggested in google results, my final solution is to add 127.0.0.1 localhost to C:\Windows\System32\drivers\etc\hosts.
Hope to help you!
Download latest driver(chrome or IE) from seleniumhq.org, and use below code
System.setProperty("webdriver.chrome.driver","<YourPath>chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://www.yahoo.com");
This worked for me.
In selenium this error message:
org.openqa.selenium.remote.UnreachableBrowserException: Could not
start a new session. Possible causes are invalid address of the remote
server or browser start-up failure.
Could have a lot of causes. However looking at the stacktrace in this case is due to a NullPointerException:
Caused by: java.lang.NullPointerException
at org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:79)
at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:77)
at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124)
The problem is that you're using selenium inside SOAPUI. SOAPUI seems to set the default proxy to null (ProxySelector.setDefault(null)). So when selenium gets the default proxy an invoke a method on it, a NullPointerException is thrown.
The problem is that you executes your code inside SOAPUI so you can not get the default proxy before SOAPUI set it to null... then a possible workaround is in your Groovy testStep try to create a ProxySelector an set it as default before WebDriver is executed:
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import java.net.Proxy
import java.net.ProxySelector
def selectDirectProxy(URI uri) {
final List<Proxy> proxy = new ArrayList<Proxy>()
proxy.add(Proxy.NO_PROXY)
return proxy
}
// create a ProxySelector
ProxySelector proxySelector = [ select : { uri->selectDirectProxy(uri) } ] as ProxySelector
// set as default to avoid null pointer
ProxySelector.setDefault(proxySelector);
// now it's safe to invoke WebDriver...
System.setProperty('webdriver.chrome.driver', 'C:\\\\Windows\\system32\\chromedriver.exe')
log.info(System.getProperty('webdriver.chrome.driver')) //got 'C:\\Windows\system32\chromedriver.exe'
WebDriver driver = new ChromeDriver()
In this example I extend the ProxySelector abstract class in a groovy way, to set at least one direct proxy. If its necessary it's also possible to use the Proxy class to configure a no direct proxy and set it in the list, but with this code I'm trying to avoid the NPE due to SOAPUI ProxySelector.setDefault(null).
It already told you what happened:
//got 'C:**\\**Windows\system32\chromedriver.exe'
Try to define path using one of the next ways:
System.setProperty('webdriver.chrome.driver','C:\\Windows\\system32\\chromedriver.exe')
log.info(System.getProperty('webdriver.chrome.driver'))
OR
System.setProperty('webdriver.chrome.driver','C:/Windows/system32/chromedriver.exe')
log.info(System.getProperty('webdriver.chrome.driver'))
Also, I would not recommend you to store chromedriver.exe in system32 folder, especially if you don't have admin rights on the workstation. Use smt like C:/WebDrivers/hromedriver.exe
This could be a compatibility issue between the 'selenium', 'chrome browser version' and 'chrome driver' version that you are using.
It you are using Selenium 2.53 (like me), then using chrome driver 2.25 should work for you.
You can download it from here - https://chromedriver.storage.googleapis.com/index.html?path=2.25/
I encountered the same issue and upgrading to the latest chrome driver fixed my issue.
You can download the latest chrome driver from following URL.
http://chromedriver.storage.googleapis.com/index.html
It is best to use always the latest version. After downloading, set the path of chrome driver in System.setProperty("webdriver.chrome.driver","{Your path Chrome Driver}");
System.out.println("Creating Chrome Driver");
// Set Chrome Driver
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("{Your URL}");
This problem is totally related to the chrome browser version and chrome driver version.
Once you keep both browser and driver versions the same, your problem will get resolved.
To check the chrome version go to the following steps ->> Click on three vertical dots ->> Help ->> About Google Chrome Browser ->> see the chrome version.
Now check the chrome BROWSER version
in my case browser version is 90.0
Now download the same version of the chrome driver respective of the operating system
We will download the 90.0 version of driver, then set the browser path
System.setProperty("webdriver.chrome.driver", "D:\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("{Your URL}")
#JAVA #SELENIUM
If someone encountered a similar problem on Ubuntu, please check if you install Chromium web browser
Not enough to have only chrome browser.
More details

Selenium - Firefox compatibility issue , Error ("Unable to connect to host 127.0.0.1 ....")

I am using selenium webdriver-2.42.2 and Firefox 29.1 with java as programming language.
Previously I was using Firefox 33.1, which resulted in error -
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
e addon app-profile:fxdriver#googlecode.com visible...
I downgraded the firefox version to 29.1. At first it worked but now, it is again showing the same error. Can anyone suggest another solution than changing the versions.

Categories

Resources