dotnet-client: Latest Selenium 4 beta 4 breaking Appium elements

Description

From Selenium change log https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/CHANGELOG

_* Updated Chromium-based browsers to correclty inherit Options.

  • Refactored .NET bindings class inheritance hierarchy. This breaks the assumption that all browser-specific driver (ChromeDriver, FirefoxDriver, EdgeDriver, etc.) are all subclasses of RemoteWebDriver. This is no longer the case. The guidance for all users has always been to write your Selenium code using the IWebDriver interface, rather than the concrete implementation classes. If you have followed this guidance in your Selenium code, this change should be largely transparent to you. If you have used the implementation classes, this might be a breaking change._

I have some basic code that looks like this

AndroidDriver<AppiumWebElement> appiumDriver = new AndroidDriver<AppiumWebElement>(new System.Uri("http://hub-cloud.browserstack.com/wd/hub/"), appiumOptions);

Which is throwing a build error

Error CS7069 Reference to type ‘RemoteWebElement’ claims it is defined in ‘WebDriver’, but it could not be found

If I try to switch away from the AppiumWebElement like so

AndroidDriver<IWebElement> appiumDriver = new AndroidDriver<IWebElement>(new System.Uri("http://hub-cloud.browserstack.com/wd/hub/"), appiumOptions);

Then I get Error CS7069 Reference to type ‘ICommandExecutor’ claims it is defined in ‘WebDriver’, but it could not be found KeyWordDriver C:\Automation\VSTS\SeleniumDriver\Selenium\DriverHelper.cs 758 Active

Environment

C# .Net Using latest 4.3.1 of this project.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 22 (2 by maintainers)

Commits related to this issue

Most upvoted comments

This can be used in v5… available via nuget or the release page

As Dor showed, AppiumWebElement / AndroidElement are not recognized .

AppiumDriver<AppiumWebElement> driver = new AndroidDriver<AppiumWebElement>(new Uri(“http://127.0.0.1:4723/wd/hub”), appiumOpt);

image @akinsolb

ENV: C# .Net Appium.WebDriver 4.3.1 Selenium.WebDriver 4.0.0-Beta 4 Selenium.Support 4.0.0 -Beta 4

@Dor-bl Does this issue happen also when using Appium.WebDriver 5.0.0-beta01 and Selenium.WebDriver 4.1.0?

Ok… then we now have two branches prepping for v4.0.0-rc1… I’m more than happy to help, I just wouldn’t want people duplicating effort on the same thing. Nonetheless @TroyWalshProf is the person with the other branch, and whichever is ready and published for a pull request will get considered. We can all chat on the slack channel if you have access to that. Feel free to drop me an e-mail at bakinsola@gmail.com and I’ll send an invite

@Dor-bl 1. There is currently a WIP branch here. I’m not sure if you want to continue going through the trouble of the migration, but it can be a remote branch in the near future once the bugs are ironed out.

  1. I believe AppiumOptions should be an abstract class derived from DriverOptions, with each driver deriving from that.

In an ideal world, the current version would have driver options in one final release before migrating to Selenium 4. I’m back on this project from this week.