Selenium Webdriver Unable to create new remote session on Firefox gecko driver - java

I am using selenium 2.53.1 and Mozilla 37.0. While executing script throws exception as below:
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=Firefox, moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}, version=, platform=ANY}], required capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}]
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'JAYANT-PC', ip: '192.168.132.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
How can avoid this Error?

Your gecko driver and selenium versions are possibly mismatched. Please refer to this github thread: https://github.com/SeleniumHQ/selenium/issues/3630

update your firefox and use selenium 3.3.1 and geckodriver 0.15.0,it will work

Related

Unable to Create New session with Microsoft Edge with desired capabilities

I am trying to create a Java test using Edge Webdriver and Edge version 86 (available to download).
I am using EdgeOptions as suggested on many threads here
System.setProperty("webdriver.edge.driver", "C:\\edgedriver\\msedgedriver.exe");
EdgeOptions edgeOptions = new EdgeOptions();
WebDriver driver = new EdgeDriver(edgeOptions);
driver.get("https://bing.com");
I get the below error when i execute the script
Error:
Starting MSEdgeDriver 86.0.622.43 (aecc56815110f44c6552813fdd27a416872192c8) on port 35032
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping MSEdgeDriver safe.
MSEdgeDriver was started successfully.
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}], required capabilities = Capabilities [{}]
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'XXXXXXXXXX', ip: 'XXXXXXX', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
Driver info: driver.version: EdgeDriver

Selenium Webdriver Problem cannot open google chrome

chrome driver 77
chrome version 77
Starting ChromeDriver 77.0.3865.40 (f484704e052e0b556f8030b65b953dce96503217-refs/branch-heads/3865#{#442}) on port 38929
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created
from disconnected: unable to send message to renderer
(Session info: chrome=77.0.3865.90)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'DESKTOP-JCFLT7B', ip: '192.168.1.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '10.0.2'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:
Versions of driver and of Chrome should match.
In Chrome, disable autoupdates. Otherwise after launching Chrome will be updated and can became incompatible with Java driver.

Cannot run my selenium tests on the edge webDriver

I'm using a macOS, I installed the Edge webdriver on it, configured its path on my selenium framework
But I got this error:
org.openqa.selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'MacBook-Pro-de-Sabrine-2.local', ip: 'fe80:0:0:0:4c2:e6bc:d2ff:348c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_191'
Driver info: driver.version: EdgeDriver
So you are using MAC. The problem is that the browser needs to be installed on your system in order to run it.
So if somehow you have installed it use the below code:
Code:
System.setProperty("webdriver.edge.driver","/YOUR_PATH");
WebDriver driver = new EdgeDriver();
driver.get("http://www.google.com");
OR
System.setProperty("webdriver.edge.driver","YOUR_PATH");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary("/YOUR_PATH");
EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
WebDriver driver = new EdgeDriver(edgeOptions);
driver.get("http://www.google.com");

SessionNotCreatedException: Unable to find a matching set of capabilities using SeleniumGrid with GeckoDriver Firefox through Java

Below code I written to open www.google.com under selenium standalone Grid environment. During the execution it shows error
CONFIGURATION:
OS: WINDOWS 10
BROWSER : FireFox (66.0.3)
Selenium Standalone Command:
java -Dwebdriver.gecko.driver=C:\eClipse\jar\Selenium\geckodriver\geckodriver.exe -jar selenium-server-standalone-3.141.59.jar -role standalone
ERROR:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'QAT2', ip: '10.1.6.79', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: unknown
I try to google this exception but not find any clue to solve it. Can I have any solution for this.
CODE:
public class GridSetup {
private String baseUrl ;
private String nodeURL ;
public WebDriver wDriver ;
public static void main() throws MalformedURLException{
baseUrl = "http://www.google.com";
nodeURL = "http://localhost:4444/wd/hub";
System.setProperty("webdriver.gecko.driver","C:\\eClipse \\geckodriver.exe");
DesiredCapabilities caps = DesiredCapabilities.firefox();
System.out.println( "#####################");
caps.setBrowserName("firefox");
caps.setCapability("marioneete", true);
caps.setPlatform(Platform.WIN10);
caps.setVersion("66.0.3");
wDriver = new RemoteWebDriver(new URL(nodeURL), caps);
wDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
wDriver.get(baseUrl);
}
}
This error message...
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'QAT2', ip: '10.1.6.79', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: unknown
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Your Selenium Client version is 3.141.59.
Your JDK version is 1.8.0_91 which is pretty ancient.
So there is a clear mismatch between the JDK v8u91 , Selenium Client v3.141.59.
Solution
Upgrade JDK to recent levels JDK 8u202.

Selenium 3.0 Firefx Driver fails with org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session

Selenium 3.0 Firefx Driver fails with org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session.
System.setProperty("webdriver.gecko.driver", "..<Path>../geckodriver.exe");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
driver = new FirefoxDriver(capabilities);
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#23aa363a, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#23aa363a, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.0.0', revision: '350cf60', time: '2016-10-13 10:48:57 -0700'
System info: host: 'D202540', ip: '10.22.19.193', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:259)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:135)
this issue is solved with geckodriver 0.15 and selenium 3.3 version.
You need to download geckodriver. And then set
System.setProperty("webdriver.gecko.driver", "path\\to\\geckodriver.exe")
Check this link.
I had the same problem and fixed it with this. It seems it could not find the firefox binary
capabilities.setCapability("firefox_binary","C:\\Program Files\\Mozilla Firefox\\firefox.exe");
Same problem here. It was solved opening Eclipse/Netbeans with admin privileges.
This worked (linux mint, opensuse thumbleweed, win7)
with
libraryDependencies += "org.seleniumhq.selenium" %
"selenium-firefox-driver" % "3.0.1"
geckodriver.exe -V
geckodriver 0.13.0
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
println("загружены настройки os.name=linux")
System.setProperty("webdriver.chrome.driver", "bin/chromedriver")
System.setProperty("webdriver.gecko.driver", "bin/geckodriver")
}else{
System.setProperty("webdriver.chrome.driver", "bin\\chromedriver.exe")
System.setProperty("webdriver.gecko.driver", "bin\\geckodriver.exe")
System.setProperty("webdriver.ie.driver", "bin\\IEDriverServer.exe")
System.setProperty("webdriver.edge.driver", "C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe")
System.setProperty("webdriver.opera.driver", "c:\\XXX\\operadriver.exe")
System.setProperty("webdriver.opera.path","""C:\\Users\\user\\AppData\\Local\\Programs\\Opera""")
System.setProperty("webdriver.opera.binary","""C:\\Users\\user\\AppData\\Local\\Programs\\Opera\\launcher.exe""")
//
}
...
case
"firefox" => {
println(" подгружаем Веб-драйвер: geckodriver")
//iniprofile = new ProfilesIni()
//ffprofile = iniprofile.getProfile("default")
dc = DesiredCapabilities.firefox()
dc.setCapability("gecko", true) // как выйдет драйвер, так и установить
// dc.setCapability(FirefoxDriver.PROFILE, ffprofile); //FirefoxDriver.PROFILE = “firefox_profile”;
remote = new FirefoxDriver(dc)
}
but, for Remotewebdriver-connection if previous session failed,cancelled or aborted we get error:
[info] XXXX.E011_WebDB6292 *** ABORTED ***
[info] org.openqa.selenium.SessionNotCreatedException: Session is already started (WARNING: The server did not provide any stacktrace information)
[info] Command duration or timeout: 0 milliseconds
[info] Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
[info] System info: host: 'XXXX', ip: '172.16.4.125', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_11'
[info] Driver info: driver.version: RemoteWebDriver
[info] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
I ran into the same problem today, and it appears that not being admin on my laptop is actually an issue. To resolve it
Install in a non admin way Firefox (just need to click on no when Windows ask for privilege elevation)
Use the exe path (for my system something like C:\\Users\\MyUserName\\AppData\\Local\\MozillaFirefox\\firefox.exe).
It actually solved the issue.
Alternatively if you dont want to download the Gecko driver, you can downgrade the Firefox version to 44.
https://support.mozilla.org/t5/Install-and-Update/Install-an-older-version-of-Firefox/ta-p/1564
If you are using the latest GekoDriver then better to update the Selenium library versions as well.
The above issue is related to the Selenium version.

Categories