I am getting this error only in OSX and Linux but Windows OS it is working fine
org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
Selenium Version: 3.11.0 Chrome Version: 79.0.3945.130 Chrome driver version: 79.0.3945.36
Below are the chrome options in my code. Please let me know if you ever come across this problem
case GlobalProperties.CHROME:
System.setProperty("webdriver.chrome.driver",
PropertiesRepository.getString("global.browser.chrome.driver.executable"));
cap = DesiredCapabilities.chrome();
cap.setBrowserName(
PropertiesRepository.getString("global.browser.capability.browserName.ch"));
cap.setJavascriptEnabled(true);
cap.setCapability("platform",
PropertiesRepository.getString("global.browser.capability.platform"));
cap.setCapability("takesScreenshot", PropertiesRepository
.getBoolean("global.browser.capability.chrome.takesScreenshot"));
cap.setCapability("handlesAlerts", PropertiesRepository
.getBoolean("global.browser.capability.chrome.handlesAlerts"));
cap.setCapability("cssSelectorsEnabled", PropertiesRepository
.getBoolean("global.browser.capability.chrome.cssSelectorsEnabled"));
// Clearing session.
cap.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
// Opening incognito browser for clear cache.
cap.setCapability("chrome.switches", Arrays.asList("--incognito"));
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_settings.popups", 0);
prefs.put("download.prompt_for_download", false);
prefs.put("download.default_directory",
PropertiesRepository.getString("global.download.location"));
ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
options.addArguments("chrome.switches","--disable-extensions"); // To "Disable developer mode extensions"
options.addArguments("--test-type");
options.addArguments("--disable-extensions"); //to disable browser extension popup
options.addArguments("--incognito");
options.addArguments("--no-sanbox");
options.addArguments("--headless");
options.setBinary("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
String extensions = PropertiesRepository
.getString("global.browser.capability.chrome.extensions");
if (extensions != null && !extensions.trim().equals("")) {
StringTokenizer tokens = new StringTokenizer(extensions, ",");
String extensionPath = PropertiesRepository
.getString("global.browser.capability.chrome.extensionpath");
File[] extFiles = new File[tokens.countTokens()];
int i = 0;
while (tokens.hasMoreElements()) {
extFiles[i] = new File(extensionPath + "/" + tokens.nextToken());
i++;
}
options.addExtensions(extFiles);
}
options.setExperimentalOption("prefs", prefs);
cap.setCapability(ChromeOptions.CAPABILITY, options);
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setCapability(ChromeOptions.CAPABILITY, options);
break;
EXCEPTION
BROWSER : chrome
Jan 25, 2020 2:52:21 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
INFO [pool-1-thread-1] (DriverFactory.java:58) - Desired Capabilities : Capabilities {acceptSslCerts: true, browserName: chrome, chrome.switches: [--incognito], cssSelectorsEnabled: true, ensureCleanSession: true, goog:chromeOptions: {args: [disable-infobars, chrome.switches, --disable-extensions, --test-type, --disable-extensions, --incognito, --no-sanbox, --headless], binary: /Applications/Google Chrome..., extensions: [], prefs: {download.default_directory: C:/download/ASMT, download.prompt_for_download: false, profile.default_content_settings.popups: 0}}, handlesAlerts: true, javascriptEnabled: true, platform: WINDOWS, takesScreenshot: true, version: }
INFO [pool-1-thread-1] (DriverFactory.java:63) - environment value ==> stage
INFO [pool-1-thread-3] (DriverFactory.java:58) - Desired Capabilities : Capabilities {acceptSslCerts: true, browserName: chrome, chrome.switches: [--incognito], cssSelectorsEnabled: true, ensureCleanSession: true, goog:chromeOptions: {args: [disable-infobars, chrome.switches, --disable-extensions, --test-type, --disable-extensions, --incognito, --no-sanbox, --headless], binary: /Applications/Google Chrome..., extensions: [], prefs: {download.default_directory: C:/download/ASMT, download.prompt_for_download: false, profile.default_content_settings.popups: 0}}, handlesAlerts: true, javascriptEnabled: true, platform: WINDOWS, takesScreenshot: true, version: }
INFO [pool-1-thread-3] (DriverFactory.java:63) - environment value ==> stage
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 21174
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1579985542.015][WARNING]: FromSockAddr failed on netmask
ERROR [pool-1-thread-2] (BaseTest.java:55) - Unable to load Driver
org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'ASC-C02YQ2BYLVDQ.local', ip: 'fe80:0:0:0:1c07:496e:1e2d:7ea7%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_231'
Driver info: driver.version: ChromeDriver
remote stacktrace: 0 chromedriver 0x000000011001ce29 chromedriver + 3817001
1 chromedriver 0x000000010ffb0f33 chromedriver + 3374899
2 chromedriver 0x000000010fd318bf chromedriver + 755903
3 chromedriver 0x000000010fcbc19e chromedriver + 274846
4 chromedriver 0x000000010fcbb9d2 chromedriver + 272850
5 chromedriver 0x000000010fcbce7d chromedriver + 278141
6 chromedriver 0x000000010fcb9fa3 chromedriver + 266147
7 chromedriver 0x000000010fc93c0d chromedriver + 109581
8 chromedriver 0x000000010fc94ba5 chromedriver + 113573
9 chromedriver 0x000000010ffdef6f chromedriver + 3563375
10 chromedriver 0x000000010ffebe3a chromedriver + 3616314
11 chromedriver 0x000000010ffebbf7 chromedriver + 3615735
12 chromedriver 0x000000010ffbe699 chromedriver + 3430041
13 chromedriver 0x000000010ffec692 chromedriver + 3618450
14 chromedriver 0x000000010ffd2e17 chromedriver + 3513879
15 chromedriver 0x0000000110001fe4 chromedriver + 3706852
16 chromedriver 0x0000000110022fc7 chromedriver + 3841991
17 libsystem_pthread.dylib 0x00007fff715812eb _pthread_body + 126
18 libsystem_pthread.dylib 0x00007fff71584249 _pthread_start + 66
19 libsystem_pthread.dylib 0x00007fff7158040d thread_start + 13
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:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:209)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:132)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:147)
at com.ascendlearning.automation.ui.driver.DriverFactory$1.initialValue(DriverFactory.java:97)
at com.ascendlearning.automation.ui.driver.DriverFactory$1.initialValue(DriverFactory.java:37)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:180)
at java.lang.ThreadLocal.get(ThreadLocal.java:170)
at com.ascendlearning.automation.ui.driver.DriverFactory.getDriver(DriverFactory.java:111)
at com.ascendlearning.automation.ui.test.BaseTest.setup(BaseTest.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:517)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:601)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
INFO [pool-1-thread-2] (BaseTest.java:59) - Method name in Base Test in setup for loading properties:ASMT746_VerifyQuizBankAndItsElements
INFO [pool-1-thread-2] (PropertiesRepository.java:86) - List of files to load : stg_input.properties
INFO [pool-1-thread-2] (PropertiesRepository.java:33) - Loading property file : stg_input.properties
java.lang.NullPointerException
at com.ascendlearning.automation.ui.test.ExtentReport.takesScreenshot(ExtentReport.java:101)
at com.ascendlearning.automation.ui.test.ExtentReport.onConfigurationFailure(ExtentReport.java:132)
at org.testng.internal.Invoker.runConfigurationListeners(Invoker.java:1770)
at org.testng.internal.Invoker.handleConfigurationFailure(Invoker.java:303)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:237)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:601)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
This error message...
Jan 25, 2020 2:52:21 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
INFO [pool-1-thread-1] (DriverFactory.java:58) - Desired Capabilities : Capabilities {acceptSslCerts: true, browserName: chrome, chrome.switches: [--incognito], cssSelectorsEnabled: true, ensureCleanSession: true, goog:chromeOptions: {args: [disable-infobars, chrome.switches, --disable-extensions, --test-type, --disable-extensions, --incognito, --no-sanbox, --headless], binary: /Applications/Google Chrome..., extensions: [], prefs: {download.default_directory: C:/download/ASMT, download.prompt_for_download: false, profile.default_content_settings.popups: 0}}, handlesAlerts: true, javascriptEnabled: true, platform: WINDOWS, takesScreenshot: true, version: }
INFO [pool-1-thread-1] (DriverFactory.java:63) - environment value ==> stage
INFO [pool-1-thread-3] (DriverFactory.java:58) - Desired Capabilities : Capabilities {acceptSslCerts: true, browserName: chrome, chrome.switches: [--incognito], cssSelectorsEnabled: true, ensureCleanSession: true, goog:chromeOptions: {args: [disable-infobars, chrome.switches, --disable-extensions, --test-type, --disable-extensions, --incognito, --no-sanbox, --headless], binary: /Applications/Google Chrome..., extensions: [], prefs: {download.default_directory: C:/download/ASMT, download.prompt_for_download: false, profile.default_content_settings.popups: 0}}, handlesAlerts: true, javascriptEnabled: true, platform: WINDOWS, takesScreenshot: true, version: }
INFO [pool-1-thread-3] (DriverFactory.java:63) - environment value ==> stage
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 21174
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1579985542.015][WARNING]: FromSockAddr failed on netmask
ERROR [pool-1-thread-2] (BaseTest.java:55) - Unable to load Driver
org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'ASC-C02YQ2BYLVDQ.local', ip: 'fe80:0:0:0:1c07:496e:1e2d:7ea7%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_231'
Driver info: driver.version: ChromeDriver
remote stacktrace: 0 chromedriver 0x000000011001ce29 chromedriver + 3817001
1 chromedriver 0x000000010ffb0f33 chromedriver + 3374899
2 chromedriver 0x000000010fd318bf chromedriver + 755903
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context ie Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Supports Chrome version 79
So there is a clear mismatch between Selenium Client v3.11.0 and chromedriver=79.0
Ensure that:
@Test
as non-root user.driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.I am able to resolve this issue myself where desired capabilities still pointing to WINDOWS OS properties for platform and default download directory. Hence i have modified the code to set these values based on the OS that resolved the issue.
Desired Capabilities :
Capabilities {acceptSslCerts: true, browserName: chrome, chrome.switches: [--incognito], cssSelectorsEnabled: true, ensureCleanSession: true, goog:chromeOptions: {args: [disable-infobars, chrome.switches, --disable-extensions, --test-type, --disable-extensions, --incognito, --no-sanbox, --headless], binary: /Applications/Google Chrome..., extensions: [], prefs: {**download.default_directory: C:/download/ASMT**, download.prompt_for_download: false, profile.default_content_settings.popups: 0}}, handlesAlerts: true, javascriptEnabled: true, **platform: WINDOWS**, takesScreenshot: true, version: }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.