Nearly Perfected Mystique


    1.1.5 • Public • Published

    Appium Geckodriver

    NPM version Downloads


    This is Appium driver for automating Firefox on different platforms, including Android. The driver only supports Firefox and Gecko-based web views (Android only) automation using W3C WebDriver protocol. Under the hood this driver is a wrapper/proxy over geckodriver binary. Check the driver release notes and the official documentation to get more details on the supported features and possible pitfalls.


    Since version 1.0.0 Gecko driver has dropped the support of Appium 1, and is only compatible to Appium 2. Use the appium driver install gecko command to add it to your Appium 2 dist.


    It is mandatory to have both Firefox browser installed and the geckodriver binary downloaded on the platform where automated tests are going to be executed. Firefox could be downloaded from the official download site and the driver binary could be retrieved from the GitHub releases page. The binary must be put into one of the folders included to PATH environment variable. On macOS it also might be necessary to run xcattr -cr "<binary_path>" to avoid notarization issues.

    Then you need to decide where the automated test is going to be executed. Gecko driver supports the following target platforms:

    • macOS
    • Windows
    • Linux
    • Android (note that android cannot be passed as a value to platformName capability; it should always equal to the host platform name)

    In order to run your automated tests on Android it is necessary to have Android SDK installed, so the destination device is marked as online in the adb devices -l command output.

    Gecko driver allows to define multiple criterions for platform selection and also to fine-tune your automation session properties. This could be done via the following session capabilities:

    Capability Name Description
    platformName Gecko Driver supports the following platforms: mac, linux, windows. The fact your test must be executed on Android is detected based on moz:firefoxOptions entry values. Values of platformName are compared case-insensitively.
    browserName Any value passed to this capability will be changed to 'firefox'.
    browserVersion Provide the version number of the browser to automate if there are multiple versions installed on the same machine where the driver is running.
    appium:automationName Must always be set to Gecko.
    appium:noReset Being set to true adds the --connect-existing argument to the server, that allows to connect to an existing browser instance instead of starting a new browser instance on session startup.
    appium:marionettePort Selects the port for Geckodriver’s connection to the Marionette remote protocol. The existing Firefox instance must have Marionette enabled. To enable the remote protocol in Firefox, you can pass the -marionette flag. Unless the marionette.port preference has been user-set, Marionette will listen on port 2828, which is the default value for this capability.
    appium:systemPort The number of the port for the driver to listen on. Must be unique for each session. If not provided then Appium will try to detect it automatically.
    appium:verbosity The verbosity level of driver logging. By default minimum verbosity is applied. Possible values are debug or trace.
    appium:androidStorage See
    moz:firefoxOptions See
    acceptInsecureCerts See
    pageLoadStrategy See
    proxy See
    setWindowRect See
    timeouts See
    unhandledPromptBehavior See


    # Python3 + PyTest
    import pytest
    import time
    from appium import webdriver
    # Options are available in Python client since v2.6.0
    from appium.options.gecko import GeckoOptions
    from import By
    def generate_options():
        common_caps = {
            # It does not really matter what to put there, although setting 'Firefox' might cause a failure
            # depending on the particular client library
            'browserName': 'MozillaFirefox',
            # Should have the name of the host platform, where the geckodriver binary is deployed
            'platformName': 'mac',
        android_options = GeckoOptions().load_capabilities(common_caps)
        android_options.firefox_options = {
            'androidDeviceSerial': '<device/emulator serial>',
            # These capabilities depend on what you are going to automate
            # Refer Mozilla documentation at for more details
            'androidPackage': 'org.mozilla.firefox',
        desktop_options = GeckoOptions().load_capabilities(common_caps)
        return [android_options, desktop_options]
    def driver(request):
        # The default URL is in Appium1
        drv = webdriver.Remote('', options=request.param)
        yield drv
    class TimeoutError(Exception):
    def wait_until_truthy(func, timeout_sec=5.0, interval_sec=0.5):
        started = time.time()
        original_error = None
        while time.time() - started < timeout_sec:
            original_error = None
                result = func()
                if result:
                    return result
            except Exception as e:
                original_error = e
        if original_error is None:
            raise TimeoutError(f'Condition unmet after {timeout_sec}s timeout')
        raise original_error
    def test_feature_status_page_search(driver):
        # Enter "CSS" into the search box.
        # Ensures that at least one result appears in search
        # !!! Remember there are no ID and NAME locators in W3C standard
        # These two have been superseded by CSS ones
        search_box = driver.find_element_by_css('#search')
        value = search_box.get_attribute('value')
        assert len(value) > 0
        # Count the visible results when filters are applied
        # so one result shows up in at most one filter
        assert wait_until_truthy(
            lambda: len(driver.execute_script("return document.querySelectorAll('li.feature:not(.is-hidden)')")) > 0)
    def test_feature_status_page_filters(driver):
        assert wait_until_truthy(
            lambda: len(driver.execute_script("return document.querySelectorAll('.filter-toggle')")) == 7)
        # Make sure every filter is turned off.
        for checked_filter in filter(lambda f: f.is_selected(), filters):
        # Make sure you can select every filter.
        for filt in filters:
            assert filt.is_selected()


    # clone repo, then in repo dir:
    npm install
    npm run lint
    npm run test


    npm i appium-geckodriver

    DownloadsWeekly Downloads






    Unpacked Size

    324 kB

    Total Files


    Last publish


    • jlipps
    • imurchie
    • dangraham
    • nick.mokhnach
    • umut.uzgur
    • kazucocoa
    • boneskull