sendKeys not working using Appium automation for Hybrid app

Hi,
I need some help regarding Hybrid app (developed using ionic v3 framework) automation using Appium (v 1.9.0).
I am not able to sendKeys to the text box of User Name field.
I have used “driver.sendKeys(“abc”);” and it throws error as “Can not focus element”.
I am able to use driver.findElement(By.id(“userName”)).click(); successfully.

Please help me with this issue.

Thanks,
Yusuf

How you resolved it? it’s 2020 I’m still facing the same issue.

Hi, Actually the xpath was wrongly written by me. Have written it correctly and it worked.
Thanks

But using xpath is not a reliable option right? because xpath varies for each of the device ?