[TestFixture]
public class UnitTest1
{
private static AppiumDriver<AndroidElement> _driver;
[SetUp()]
public void Setup()
{
// create appium driver capabilities
DriverOptions caps = new AppiumOptions();
caps.AddAdditionalCapability(MobileCapabilityType.DeviceName, "SAMSUNG-SM-G920V");
// add appPackage and appActivity
caps.AddAdditionalCapability("appPackage", "app");
caps.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android");
caps.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "5.1.1");
caps.AddAdditionalCapability(AndroidMobileCapabilityType.AppActivity, "com.costar.marketingcenter.framework.features.login.activities.LoginActivity");
caps.AddAdditionalCapability(MobileCapabilityType.AutomationName, "UiAutomator2");
//start the driver
_driver = new AndroidDriver<AndroidElement>(new Uri("http://127.0.0.1:4723/wd/hub"), caps);
TimeSpan timeSpan = TimeSpan.FromSeconds(2000);
_driver.Manage().Timeouts().ImplicitWait = timeSpan;
}
setValue
on a text field will sometimes skip certain letters. My guess is that the input is sent too quickly such that some characters are lost. I've tried fiddling with a work around using setInterval
and async/await, but I can't seem to get it to send just individual letters (addValue
seems to just concatenate and then use setValue
under the hood, so it has the same issue). I wonder if there is a better solution?
setValue
seems to work differently between iOS and Android. On iOS it appends to the input, whereas on Android it clears the input and then adds the values. Anyway this works for me on iOS: for (let c of text) { $("~input-field").setValue(c); driver.pause(100) }
.
driver.sleep()
on iOS. Thanks for listening everyone. :D
Can anybody to assist with hybrid app automation?
I have autoWebview: true in options.
My app starts successful.
I tried to get the element by different ways, for example,
driver.elementsByCss
but it raises error “elementsByCss is not a function”.
Eventually I've got the element with command
const element = await driver.findElement('css selector', '.input-username');
But this element does understand any element commands like click, addValue, type...
What is wrong?