Sendkeys with Arabic text issue


#6

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.


#7

@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());
...

#8

Dear Aleksei,
Let me try what is the problem for the above error(java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;J)V) from my side , If I am unable to solve, Kindly i may need your support more… Thank You so much.


#9

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.


#10

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-L19).


#11

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.


#12

Did you set “true” unicodeKeyboard property when you start driver?


#13

Thanks for the Reply… I didn’t set , Could you share the format , I will try.
Ok I got it. I will try and let you know… Thanks


#14

Yes , I tried now by setting the capability as
capabilities.setCapability(“unicodeKeyboard”, true);

But still it is not displaying the Arabic text value in the text field and no error generated with Appium v1.6.4.


#15

Kindly suggest if I could try with any other way?

Thanks


#16

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-support , 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)


#17

@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.


#18

Thanks for the Reply. I tried in that way only, but not working… Arabic is not getting printed in the Text Area field…


#19

@semrafi ok. i tried myself - https://screencast.com/t/7CzA1nAwZgT

what i did:

  1. added:
capabilities.setCapability("unicodeKeyboard", "true");
  1. email text was updated to “sendKeys”
emailInput.sendKeys(text);

and it started to work.


#20

Sounds great…But the same I tried and not worked in Samsung S7… Which device you used?


#21

Thanks a lot Aleksei… I am really happy…it started working for me as well in the Real Device…I don’t know what was wrong it didn’t work when i tried yesterday… Anyway thanks…


#22

@semrafi mine test device LG G4. let’s try with Sony M4 - also fine. Samsung S6 - also fine.


#23

thanks a lot man , i tried like you and it work . thanks :kissing_heart::kissing_heart:


#24

Hi Aleksei,
When parsing the Arabic text, keyboard is not displaying but if keyboard is displayed wont parse the text.
Is it the behaviour ?
as i observe it is considering the external keyboard as keyboard input


#25

@suresh_bijjam once again:

  1. add arabic keyboard on device and set it default
  2. add unicode capability to driver
  3. also try tap element before
  4. instead of setValue you can try SendKeys