We are planning to automate tests on mobile Firefox browser but not sure that what we are missing here Here is the code:
UiAutomator2Options androidOptions = new UiAutomator2Options()
.setAutomationName(AutomationName.ANDROID_UIAUTOMATOR2)
.setPlatformName(platform)
androidOptions.withBrowserName(browserName)
.setAutomationName(AutomationName.GECKO)
.setPlatformName(“android”);
Map<String, Object> geckoOptions = new HashMap<>();
geckoOptions.put("androidPackage", "org.mozilla.firefox");
geckoOptions.put("androidDeviceSerial", deviceName);
geckoOptions.put("moz:geckoDriverExecutable","/src/test/resources/drivers/geckodriver.exe");
androidOptions.setCapability("moz:firefoxOptions", geckoOptions);
FirefoxOptions firefoxOptions = new FirefoxOptions();
androidOptions.setCapability(FirefoxOptions.FIREFOX_OPTIONS, firefoxOptions);
driver = new AndroidDriver(url, androidOptions);
Other details: OS --> Mac , android emulator,
can you please someone look and share the solution?
As mentioned in the gecko support , use platformName as Mac instead of android but when I use Mac then Firefox browser opens in my local machine instead of on mobile
Just changed few capabilities but this time different error
“alwaysMatch”: {
[GeckoDriver@33cf] “browserName”: “Firefox”,
[GeckoDriver@33cf] “platformName”: “mac”,
[GeckoDriver@33cf] “moz:firefoxOptions”: {
[GeckoDriver@33cf] “androidDeviceSerial”: “emulator-5554”,
[GeckoDriver@33cf] “androidPackage”: “org.mozilla.firefox”
[GeckoDriver@33cf] },
[GeckoDriver@33cf] “appium:automationName”: “Gecko”
[GeckoDriver@33cf] },
[GeckoDriver@33cf] “firstMatch”: [
[GeckoDriver@33cf] {}
[GeckoDriver@33cf] ]
Session created with session id: f3dcbfcd-bc8b-4948-8edb-be2821a34350
[GeckoDriver@33cf (f3dcbfcd)] Starting ‘/opt/homebrew/bin/geckodriver’ with args ["-p",“5200”]
[GeckoDriver@33cf (f3dcbfcd)] Matched ‘/status’ to command name ‘getStatus’
[GeckoDriver@33cf (f3dcbfcd)] Proxying [GET /status] to [GET http://127.0.0.1:5200/status] with no body
[GeckoDriver@33cf (f3dcbfcd)] connect ECONNREFUSED 127.0.0.1:5200
[GeckoDriver@33cf (f3dcbfcd)] [geckodriver] 1706368381571 geckodriver INFO Listening on 127.0.0.1:5200
[GeckoDriver@33cf (f3dcbfcd)] Matched ‘/status’ to command name ‘getStatus’
[GeckoDriver@33cf (f3dcbfcd)] Proxying [GET /status] to [GET http://127.0.0.1:5200/status] with no body
[GeckoDriver@33cf (f3dcbfcd)] Got response with status 200: {“value”:{“message”:"",“ready”:true}}
[GeckoDriver@33cf (f3dcbfcd)] Matched ‘/session’ to command name ‘createSession’
[GeckoDriver@33cf (f3dcbfcd)] Proxying [POST /session] to [POST http://127.0.0.1:5200/session] with body: {“capabilities”:{“firstMatch”:[{}],“alwaysMatch”:{“browserName”:“firefox”,“platformName”:“mac”,“moz:firefoxOptions”:{“androidDeviceSerial”:“emulator-5554”,“androidPackage”:“org.mozilla.firefox”}}}}
[GeckoDriver@33cf (f3dcbfcd)] [geckodriver] 1706368382668 mozdevice INFO Device is unrooted
[GeckoDriver@33cf (f3dcbfcd)] Got response with status 500: {“value”:{“error”:“unknown error”,“message”:“adb error: fchown failed: Operation not permitted”,“stacktrace”:""}}
[W3C] Matched W3C error code ‘unknown error’ to UnknownError
[GeckoDriver@33cf (f3dcbfcd)] Ending Gecko Driver session
can you please correct me if I missed something
Hello,
Is there any alternative solution to run test son Firefox mobile browser?