Selenium 4 Dotnet ChromiumDriver extends Webdriver instead of RemoteWebDriver

36 views
Skip to first unread message

Janakiraman Pachaiyappan

unread,
Oct 24, 2021, 1:09:36 AM10/24/21
to Selenium Users
In the DOTNET alpha versions of Selenium 4, ChromiumDriver extends RemoteWebDriver. But in Selenium 4.0.0 I see ChromiumDriver extends WebDriver. Is this a bug or was this intentional? 

I get a type cast exception when i try to do something like this

RemoteWebDriver driver = new ChromeDriver();

this used to work fine till the alpha versions. 

Jim Evans

unread,
Oct 25, 2021, 2:56:22 PM10/25/21
to Selenium Users
Yes, the concrete implementations and class hierarchy of the .NET bindings has changed. If you've been relying on the fact that, say ChromeDriver always and forever has and will inherit from RemoteWebDriver, you've been Doing It Wrong™. You should be using the IWebDriver interface for all of your interaction with the driver instance. If you're going to insist on declaring your variables as an implementation type instead of an interface type, then you may be able to change to having your variable declared as type WebDriver, but this is not guaranteed to work forever going forward.
Reply all
Reply to author
Forward
0 new messages