appium/appium-geckodriver

Unable to find a matching set of capabilities issue

SSDivya opened this issue · 1 comments

The problem

While trying to provide desired capabilities for test case execution in Firefox browser in emulator getting error as " Unable to find a matching set of capabilities"

Environment

  • Appium version--1.20.2
  • Last Appium version that did not exhibit the issue (if applicable):NA
  • Desktop OS/version used to run Appium: Windows 10
  • Node.js version (unless using Appium.app|exe):14.15.1
  • Npm or Yarn package manager: Npm
  • Mobile platform/version under test: 11
  • Real device or emulator/simulator: Emulator
  • Appium CLI or Appium.app|exe: Appium CLI

Details

We have added Gecko driver path in PATH variable
We have followed below link and the mentioned desired capabilities to execute test cases in Firefox browser in emulator.
But still getting 500 Error
https://github.com/appium/appium-geckodriver/blob/master/README.md

Link to Appium logs

C:\Users\XXXX>appium --address 127.0.0.1
[Appium] Welcome to Appium v1.20.2
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"automationName":"Gecko","browserName":"firefox","moz:firefoxOptions":{"androidDeviceSerial":"emulator-5554","androidPackage":"org.mozilla.firefox"},"platformName":"android"},"capabilities":{"firstMatch":[{"browserName":"firefox","moz:firefoxOptions":{"androidDeviceSerial":"emulator-5554","androidPackage":"org.mozilla.firefox"},"platformName":"android"}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"automationName":"Gecko","browserName":"firefox","moz:firefoxOptions":{"androidDeviceSerial":"emulator-5554","androidPackage":"org.mozilla.firefox"},"platformName":"android"},null,{"firstMatch":[{"browserName":"firefox","moz:firefoxOptions":{"androidDeviceSerial":"emulator-5554","androidPackage":"org.mozilla.firefox"},"platformName":"android"}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1618466798086 (11:36:38 GMT+0530 (India Standard Time))
[Appium] The following capabilities were provided in the JSONWP desired capabilities that are missing in W3C capabilities: ["automationName"]
[Appium] Trying to fix W3C capabilities by merging them with JSONWP caps
[BaseDriver] The following capabilities are not standard capabilities and should have an extension prefix:
[BaseDriver] automationName
[Appium] Appium v1.20.2 creating new GeckoDriver (v0.3.2) session
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] "alwaysMatch": {
[debug] [BaseDriver] "appium:automationName": "Gecko",
[debug] [BaseDriver] "browserName": "firefox",
[debug] [BaseDriver] "moz:firefoxOptions": {
[debug] [BaseDriver] "androidDeviceSerial": "emulator-5554",
[debug] [BaseDriver] "androidPackage": "org.mozilla.firefox"
[debug] [BaseDriver] },
[debug] [BaseDriver] "platformName": "android"
[debug] [BaseDriver] },
[debug] [BaseDriver] "firstMatch": [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] Session created with session id: 4baf0a2f-8591-4168-aa9d-a0b641bc7992
[GeckoDriverServer] Starting 'C:\Users\XXXX\Documents\Geckodriver\geckodriver.exe' with args ["-p",5200]
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:5200/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:5200
[debug] [GeckoDriverServer] [geckodriver.exe] 1618466799423 geckodriver INFO Listening on 127.0.0.1:5200
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:5200/status] with no body
[debug] [WD Proxy] Got response with status 200: {"value":{"message":"","ready":true}}
[debug] [WD Proxy] Matched '/session' to command name 'createSession'
[debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:5200/session] with body: {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"browserName":"firefox","moz:firefoxOptions":{"androidDeviceSerial":"emulator-5554","androidPackage":"org.mozilla.firefox"},"platformName":"android"}}}
[WD Proxy] Got response with status 500: {"value":{"error":"session not created","message":"Unable to find a matching set of capabilities","stacktrace":""}}
[debug] [W3C] Matched W3C error code 'session not created' to SessionNotCreatedError
[GeckoDriver] Ending Gecko Driver session
[GeckoDriverServer] geckodriver.exe has exited with code null, signal SIGTERM
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1618466800477 (11:36:40 GMT+0530 (India Standard Time))
[debug] [W3C] Encountered internal error running command: SessionNotCreatedError: A new session could not be created. Details: Unable to find a matching set of capabilities
[debug] [W3C] at errorFromW3CJsonCode (C:\Users\XXXX\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:780:25)
[debug] [W3C] at ProxyRequestError.getActualError (C:\Users\XXXX\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:663:14)
[debug] [W3C] at GeckoProxy.command (C:\Users\XXXX\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:273:19)
[debug] [W3C] at processTicksAndRejections (internal/process/task_queues.js:93:5)
[debug] [W3C] at GeckoDriverServer.start (C:\Users\XXXX\AppData\Roaming\npm\node_modules\appium\node_modules\appium-geckodriver\lib\gecko.js:185:5)
[debug] [W3C] at GeckoDriver.createSession (C:\Users\XXXX\AppData\Roaming\npm\node_modules\appium\node_modules\appium-geckodriver\lib\driver.js:59:7)
[debug] [W3C] at AppiumDriver.createSession (C:\Users\XXXX\AppData\Roaming\npm\node_modules\appium\lib\appium.js:371:35)
[HTTP] <-- POST /wd/hub/session 500 2745 ms - 1278
[HTTP]

Code To Reproduce Issue [ Good To Have ]

public class Try1Firefoxgecko {

WebDriver driver;

DesiredCapabilities capabilities;

@Before
public void setup() throws MalformedURLException
{
	capabilities = new DesiredCapabilities();
	
	capabilities.setCapability("platformName","android");
	capabilities.setCapability("browserName","firefox");
	capabilities.setCapability("automationName","Gecko");
	JSONObject firefoxoptions=new JSONObject();
	firefoxoptions.put("androidDeviceSerial","emulator-5554"); 
	firefoxoptions.put("androidPackage","org.mozilla.firefox");
	capabilities.setCapability("moz:firefoxOptions",firefoxoptions);
	
}	
@Test
public void t1() throws MalformedURLException
{
	driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
			
	String u="https://www.amazon.com/";

	driver.get(u);
}

}

Geckodriver does not support platformName=android. It must equal to the host operating system name (for example windows)