-
-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to call PageFactory with a Class (Only with "this") #76
Comments
PageFactory.initElements(new AppiumFieldDecorator(myDriver), TheClassImUsingRightNow.class); |
Hi! You are using Selenium PageFactory class. It has no method with these parameters: Please see here: https://github.com/SeleniumHQ/selenium/blob/master/java/client/src/org/openqa/selenium/support/PageFactory.java What does method that you are trying to invoke:
So. If you want to use AppiumFieldDecorator, you should prepare an instance of your PageObject.class whose fields have to be decorated. PageObject pageObject = new PageObject(someParams)
PageFactory.initElements(new AppiumFieldDecorator(driver), pageObject); or public PageObject(someParams){
//staff
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
}
//at automated test
PageObject pageObject = new PageObject(someParams); |
I am sorry for confusion :) Decorator that I made is useful when browser, Android or iOS UI have different locators. @AndroidFindBy AppiumFieldDecorator decorates fields marked by @AndroidFindBy, @iOSFindBy and @findby too. |
This works :
PageFactory.initElements(new AppiumFieldDecorator(myDriver), this);
This is not Working :
PageFactory.initElements(new AppiumFieldDecorator(myDriver), MyClass.class);
Why?
The text was updated successfully, but these errors were encountered: