We're currently building a Cordova App that we want to use Appium to write automated tests for so we can test it on various Android and iOS devices.
The issue I'm running into is that I'd like to use PageObjects to target the elements on the various pages since that's the method we're using to test our Web Apps on regular browsers, etc, but I can't seem to figure out how to correctly use this.
If I target the elements within the test I'm perfectly able to target them as follows (we use C# btw):
IList<AppiumWebElement> elements = driver.FindElementsByClassName("android.widget.EditText");
AppiumWebElement email = elements[0];
AppiumWebElement password = elements[1];
AppiumWebElement button = driver.FindElementByClassName("android.widget.Button");
When I try to target using PageObjects I've tried several things after Googling and finding other examples, reading through the UiSelecter API documents, etc, but I must be doing something wrong as my tests keeps hitting an Object Reference not set to an instance of an object.
I've tried the following different ways of targetting:
[FindsBySequence]
[MobileFindsBySequence(Android = true)]
[FindsBy(How = How.ClassName, Using = "EditText", Priority = 1)]
[FindsByAndroidUIAutomator(ClassName = "android.widget.EditText", Priority = 2)]
[FindsByAndroidUIAutomator(AndroidUIAutomator = "new UiSelector().className(\"android.widget.EditText\")[0]", Priority = 3)]
public IMobileElement<AppiumWebElement> email;
Anyone know how to correctly do this? Any help would be greatly appreciated.