question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

firefox caps object is undefined ,so failing to launch firefox on mobile browser<android>

See original GitHub issue

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?

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
christian-bromanncommented, Sep 4, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firefox mobile browser automation, no proper clue · Issue #7368
Firefox mobile browser automation, no proper clue #7368 ... firefox caps object is undefined ,so failing to launch firefox on mobile ...
Read more >
Firefox won't start - find solutions - Mozilla Support
This article explains what to do if the Firefox window does not open or you get an error message when you try to...
Read more >
1394296 - 'undefined is not an object' when evaluating __ ...
Firefox 8.2 (5213) Actual results: Several Javascript errors occurred: TypeError: undefined is not an object (evaluating '__firefox__.favicons.
Read more >
Websites don't load - troubleshoot and fix error messages
First, let's figure out where the problem is · Open a new tab and check to see if you can load another website...
Read more >
XML PARSING ERROR: Undefined Entity | Firefox supportforum
XML PARING ERROR: UNDEFINED ENTITY LOCATION: whatever website I am trying to access and ... Hold down the Shift key when starting Firefox....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found