Skip to content

Frequently Asked Questions (FAQ)

Matt Edelman edited this page Aug 18, 2020 · 2 revisions

Where are the core Selenium WebDriver API docs?

https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/

Nemo wraps this API, and you should reference it in order to fully control your web browser sessions. Nemo itself only has a few convenience methods. The Selenium WebDriver API has the rest!

How do I add Chrome command line arguments?

You can construct your driver configuration in this manner (note the args array):

    "driver": {
        "builders": {
            "withCapabilities": [
                {
                    "browserName": "chrome",
                    "chromeOptions": {
                        "args": [
                            "headless",
                            "window-size=1200,800",
                            "disable-dev-shm-usage"
                        ]
                    }

                }
            ]
        }
    },

For a list of Chromium command line switches, please see: https://peter.sh/experiments/chromium-command-line-switches/

How can I wait for my page to be ready for interaction?

Sometimes, just waiting for an element to be visible in the DOM isn't enough. This is because your application requires JavaScript event handlers to provide interaction behavior. In these cases, you need to determine some event or global variable that is fired/available before proceeding with your test.

You can do something like this:

await nemo.driver.wait(() => {
  return nemo.driver.executeScript(() => {
    return !!window.domReady;
  })
}, 8000);

The !!window.domReady command will return true once the global variable is set on the DOM. You can replace this test with whatever test will return true once your JavaScript is loaded.