Nightwatch: Cannot switch to iFrame with Firefox browser

Created on 21 Oct 2019  路  3Comments  路  Source: nightwatchjs/nightwatch

Description

  • Cannot switch to iframe with Firefox
module.exports = {
    'LogIn': function (browser) {
        browser
            .url(browser.globals.baseUrl)
            .waitForElementVisible('#email-input')
            .setValue(selector.LOGIN.EMAIL, browser.globals.user_credentials.login)
            .setValue(selector.LOGIN.PASSWORD, atob(browser.globals.user_credentials.password))
            .click(selector.LOGIN.SIGNIN)
            .waitForElementVisible(selector.BUTTONS.UPLOAD)
    },
    'Enter Settings': function (browser) {
        browser
            .waitForElementPresent(selector.SETTINGS.AVATAR)
            .click(selector.SETTINGS.AVATAR)
            .waitForElementPresent(selector.SETTINGS.SETTINGS)
            .click(selector.SETTINGS.SETTINGS)
            .frame(selector.SETTINGS.SETTINGS_IFRAME)
            .setValue(selector.SETTINGS.SURNAME, "xxxxxx")
            .pause(5000)
            .end();
    }
};

Run with command
node nightwatch ./tests/test.js --env edge < works
node nightwatch ./tests/test.js --env chrome < works
node nightwatch ./tests/test.js --env firefox < doesn't work

Verbose output

Error while running .switchToFrame() protocol action: data did not match any variant of untagged enum FrameId at line 1 column 30

NoSuchElementError: An error occurred while running .setValue() command on <#surname>:
at process._tickCallback (internal/process/next_tick.js:68:7)

Configuration

{
    "src_folders": [
        "./tests",
        "./mocha",
        "./unittests"
    ],
    "output_folder": "./reports",
    "custom_commands_path": "./custom-commands",
    "custom_assertions_path": "./custom-assertions",
    "page_elements": "./page_elements.js",
    "page_objects_path": "./pages",
    "globals_path": "./globalsModule.js",
    "disable_colors": false,
    "test_workers": {
        "enabled": "true",
        "workers": "auto"
    },
    "webdriver": {
        "start_process": true
    },
    "test_settings": {
        "firefox": {
            "webdriver": {
                "server_path": "./node_modules/geckodriver/geckodriver.exe",
                "cli_args": [
                    "--log",
                    "debug"
                ]
            },
            "disable_colors": false,
            "screenshots": {
                "enabled": false,
                "path": ""
            },
            "request_timeout_options": {
                "timeout": 60000,
                "retry_attempts": 5
            },
            "filter": [
                "./examples/tests"
            ],
            "desiredCapabilities": {
                "browserName": "firefox",
                "acceptSslCerts": true,
                "acceptInsecureCerts": true
            }
        },
        "firefox_cli": {
            "webdriver": {
                "server_path": "./node_modules/geckodriver/geckodriver.exe",
                "cli_args": [
                    "--log",
                    "debug"
                ]
            },
            "disable_colors": false,
            "screenshots": {
                "enabled": false,
                "path": ""
            },
            "request_timeout_options": {
                "timeout": 60000,
                "retry_attempts": 5
            },
            "filter": [
                "./examples/tests"
            ],
            "desiredCapabilities": {
                "browserName": "firefox",
                "acceptInsecureCerts": true,
                "alwaysMatch": {
                    "moz:firefoxOptions": {
                        "args": [
                            "-headless"
                        ]
                    }
                }
            }
        },
        "chrome": {
            "webdriver": {
                "default_path_prefix": "",
                "port": 9515,
                "server_path": "./node_modules/chromedriver/lib/chromedriver/chromedriver.exe",
                "cli_args": [
                    "--verbose"
                ]
            },
            "desiredCapabilities": {
                "browserName": "chrome",
                "loggingPrefs": {
                    "driver": "INFO",
                    "server": "OFF",
                    "browser": "INFO"
                },
                "browserstack.user": ".......",
                "browserstack.key": "......",
                "build": "version1",
                "project": "newintropage"
            }
        },
        "chrome_cli": {
            "webdriver": {
                "default_path_prefix": "",
                "port": 9515,
                "server_path": "./node_modules/chromedriver/lib/chromedriver/chromedriver.exe",
                "cli_args": [
                    "--verbose"
                ]
            },
            "desiredCapabilities": {
                "browserName": "chrome",
                "loggingPrefs": {
                    "driver": "INFO",
                    "server": "OFF",
                    "browser": "INFO"
                },
                "browserstack.user": ".....",
                "browserstack.key": "......",
                "build": "version1",
                "project": "newintropage",
                "chromeOptions": {
                    "args": [
                        "headless"
                    ]
                }
            }
        },
        "edge": {
            "selenium": {
                "start_process": true,
                "port": 4474,
                "server_path": "./selenium-server-standalone-3.9.1.jar"
            },
            "desiredCapabilities": {
                "browserName": "MicrosoftEdge",
                "acceptSslCerts": true
            }
        }
    }
}

| Executable | Version |
| ---: | :--- |
| nightwatch --version | v1.2.3|
| npm --version | 6.10.1|
| yarn --version | n/a|
| node --version | 10.16.0|

| Browser driver | Version |
| ---: | :--- |
| chromedriver | ChromeDriver 77.0.3865.40 (f484704e052e0b556f8030b65b953dce96503217-refs/branch-heads/3865@{#442})q|
| geckodriver | 0.26.0 (e9783a644016 2019-10-10 13:38 +0000) |
|firefox|69.0.3|
| selenium-server | 3.9.1 (standalone)|

| OS | Version |
| ---: | :--- |
| Windows 10 | 1607 |

stale

Most helpful comment

Got the same issue on nightwatch build 1.3.1. any update on the topic ?

All 3 comments

Got the same issue on nightwatch build 1.3.1. any update on the topic ?

This issue has been automatically marked as stale because it has not had any recent activity.
If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.

Still an issue on build 1.5.1.

Error while running .switchToFrame() protocol action: data did not match any variant of untagged enum FrameId at line 1 column 24

Was this page helpful?
0 / 5 - 0 ratings