Dear Aleksei,
I only worked Page objects with Webdriver page object initialization.
I tried the above , currently it throwing me the error
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;J)V
I tried the page initialization using PageFactory.initElements(new AppiumFieldDecorator(driver), this); and
PageFactory.initElements(new AppiumFieldDecorator(driver, 10, TimeUnit.SECONDS), this);.
Both giving same error. Kindly help.
Kindly help.
@semrafi i did not ask you to change in Page something. i have same "initElements" as you are.
public abstract class Page {
public Page(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(new AppiumFieldDecorator(driver, defaultLook, TimeUnit.SECONDS), this);
}
...
public class XXXXX_page extends Page {
@AndroidFindBy (id = "activate_fingerprint")
private List<AndroidElement> mainContainer;
public XXXXX_page(WebDriver driver) {
super(driver);
}
public boolean tapDeclineButton() {
System.out.println(" tap Decline button");
try {
return tapElement(bottomLayout.findElements(MobileBy.className("android.widget.TextView")).get(1));
} catch (Exception e) {
return false;
}
}
...
//test code
public class BaseTest {
protected static AppiumDriver driver = null;
protected static AppiumDriver driver_2 = null;
.....
public class xxxxXXXX extends BaseTest {
xxxPage = new xxxPage(driver);
assertTrue("'xxxx' screen NOT loaded", xxxPage.isxxxPageLoaded());
...
Could anyone please help me, I am still not able to resolve the issue with page factory.
The question may be so basic, Please answer.
Can we have the WebElement and Android Element in the same page and initialize the page using AppiumFieldDecorator.
I am trying in that way and not working , I am not sure whether this is correct. below is the code i used in the page.
The same element i am identifying using the below in same page
public class SelectArea extends BaseClass {
@FindBy(id="com.talabat:id/search_ar") private WebElement txtSearchAr;
@AndroidFindBy(id="com.talabat:id/search_ar") private AndroidElement txtSearchArAndroidBy;
//and initialize the page by constructor as
public SelectAr(AndroidDriver TestDriver)
{
driver =TestDriver;
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
......
}
}
And driver initialized as
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
Issue I am getting is
java.lang.NoSuchMethodError: org.openqa.selenium.support.ui.FluentWait.until(Ljava/util/function/Function;)Ljava/lang/Object;
at io.appium.java_client.pagefactory.AppiumElementLocator.waitFor(AppiumElementLocator.java:91)
at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:112)
at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(InterceptorOfASingleElement.java:61)
at io.appium.java_client.android.AndroidElement$$EnhancerByCGLIB$$c0b591f0.replaceValue()
Thank You.
Hi I got solved (by upgrading selinium version to the latest one) the above issue with Page Factory initialization for Apps using appium , just commenting here as it would be helpful if anyone else face the same issue.
org.openqa.selenium.support.ui.FluentWait.until(Ljava/util/function/Function;)Ljava/lang/Object;
The above error will throw if you use maven project with Selinium dependency version 3.2. It isdue to exception from fluent wait.
It is fixed from Selenium version 3.2.0 and above. You can refer the selinium relase note for the same ( https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG#L18-L195).
Dear Aleksei,
I tried by setting the value using keyword txtSearchArea.setValue("الشرق") . But it is not displaying the given value in the Text field ,also no error is getting displayed.
Did any of you could support me to find out the solution. I am really stuck here, as my apps having Arabic version to test.
Highly appreciated you help.
Thanks,
Semeena.
Hi Aleksi,
I tried to input Arabic text in the text field with reference to this link http://appium.io/slate/en/master/?java#multi-lingual-support3 , but not working ..It fired the below exception : Caused by: java.nio.charset.UnsupportedCharsetException: x-IMAP-mailbox-name
at java.nio.charset.Charset.forName(Charset.java:531)
at com.helperAPI.UnicodeEncoder.(UnicodeEncoder.java:14)
@semrafi never tried Arabic for EDIT (only for search) . try also:
(Alternatively, on the device, access Settings, then Language & Input. Make sure Appium Android Input Manager for Unicode is selected, and finally go to Default and set it to Appium Android Input Manager for Unicode.)
maybe you need also try to add ARABIC keyboard and set it as DEFAULT! - just idea.
@semrafi ok. i tried myself - https://screencast.com/t/7CzA1nAwZgT13
what i did:
1) added:
capabilities.setCapability("unicodeKeyboard", "true");
2) email text was updated to "sendKeys"
emailInput.sendKeys(text);
and it started to work.
@semrafi mine test device LG G4. let's try with Sony M4 - also fine. Samsung S6 - also fine.