appium: firefox caps object is undefined ,so failing to launch firefox on mobile browser

Hello, I am trying to automate mobile browser on android and iOS. framework: WebdriverIO, appium, javascript, nodeJS

using capabilities I can able to launch chrome on android but same thing not working for firefox and feeling afraid to go with .

let me share what exactly am using to automate

firefoxCaps.js

config.capabilities = [
    {
        "alwaysMatch": {
            browserName: 'firefox',
            platformName: 'MacOS Catalina 10.15.7',
            automationName: 'Gecko',
            deviceName: AndroidInfo.deviceName(),
            'moz:firefoxOptions': {
                androidPackage: 'org.mozilla.firefox',
                androidDeviceSerial: 'EMULATOR30X7X5X0',
                binary: "/Applications/Firefox.app",
                "log": {"level": "trace"}
            },
            maxInstances: 1,
            acceptInsecureCerts: true

        }
    }
];
exports.config = config;

WDIO.config.js

services: [
        ['geckodriver'],
        ['appium', {
        command: 'appium',
        logFileName: 'appium.log',
        args: {
            relaxedSecurity: true,
            address: host,
            port: port,
            commandTimeout: commandTimeout,
            sessionOverride: true,
            debugLogSpacing: true
        }
    }]],

packages:

"dependencies": {
    "@wdio/runner": "^7.9.1",
    "allure-commandline": "^2.13.8",
    "geckodriver": "^2.0.3",
    "react-device-detect": "^1.17.0",
    "selenium-standalone": "^7.1.0",
    "wd": "^1.14.0",
    "wdio-video-reporter": "^3.1.2",
    "webdriverio": "^7.9.1"
  },
  "devDependencies": {
    "@babel/cli": "^7.14.8",
    "@babel/core": "^7.15.0",
    "@babel/preset-env": "^7.15.0",
    "@babel/register": "^7.15.3",
    "@wdio/allure-reporter": "^7.9.1",
    "@wdio/appium-service": "^7.8.0",
    "@wdio/cli": "^7.9.1",
    "@wdio/dot-reporter": "^7.9.0",
    "@wdio/firefox-profile-service": "^7.10.1",
    "@wdio/local-runner": "^7.11.0",
    "@wdio/mocha-framework": "^7.11.0",
    "@wdio/selenium-standalone-service": "^7.10.1",
    "@wdio/spec-reporter": "^7.10.1",
    "appium": "^1.21.0",
    "chai": "^4.3.4",
    "chromedriver": "^92.0.1",
    "mocha": "^9.1.0",
    "wdio-chromedriver-service": "^7.2.0",
    "wdio-geckodriver-service": "^2.0.3"
  }

Error log:

2021-09-02T10:23:09.369Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2021-09-02T10:23:09.370Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2021-09-02T10:23:09.419Z INFO webdriver: [POST] http://localhost:4730/session
[0-0] 2021-09-02T10:23:09.419Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       browserName: 'firefox',
[0-0]       platformName: 'MacOS Catalina 10.15.7',
[0-0]       automationName: 'Gecko',
[0-0]       deviceName: 'Pixel_3a',
[0-0]       'moz:firefoxOptions': [Object],
[0-0]       maxInstances: 1,
[0-0]       acceptInsecureCerts: true,
[0-0]       protocol: 'http',
[0-0]       hostname: 'localhost',
[0-0]       port: 55983,
[0-0]       path: '/'
[0-0]     }
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     browserName: 'firefox',
[0-0]     platformName: 'MacOS Catalina 10.15.7',
[0-0]     automationName: 'Gecko',
[0-0]     deviceName: 'Pixel_3a',
[0-0]     'moz:firefoxOptions': { androidPackage: 'org.mozilla.firefox', log: [Object] },
[0-0]     maxInstances: 1,
[0-0]     acceptInsecureCerts: true,
[0-0]     protocol: 'http',
[0-0]     hostname: 'localhost',
[0-0]     port: 55983,
[0-0]     path: '/'
[0-0]   }
[0-0] }
[0-0] 2021-09-02T10:23:10.598Z DEBUG webdriver: request failed due to status 33
[0-0] 2021-09-02T10:23:10.599Z INFO webdriver: Retrying 1/3
[0-0] 2021-09-02T10:23:10.599Z INFO webdriver: [POST] http://localhost:4730/session
[0-0] 2021-09-02T10:23:10.599Z WARN webdriver: Request failed with status 500 due to A new session could not be created. Details: Unable to find a matching set of capabilities
As my observation it is throwing error while reading capabilities, it might be because of cap object itself null , so that wdio/geckodriver throwing the following error
2021-09-02T13:46:15.719Z ERROR @wdio/utils:shim: TypeError: Cannot read property 'toLowerCase' of undefined

here is the line throwing error at isFirefox
const isFirefox = cap => cap.browserName.toLowerCase().includes('firefox')
/node_modules/wdio-geckodriver-service/src/index.js:23:42)

can you have a look and assist me to fix the issue?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

WebdriverIO doesn’t get the logs from Appium. I don’t know how you run Appium but it always produces logs.