1

I can not find a solution to launch firefox browser on Appium. I read the doc and do many research but it still doesn't work at all. The solution I try so far:

private AppiumDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Gecko");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "firefox");
capabilities.setCapability(MobileCapabilityType.BROWSER_VERSION, "106");
capabilities.setCapability(MobileCapabilityType.UDID, "emulator-5554");
final Map<String, Object> firefoxOptions = new HashMap<>();
capabilities.setCapability("moz:firefoxOptions", firefoxOptions);

driver = new AndroidDriver("http://localhost:4723/wd/hub", capabilities);

And the appium server response with that failure:

2022-10-28 04:21:01:695 [HTTP] <-- GET /wd/hub/status 200 1 ms - 68
2022-10-28 04:21:01:695 [HTTP] 
2022-10-28 04:21:02:088 [HTTP] Request idempotency key: bca5227e-ff58-4c45-8a4c-ef6fbe2d63bb
2022-10-28 04:21:02:097 [HTTP] --> POST /wd/hub/session
2022-10-28 04:21:02:097 [HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"Gecko","appium:udid":"emulator-5554","browserName":"firefox","browserVersion":"106","moz:firefoxOptions":{"androidPackage":"org.mozilla.firefox"},"platformName":"android"}}}
2022-10-28 04:21:02:097 [W3C] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"Gecko","appium:udid":"emulator-5554","browserName":"firefox","browserVersion":"106","moz:firefoxOptions":{"androidPackage":"org.mozilla.firefox"},"platformName":"android"}}]
2022-10-28 04:21:02:098 [BaseDriver] Event 'newSessionRequested' logged at 1666930862097 (11:21:02 GMT+0700 (Indochina Time))
2022-10-28 04:21:02:115 [Appium] Appium v1.22.3 creating new GeckoDriver (v0.3.3) session
2022-10-28 04:21:02:116 [BaseDriver] Creating session with W3C capabilities: {
2022-10-28 04:21:02:116 [BaseDriver]   "alwaysMatch": {
2022-10-28 04:21:02:117 [BaseDriver]     "browserName": "firefox",
2022-10-28 04:21:02:117 [BaseDriver]     "browserVersion": "106",
2022-10-28 04:21:02:117 [BaseDriver]     "moz:firefoxOptions": {
2022-10-28 04:21:02:117 [BaseDriver]       "androidPackage": "org.mozilla.firefox"
2022-10-28 04:21:02:117 [BaseDriver]     },
2022-10-28 04:21:02:117 [BaseDriver]     "platformName": "android",
2022-10-28 04:21:02:117 [BaseDriver]     "appium:automationName": "Gecko",
2022-10-28 04:21:02:117 [BaseDriver]     "appium:udid": "emulator-5554"
2022-10-28 04:21:02:117 [BaseDriver]   },
2022-10-28 04:21:02:117 [BaseDriver]   "firstMatch": [
2022-10-28 04:21:02:117 [BaseDriver]     {}
2022-10-28 04:21:02:117 [BaseDriver]   ]
2022-10-28 04:21:02:117 [BaseDriver] }
2022-10-28 04:21:02:119 [BaseDriver] Session created with session id: f3c3f9d6-9384-410b-8a53-98913db3468b
2022-10-28 04:21:02:135 [GeckoDriverServer] Starting 'C:\Users\SoNN\IdeaProjects\Ericsson_E2E_Mobile_Automation_Framework\browser_drivers\geckodriver.exe' with args ["-p",5200]
2022-10-28 04:21:02:144 [WD Proxy] Matched '/status' to command name 'getStatus'
2022-10-28 04:21:02:145 [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:5200/status] with no body
2022-10-28 04:21:02:152 [WD Proxy] connect ECONNREFUSED 127.0.0.1:5200
2022-10-28 04:21:02:154 [GeckoDriverServer] [geckodriver.exe] 1666930862154 geckodriver INFO    Listening on 127.0.0.1:5200
2022-10-28 04:21:03:154 [WD Proxy] Matched '/status' to command name 'getStatus'
2022-10-28 04:21:03:154 [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:5200/status] with no body
2022-10-28 04:21:03:157 [WD Proxy] Got response with status 200: {"value":{"message":"","ready":true}}
2022-10-28 04:21:03:157 [WD Proxy] Matched '/session' to command name 'createSession'
2022-10-28 04:21:03:157 [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:5200/session] with body: {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"browserName":"firefox","browserVersion":"106","moz:firefoxOptions":{"androidPackage":"org.mozilla.firefox"},"platformName":"android"}}}
2022-10-28 04:21:03:160 [WD Proxy] Got response with status 500: {"value":{"error":"session not created","message":"Unable to find a matching set of capabilities","stacktrace":""}}
2022-10-28 04:21:03:160 [W3C] Matched W3C error code 'session not created' to SessionNotCreatedError
2022-10-28 04:21:03:161 [GeckoDriver] Ending Gecko Driver session
2022-10-28 04:21:03:163 [GeckoDriverServer] geckodriver.exe has exited with code null, signal SIGTERM
2022-10-28 04:21:03:164 [BaseDriver] Event 'newSessionStarted' logged at 1666930863164 (11:21:03 GMT+0700 (Indochina Time))
2022-10-28 04:21:03:197 [W3C] Encountered internal error running command: SessionNotCreatedError: A new session could not be created. Details: Unable to find a matching set of capabilities

I just do not know what I am doing wrong. I finally come to desperation status after more than a week finding a really working solution. If anyone have any experience with automate firefox in android using Appium, please help me. You can become my hero and save my day and get a coffee from me.

1 Answer 1

1

You can try

DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("appPackage", "org.mozilla.firefox");
dc.setCapability("appActivity", ".App");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.