Skip to content

[🚀 Feature]: Selenium Manager Bindings API #11360

@titusfortner

Description

@titusfortner

Feature and motivation

As I see it, we have 3 basic routes we can go for using Selenium Manager going forward.

  1. Add relevant methods to Service classes
  2. Create instance of SeleniumManager and pass it as argument into Service class
  3. Create instance of SeleniumManager and pass it as argument into Driver class

My opinions

  1. This seems like the easiest thing for users to work with. They may already be using these classes and can now add to them. They don't need to know how it's being done; they are requesting it, Selenium is doing it. Easy to do this with Service class builder pattern, but the constructor(s) will get weird each time we add a new parameter.
  2. If we want to put all these concerns in one place, have the user explicitly opt-in to "Selenium Manager," or just highlight better the Selenium Manager feature, this might be good. Builder pattern of Service class would make this a straightforward add, and only one additional constructor required.
  3. The reason to pick this one is because Selenium Manager at some point will be downloading browsers as well as drivers (or the grid?). If that's the case do the concerns actually all fit in the "Service" class? The huge down side of this is that adding all the constructors required will be messy.

Examples below are Java with its builder class, but the principle is the same in all languages.

Usage example

Option 1 — Add everything directly in the service class

DriverService ds = new ChromeDriverService.Builder()
  .withBrowserVersion("103")
  .withDriverVersion("105.0.5195.19")
  .withBrowserTTL(Duration.ofHours(3))
  .withClearManagerCache()
  .build();
Chromedriver driver = new ChromeDriver(ds, new ChromeOptions());

Option 2 — Selenium Manager instance into service class

SeleniumManager sm = new SeleniumManager.Builder();
  .withBrowserVersion("103")
  .withDriverVersion("105.0.5195.19")
  .withBrowserTTL(Duration.ofHours(3))
  .withClearManagerCache()
  .build();

DriverService ds = new ChromeDriverService.Builder()
  .withManager(sm)
  .build();
Chromedriver driver = new ChromeDriver(ds, new ChromeOptions());

Option 3 — Selenium Manager instance into driver class

SeleniumManager sm = new SeleniumManager.Builder();
  .withBrowserVersion("103")
  .withDriverVersion("105.0.5195.19")
  .withBrowserTTL(Duration.ofHours(3))
  .withClearManagerCache()
  .build();

Chromedriver driver = new ChromeDriver(new ChromeOptions(), sm);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions