Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass through arbitrary options to drivers #857

Open
jnicklas opened this issue Feb 11, 2021 · 3 comments
Open

Pass through arbitrary options to drivers #857

jnicklas opened this issue Feb 11, 2021 · 3 comments
Assignees
Labels
@bigtest/webdriver issues related to the `@bigtest/webdriver` package

Comments

@jnicklas
Copy link
Collaborator

Currently when defining a driver, we can define it like this:

"chrome.headless": {
  module: "@bigtest/webdriver",
  options: {
    type: 'local',
    browserName: "chrome",
    headless: true
  }
},

There are no other options aside from these. However, the various browsers can be started with a whole bunch of options. For example I wanted to create a chrome.debug driver, with --auto-open-devtools-for-tabs. This is currently not possible, since there is no way to pass through this option. One option would be to change this to something like:

"chrome.headless": {
  module: "@bigtest/webdriver",
  options: {
    type: 'local',
    browserName: "chrome",
    capabilities: {
       "goog:chromeOptions": {
         args: ["headless"]
       }
    }
  }
},

This is much more explicit, and makes it clearer how to configure other capabilities, but it does make it harder to set up new drivers.

Also, the browserName bit is slightly confusing, since it isn't really configuring what browser to use, but rather which executable to run, chromedriver, geckodriver, etc... So maybe it would make sense to change this? But what would a better name be?

I don't think that there are any custom driver setups in the wild yet, so at this point in time this should still be fairly easy to change.

@jnicklas jnicklas added the @bigtest/webdriver issues related to the `@bigtest/webdriver` package label Feb 11, 2021
@cowboyd
Copy link
Member

cowboyd commented Feb 16, 2021

WRT the capabilities argument, this seems very reasonable.

For the case of the "browser name", one of the things that has always bothered me is that the browserName means nothing if the if the type is "remote". By the same token, if the type is remote, then where does the url come from?

Perhaps, the local/remote options should be under the local/remote key.

{
"chrome.headless": {
  module: "@bigtest/webdriver",
  options: {
    local: 'chromdriver',
    capabilities: {
       "goog:chromeOptions": {
         args: ["headless"]
       }
    }
  }
},
"safari": {
  module: "@bigtest/webdriver",
  options: {
    remote: "https://api.saucelabs.com",
    capabilities: {
      "safari:webkitOptions" {
        "args": []
      }
    }
  }
}
}

@jnicklas
Copy link
Collaborator Author

That's a much improved API, IMO. It might be worth questioning even the local/remote dichotomy. It seems like this is something that is somewhat ingrained in webdriver, but an even more descriptive alternative might be something like this:

{
"chrome.headless": {
  module: "@bigtest/webdriver",
  options: {
    binary: 'chromedriver',
    capabilities: {
       "goog:chromeOptions": {
         args: ["headless"]
       }
    }
  }
},
"safari": {
  module: "@bigtest/webdriver",
  options: {
    url: "https://api.saucelabs.com",
    capabilities: {
      "safari:webkitOptions" {
        "args": []
      }
    }
  }
}
}

@cowboyd
Copy link
Member

cowboyd commented Feb 17, 2021

That looks perfect 👌🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@bigtest/webdriver issues related to the `@bigtest/webdriver` package
Projects
None yet
Development

No branches or pull requests

2 participants