[Resolved] The method chrome() is undefined for the type DesiredCapabilities – 2022

Issue

Facing below error while working with chrome DesiredCapabilities.

The method chrome() is undefined for the type DesiredCapabilities.

Solution:

Use ChromeOptions object and passed it to the ChromeDriver() constructor as the old method Capabilities is deprecated.
We not need to use options.merge(capabilities); instead, you can use options.setCapability(params, params). Or we can completely skip DesiredCapabilities and use only ChromeOptions with setCapability method like below:

If you are still facing issue, please do write it in comment section.

Regards, Nagaraj