C
C#6mo ago
WarningShoot

Appium error

Hey, i want to write some ui tests using appium but i got some weird error
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.Enums;

namespace appiumtest;

public class Tests
{
private AndroidDriver _driver;

[OneTimeSetUp]
public void SetUp()
{
var serverUri = new Uri(Environment.GetEnvironmentVariable("APPIUM_HOST") ?? "http://127.0.0.1:4723/");
var driverOptions = new AppiumOptions() {
AutomationName = AutomationName.AndroidUIAutomator2,
PlatformName = "Android",
DeviceName = "Android Emulator",
};

driverOptions.AddAdditionalAppiumOption("appPackage", "com.android.settings");
driverOptions.AddAdditionalAppiumOption("appActivity", ".Settings");
// NoReset assumes the app com.google.android is preinstalled on the emulator
driverOptions.AddAdditionalAppiumOption("noReset", true);

_driver = new AndroidDriver(serverUri, driverOptions, TimeSpan.FromSeconds(180));
_driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}

[OneTimeTearDown]
public void TearDown()
{
_driver.Dispose();
}

[Test]
public void TestBattery()
{
_driver.StartActivity("com.android.settings", ".Settings");
_driver.FindElement(By.XPath("//*[@text='Battery']")).Click();
}
}
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.Enums;

namespace appiumtest;

public class Tests
{
private AndroidDriver _driver;

[OneTimeSetUp]
public void SetUp()
{
var serverUri = new Uri(Environment.GetEnvironmentVariable("APPIUM_HOST") ?? "http://127.0.0.1:4723/");
var driverOptions = new AppiumOptions() {
AutomationName = AutomationName.AndroidUIAutomator2,
PlatformName = "Android",
DeviceName = "Android Emulator",
};

driverOptions.AddAdditionalAppiumOption("appPackage", "com.android.settings");
driverOptions.AddAdditionalAppiumOption("appActivity", ".Settings");
// NoReset assumes the app com.google.android is preinstalled on the emulator
driverOptions.AddAdditionalAppiumOption("noReset", true);

_driver = new AndroidDriver(serverUri, driverOptions, TimeSpan.FromSeconds(180));
_driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}

[OneTimeTearDown]
public void TearDown()
{
_driver.Dispose();
}

[Test]
public void TestBattery()
{
_driver.StartActivity("com.android.settings", ".Settings");
_driver.FindElement(By.XPath("//*[@text='Battery']")).Click();
}
}
code is basically from docs and throws error at creating instance of AndroidDriver
appiumtest.AppiumTests.TestBattery

OneTimeSetUp: System.TypeLoadException : Method 'ExecuteAsync' in type 'OpenQA.Selenium.Appium.Service.AppiumCommandExecutor' from assembly 'Appium.Net, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Exception doesn't have a stacktrace
appiumtest.AppiumTests.TestBattery

OneTimeSetUp: System.TypeLoadException : Method 'ExecuteAsync' in type 'OpenQA.Selenium.Appium.Service.AppiumCommandExecutor' from assembly 'Appium.Net, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Exception doesn't have a stacktrace
What could be the issue and how to solve it?
1 Reply
WarningShoot
WarningShootOP6mo ago
Bump
Want results from more Discord servers?
Add your server