Search code examples
c#selenium-webdriverwebdriverselenium-chromedriver

How can I pass a directory path, ChromeOptions, and ChromeDriverService to a new ChromeDriver?


I'm creating a new ChromeDriver object, but I want to pass to it a ChromeDriverService object, a ChromeOptions object, and a path to the driver. However, looking at this page, the contructor doesn't support passing all three of those. How can I do it?


Solution

  • You can't pass both driver path and ChromeDriverService to ChromeDriver, because ChromeDriverService already takes driver path itself.

    CreateDefaultService(String) Creates a default instance of the ChromeDriverService using a specified path to the ChromeDriver executable.

    CreateDefaultService(String, String) Creates a default instance of the ChromeDriverService using a specified path to the ChromeDriver executable with the given name.

    Documentation