I able to open my app successfully using Appium
C#. Now on loginPage
I want to get EditText
so that I can fill userName
.
I have tried many ways but all throwing or other issues. This is my code
public class UnitTest1
{
private AndroidDriver<AndroidElement> driver;
private DesiredCapabilities capabilities;
[SetUp]
public void InItDriver()
{
capabilities = new DesiredCapabilities();
capabilities.SetCapability("deviceName", "ZZ2222HMLF");
//capabilities.SetCapability("[platformName", "Android");
capabilities.SetCapability("noReset", true);
capabilities.SetCapability("autoGrantPermissions", "true");
capabilities.SetCapability("appPackage", "com.sisapp.in.lgm");
capabilities.SetCapability("automationName", "UiAutomator2");
capabilities.SetCapability("appActivity", "md5b1afd03e09ce5243fd0287b176ff38ea.SplashActivity");
driver = new AndroidDriver<AndroidElement>(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
//driver = new AndroidDriver<AndroidElement>(new Uri("https:127.0.0.1:4723/wd/hub"), capabilities);
}
[Test]
public void Test1()
{
AndroidElement textView = driver.FindElementById("input_name");
textView.SendKeys("ak@ct");
Assert.IsNotNull(driver);
System.Threading.Thread.Sleep(2000);
}
[TearDown]
public void CloseTest()
{
//driver.Quit();
}
}
Throwing exception
Message: OpenQA.Selenium.InvalidSelectorException : Locator Strategy 'css selector' is not supported for this session
How can I solve this issue?
答案 0 :(得分:1)
我认为您具有旧版本的selenium依赖关系,我认为您的客户已经具有selenium依赖关系,并且您添加了一个旧版本,这造成了这种混乱。
https://gist.github.com/jtoal436/5a33661f5ac53b7ee3c4520a4314e906
答案 1 :(得分:0)
已通过在 cmd
解决方法:
npm uninstall -g appium
npm install -g appium@1.7.2 --no-shrinkwrap
我找到了here。