Skip to content

Programmatic browser and driver version access #1474

@chabala

Description

@chabala

If I call

WebDriverManager.chromedriver().setup();

the discovered browser version, and downloaded/located driver version are printed to the log, like this:

Using chromedriver 132.0.6834.159 (resolved driver for Chrome 132)

this happens here:

if (optionalDriverVersion.isPresent()) {
driverVersion = optionalDriverVersion.get();
log.info("Using {} {} (resolved driver for {} {})",
getDriverName(), driverVersion,
getDriverManagerType().getBrowserName(),
resolvedBrowserVersion);

If I want programmatic access to these versions, for instance, to expose to monitoring instrumentation or print in an after-execution report, they seem to be very hard to get to. This log statement is buried in the middle of a protected method with a lot of other responsibilities.

getDriverVersion() and getBrowserVersion() are also protected methods. I've tried calling getChromeDriverVersion() on the Config object, and it always seems to return an empty string. What am I missing here? How can I get access to the same values that were logged?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions